Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ name = "editpe"
path = "src/lib.rs"
doctest = false

[[bin]]

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

[features]

default = ["std", "images"]
Expand All @@ -35,6 +41,8 @@ default = ["std", "images"]
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"]

[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