Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,68 @@ jobs:
crates-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
dry-run: ${{ !secrets.CARGO_REGISTRY_TOKEN }}
tag-crate: editpe

build:

name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}

strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: .exe
- os: windows-latest
target: aarch64-pc-windows-msvc
ext: .exe
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin

steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: recursive
show-progress: false

- name: Install cross-compilation linker
if: matrix.linker
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.linker }}

- name: Set up Rust toolchain
uses: Systemcluster/actions@setup-rust-v0
with:
channel: stable
cache-key-job: true

- name: Add Rust target
run: rustup target add ${{ matrix.target }}

- name: Configure linker
if: matrix.linker
run: |
TARGET=$(echo "${{ matrix.target }}" | tr 'a-z-' 'A-Z_')
LINKER_BIN=$(echo "${{ matrix.linker }}" | sed 's/^gcc-//')
echo "CARGO_TARGET_${TARGET}_LINKER=${LINKER_BIN}-gcc" >> $GITHUB_ENV

- name: Build
run: |
cargo build --release --target ${{ matrix.target }} --bin editpe
cp "target/${{ matrix.target }}/release/editpe${{ matrix.ext }}" "editpe-${{ matrix.target }}${{ matrix.ext }}"

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
path: editpe-${{ matrix.target }}${{ matrix.ext }}
archive: false
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ name = "editpe"
path = "src/lib.rs"
doctest = false

[[bin]]

name = "editpe"
path = "src/main.rs"
required-features = ["cli"]

[features]

default = ["std", "images"]
default = ["std", "images", "cli"]

# Enables standard library features, including reading and writing files.
std = ["dep:thiserror"]
# Enables processing images with the `image` crate. Also enables `std`.
images = ["std", "dep:image"]
# Enables the editpe binary.
cli = ["std", "images", "dep:clap"]
Comment thread
pl4nty marked this conversation as resolved.
Outdated

[dependencies]

Expand All @@ -46,6 +54,7 @@ foldhash = { version = "0.2.0", default-features = false }

image = { version = "0.25.2", default-features = false, optional = true, features = ["ico"] }
thiserror = { version = "2.0", optional = true }
clap = { version = "4.6", optional = true, features = ["derive"] }

[dev-dependencies]

Expand Down
Loading
Loading