Skip to content

ci.yml: Add aarch64 targets for GNU/Linux and Windows #51

ci.yml: Add aarch64 targets for GNU/Linux and Windows

ci.yml: Add aarch64 targets for GNU/Linux and Windows #51

Workflow file for this run

on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build afsr
runs-on: ${{ matrix.artifact.os }}
env:
CARGO_TERM_COLOR: always
# https://github.com/rust-lang/rust/issues/78210
RUSTFLAGS: -C strip=symbols -C target-feature=+crt-static
# https://github.com/rust-lang/cargo/pull/15462
RUSTDOCFLAGS: -C target-feature=+crt-static
TARGETS: ${{ join(matrix.artifact.targets, ' ') || matrix.artifact.name }}
ANDROID_API: ${{ matrix.artifact.android_api }}
strategy:
fail-fast: false
matrix:
artifact:
# - os: ubuntu-latest
# name: x86_64-unknown-linux-gnu
# - os: ubuntu-24.04-arm
# name: aarch64-unknown-linux-gnu
# - os: windows-latest
# name: x86_64-pc-windows-gnu
- os: windows-11-arm
name: aarch64-pc-windows-gnullvm
# - os: macos-latest
# name: universal-apple-darwin
# targets:
# - aarch64-apple-darwin
# - x86_64-apple-darwin
# combine: lipo
# - os: ubuntu-latest
# name: aarch64-linux-android31
# targets:
# - aarch64-linux-android
# android_api: '31'
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# For git describe
fetch-depth: 0
submodules: true
- name: Update Rust
run: rustup update stable
- name: Install cargo-android
shell: bash
run: |
cargo install \
--git https://github.com/chenxiaolong/cargo-android \
--tag v0.1.3
- name: Install llvm-mingw
if: matrix.artifact.os == 'windows-11-arm'
shell: bash
run: |
version=20251021
curl -fLO "https://github.com/mstorsjo/llvm-mingw/releases/download/${version}/llvm-mingw-${version}-ucrt-aarch64.zip"
7z x "llvm-mingw-${version}-ucrt-aarch64.zip"
which clang
echo "$(pwd)/llvm-mingw-${version}-ucrt-aarch64/bin" >> "${GITHUB_PATH}"
- name: Get version
id: get_version
shell: bash
run: |
echo -n 'version=' >> "${GITHUB_OUTPUT}"
git describe --always \
| sed -E "s/^v//g;s/([^-]*-g)/r\1/;s/-/./g" \
>> "${GITHUB_OUTPUT}"
- name: Install toolchains
shell: bash
run: |
for target in ${TARGETS}; do
rustup target add "${target}"
done
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
- name: env
shell: bash
run: |
env | sort
which clang
which clang.exe
- uses: msys2/setup-msys2@v2
id: setup-msys2
- uses: mxschmitt/action-tmate@v3
with:
msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }}
# - name: Clippy
# shell: bash
# run: |
# for target in ${TARGETS}; do
# cargo android \
# clippy --release --features static \
# --target "${target}"
# done
#
# - name: Formatting
# run: cargo fmt -- --check
- name: Build
shell: bash
run: |
for target in ${TARGETS}; do
cargo android \
build --release --features static \
--target "${target}" -v
done
- name: Create output directory
shell: bash
run: |
rm -rf target/output
case "${{ matrix.artifact.combine }}" in
lipo)
mkdir target/output
cmd=(lipo -output target/output/afsr -create)
for target in ${TARGETS}; do
cmd+=("target/${target}/release/afsr")
done
"${cmd[@]}"
;;
'')
ln -s "${TARGETS}/release" target/output
;;
*)
echo >&2 "Unsupported combine argument"
exit 1
;;
esac
- name: Archive artifacts
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: afsr-${{ steps.get_version.outputs.version }}-${{ matrix.artifact.name }}
path: |
target/output/afsr
target/output/afsr.exe