From 996a95a70b5d5671b6ff6219fd06620e2d59d499 Mon Sep 17 00:00:00 2001 From: Sreedev Kodichath Date: Wed, 5 Aug 2026 16:07:37 +0200 Subject: [PATCH] [CI] woodpecker: release artifacts for aarch64 --- .woodpecker/release.yml | 29 ++++++++++++++++++++++------- docs/ci.md | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/.woodpecker/release.yml b/.woodpecker/release.yml index bb58044..08b86eb 100644 --- a/.woodpecker/release.yml +++ b/.woodpecker/release.yml @@ -10,6 +10,12 @@ variables: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: '0' CARGO_HOME: '${CI_WORKSPACE}/.cargo' + # The machine of the workflow is x86_64. A program for aarch64 therefore + # needs another linker. The GNU C library needs the cross compiler of the + # image. The musl C library comes with the Rust target, so the linker of + # Rust is enough. + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: rust-lld steps: - name: version @@ -30,12 +36,18 @@ steps: image: *rust_image environment: *cargo_env commands: - - rustup target add x86_64-unknown-linux-gnu x86_64-unknown-linux-musl - - cargo build --release --locked -p dynamonix --target x86_64-unknown-linux-gnu - - cargo build --release --locked -p dynamonix --target x86_64-unknown-linux-musl + - apt-get update + - apt-get install --yes --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + - | + rustup target add \ + x86_64-unknown-linux-gnu x86_64-unknown-linux-musl \ + aarch64-unknown-linux-gnu aarch64-unknown-linux-musl - mkdir -p dist - | - for triple in x86_64-unknown-linux-gnu x86_64-unknown-linux-musl; do + for triple in \ + x86_64-unknown-linux-gnu x86_64-unknown-linux-musl \ + aarch64-unknown-linux-gnu aarch64-unknown-linux-musl; do + cargo build --release --locked -p dynamonix --target "$triple" name="dynamonix-$${CI_COMMIT_TAG}-$triple" mkdir -p "dist/$name" cp "target/$triple/release/dynamonix" "dist/$name/dynamonix" @@ -53,15 +65,18 @@ steps: cat > dist/notes.md <-x86_64-unknown-linux-musl.tar.gz` | The program with no dependency on a system library. | -| `dynamonix--x86_64-unknown-linux-gnu.tar.gz` | The program for the GNU C library. | +| `dynamonix--x86_64-unknown-linux-musl.tar.gz` | The program for a x86_64 computer, with no dependency on a system library. | +| `dynamonix--x86_64-unknown-linux-gnu.tar.gz` | The program for a x86_64 computer with the GNU C library. | +| `dynamonix--aarch64-unknown-linux-musl.tar.gz` | The program for an aarch64 computer, with no dependency on a system library. | +| `dynamonix--aarch64-unknown-linux-gnu.tar.gz` | The program for an aarch64 computer with the GNU C library. | + +A file contains the program, the `README.md` file and the `docs` directory. To +install the program, take it out of the compressed file and put it in a +directory of your `PATH`: + +```sh +arch=$(uname -m) +tar -xzf dynamonix--$arch-unknown-linux-musl.tar.gz +install -Dm755 dynamonix--$arch-unknown-linux-musl/dynamonix ~/.local/bin/dynamonix +``` The publish step also makes a file of the SHA-256 sums. +### The programs for aarch64 + +The machine of the workflow is x86_64, so the two programs for aarch64 come +from a cross compilation. The `artifacts` step therefore installs the +`gcc-aarch64-linux-gnu` and `libc6-dev-arm64-cross` packages, and the workflow +gives a linker to Cargo for each aarch64 target: + +| Target | Linker | +| --- | --- | +| `aarch64-unknown-linux-gnu` | `aarch64-linux-gnu-gcc`, from the packages. | +| `aarch64-unknown-linux-musl` | `rust-lld`, because the Rust target already has the musl C library. | + +The program has no C code and no dependency on a system library, so nothing +more is necessary. Add a linker here if a future dependency needs one. + ## The token The publish step needs a token. Make a secret with the name `RELEASE_TOKEN` in -- 2.51.2