diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index b6861d8..d3ca39c 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -19,11 +19,19 @@ jobs: strategy: fail-fast: false matrix: - target: - - x86_64-unknown-linux-gnu - - aarch64-unknown-linux-gnu - - x86_64-unknown-linux-musl - - aarch64-unknown-linux-musl + include: + - target: x86_64-unknown-linux-gnu + apt: "" + rustflags: "" + - target: aarch64-unknown-linux-gnu + apt: "gcc-aarch64-linux-gnu" + rustflags: "" + - target: x86_64-unknown-linux-musl + apt: "musl-tools" + rustflags: "" + - target: aarch64-unknown-linux-musl + apt: "" + rustflags: "-C linker=rust-lld -C link-self-contained=yes" steps: - uses: actions/checkout@v4 @@ -31,11 +39,16 @@ jobs: with: targets: ${{ matrix.target }} + - name: Install cross toolchain + if: matrix.apt != '' + run: | + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends ${{ matrix.apt }} + - name: Cache cargo state uses: actions/cache@v4 with: path: | - ~/.cargo/bin ~/.cargo/registry ~/.cargo/git target @@ -43,14 +56,15 @@ jobs: restore-keys: | ${{ runner.os }}-cargo-release-${{ matrix.target }}- - - name: Install cross - run: | - if ! command -v cross >/dev/null 2>&1; then - cargo install cross --locked --version 0.2.5 - fi - - - name: Cross-compile nuwiki-ls - run: cross build --release --target ${{ matrix.target }} -p nuwiki-ls + - name: Build nuwiki-ls + env: + # Per-target linker overrides. Cargo ignores the entries that + # don't match the current target, so setting all of them here + # keeps the matrix declarative. + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc + RUSTFLAGS: ${{ matrix.rustflags }} + run: cargo build --release --target ${{ matrix.target }} -p nuwiki-ls - name: Package archive id: package