Skip to content
Closed
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
27 changes: 20 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,26 @@ jobs:
- name: Tests
run: cargo test --all-features

# The release workflow cross-compiles four targets. Proving they still
# compile here means a release never fails on a platform nobody built.
# The release workflow builds five targets, two of them cross-compiled.
# Building — not merely checking — is the point: `cargo check` does not link,
# and a missing cross C library is a link error. v1.1.0 shipped without its
# Linux ARM64 assets for exactly that reason.
targets:
name: Compiles for ${{ matrix.target }}
name: Builds for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
# Only consulted when building the matching target.
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest }
- {
target: aarch64-unknown-linux-gnu,
os: ubuntu-latest,
apt: "gcc-aarch64-linux-gnu libc6-dev-arm64-cross",
}
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-pc-windows-msvc, os: windows-latest }
Expand All @@ -58,13 +67,17 @@ jobs:
with:
targets: ${{ matrix.target }}

- name: Install cross toolchain
if: matrix.apt != ''
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends ${{ matrix.apt }}

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

# `check` does not link, so no cross-linker is needed here. Linking is
# exercised by the release workflow.
- run: cargo check --all-targets --target ${{ matrix.target }}
- run: cargo build --release --target ${{ matrix.target }}

# Guard the promise the README makes: an ordinary export carries no personal
# data, and no real document is ever committed.
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
matrix:
include:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest, apt: gcc-aarch64-linux-gnu }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-latest, apt: "gcc-aarch64-linux-gnu libc6-dev-arm64-cross" }
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-pc-windows-msvc, os: windows-latest }
Expand All @@ -64,7 +64,10 @@ jobs:
with:
targets: ${{ matrix.target }}

- name: Install cross-linker
# The cross compiler only *recommends* the target C library, so the
# library has to be named explicitly alongside it: without it the linker
# reports "cannot find crti.o" and "cannot find -lc".
- name: Install cross toolchain
if: matrix.apt != ''
run: |
sudo apt-get update
Expand Down Expand Up @@ -113,7 +116,7 @@ jobs:
matrix:
include:
- { target: x86_64-unknown-linux-gnu, arch: amd64 }
- { target: aarch64-unknown-linux-gnu, arch: arm64, apt: gcc-aarch64-linux-gnu }
- { target: aarch64-unknown-linux-gnu, arch: arm64, apt: "gcc-aarch64-linux-gnu libc6-dev-arm64-cross" }
steps:
- uses: actions/checkout@v7
with:
Expand All @@ -123,7 +126,10 @@ jobs:
with:
targets: ${{ matrix.target }}

- name: Install cross-linker
# The cross compiler only *recommends* the target C library, so the
# library has to be named explicitly alongside it: without it the linker
# reports "cannot find crti.o" and "cannot find -lc".
- name: Install cross toolchain
if: matrix.apt != ''
run: |
sudo apt-get update
Expand Down