mirror of
https://github.com/chenxiaolong/avbroot.git
synced 2026-07-03 14:05:11 +02:00
91074ae4c8
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
167 lines
4.9 KiB
YAML
167 lines
4.9 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
# This allows a subsequently queued workflow run to interrupt previous runs, but
|
|
# only in pull requests.
|
|
concurrency:
|
|
group: '${{ github.workflow }} @ ${{ github.head_ref || github.sha }}'
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
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: windows-latest
|
|
name: x86_64-pc-windows-msvc
|
|
- 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
# For git describe
|
|
fetch-depth: 0
|
|
|
|
- name: Install qemu-user-static
|
|
if: ${{ contains(matrix.artifact.name, 'android') }}
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get -y update
|
|
sudo apt-get -y install qemu-user-static
|
|
|
|
- name: Set Android temporary directory
|
|
if: ${{ contains(matrix.artifact.name, 'android') }}
|
|
shell: bash
|
|
run: |
|
|
echo "TMPDIR=/tmp" >> "${GITHUB_ENV}"
|
|
|
|
- name: Install cargo-android
|
|
shell: bash
|
|
run: |
|
|
cargo install \
|
|
--git https://github.com/chenxiaolong/cargo-android \
|
|
--tag v0.1.3
|
|
|
|
- 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@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
|
|
with:
|
|
key: ${{ matrix.artifact.name }}
|
|
|
|
- name: Clippy
|
|
shell: bash
|
|
run: |
|
|
for target in ${TARGETS}; do
|
|
cargo android \
|
|
clippy --release --workspace \
|
|
--target "${target}"
|
|
done
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
for target in ${TARGETS}; do
|
|
cargo android \
|
|
build --release --workspace \
|
|
--target "${target}"
|
|
done
|
|
|
|
- name: Tests
|
|
shell: bash
|
|
run: |
|
|
for target in ${TARGETS}; do
|
|
cargo android \
|
|
test --release --workspace \
|
|
--target "${target}"
|
|
done
|
|
|
|
- name: End to end tests
|
|
shell: bash
|
|
run: |
|
|
for target in ${TARGETS}; do
|
|
cargo android \
|
|
run --release -p e2e \
|
|
--target "${target}" \
|
|
-- test -a -c e2e/e2e.toml
|
|
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/avbroot -create)
|
|
for target in ${TARGETS}; do
|
|
cmd+=("target/${target}/release/avbroot")
|
|
done
|
|
"${cmd[@]}"
|
|
;;
|
|
'')
|
|
ln -s "${TARGETS}/release" target/output
|
|
;;
|
|
*)
|
|
echo >&2 "Unsupported combine argument"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# This is done to ensure a flat directory structure. The upload-artifact
|
|
# action no longer allows multiple uploads to the same destination.
|
|
- name: Copy documentation to target directory
|
|
shell: bash
|
|
run: cp LICENSE README.md target/output/
|
|
|
|
- name: Archive executable
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: avbroot-${{ steps.get_version.outputs.version }}-${{ matrix.artifact.name }}
|
|
path: |
|
|
target/output/LICENSE
|
|
target/output/README.md
|
|
target/output/avbroot
|
|
target/output/avbroot.exe
|