forked from mirrors/kingfisher
200 lines
5.9 KiB
YAML
200 lines
5.9 KiB
YAML
name: CI Pull Request
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
VCPKG_ROOT: C:\vcpkg
|
|
VCPKG_DOWNLOADS: C:\vcpkg\downloads
|
|
VCPKG_FEATURE_FLAGS: binarycaching
|
|
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
|
|
RUST_TOOLCHAIN: "1.92"
|
|
|
|
jobs:
|
|
linux-x64:
|
|
name: Linux x64
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Free up disk space on Ubuntu runners
|
|
- name: Free Disk Space
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /usr/local/lib/android
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
|
sudo docker image prune --all --force
|
|
df -h
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: kingfisher-${{ runner.os }}-${{ runner.arch }}
|
|
cache-on-failure: true
|
|
|
|
- name: Install Linux test dependencies
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y --no-install-recommends \
|
|
cmake pkg-config libboost-all-dev patch perl ragel
|
|
|
|
- name: Run tests
|
|
run: make tests
|
|
env:
|
|
CARGO_BUILD_JOBS: 1
|
|
|
|
linux-arm64:
|
|
name: Linux arm64
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Free up disk space on Ubuntu runners
|
|
- name: Free Disk Space
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /usr/local/lib/android
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
|
sudo docker image prune --all --force
|
|
df -h
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: kingfisher-${{ runner.os }}-${{ runner.arch }}
|
|
cache-on-failure: true
|
|
|
|
- name: Install Linux test dependencies
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y --no-install-recommends \
|
|
cmake pkg-config libboost-all-dev patch perl ragel
|
|
|
|
- name: Run tests
|
|
run: make tests
|
|
env:
|
|
CARGO_BUILD_JOBS: 1
|
|
|
|
macos-arm64:
|
|
name: macOS arm64
|
|
runs-on: macos-14
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
profile: minimal
|
|
override: true
|
|
- uses: swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: kingfisher-${{ runner.os }}-${{ runner.arch }}
|
|
cache-on-failure: true
|
|
|
|
- name: Install macOS test dependencies
|
|
run: |
|
|
brew list cmake >/dev/null 2>&1 || brew install cmake
|
|
brew list boost >/dev/null 2>&1 || brew install boost
|
|
brew list pkg-config >/dev/null 2>&1 || brew install pkg-config
|
|
brew list ragel >/dev/null 2>&1 || brew install ragel
|
|
|
|
- name: Run tests
|
|
run: make tests
|
|
|
|
windows:
|
|
name: Windows ${{ matrix.arch }}
|
|
runs-on: ${{ matrix.runs_on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x64
|
|
runs_on: windows-latest
|
|
msystem: MINGW64
|
|
- arch: arm64
|
|
runs_on: windows-11-arm
|
|
msystem: CLANGARM64
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Set up MSYS2
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: ${{ matrix.msystem }}
|
|
update: true
|
|
install: >-
|
|
make
|
|
git
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: kingfisher-${{ runner.os }}-${{ runner.arch }}
|
|
cache-on-failure: true
|
|
|
|
- name: Prepare Windows dependencies
|
|
shell: msys2 {0}
|
|
run: WINDOWS_ONLY_DEPS=1 make windows-${{ matrix.arch }}
|
|
|
|
- name: Run tests
|
|
shell: msys2 {0}
|
|
run: |
|
|
set -eu -o pipefail
|
|
|
|
if [ "${{ matrix.arch }}" = "arm64" ]; then
|
|
toolchain_root=/clangarm64
|
|
target_triple=aarch64-pc-windows-gnullvm
|
|
else
|
|
toolchain_root=/mingw64
|
|
target_triple=x86_64-pc-windows-gnu
|
|
fi
|
|
|
|
export LIBHS_NO_PKG_CONFIG=1
|
|
export HYPERSCAN_ROOT="$(cygpath -m "$toolchain_root")"
|
|
export PKG_CONFIG_PATH="$toolchain_root/lib/pkgconfig"
|
|
|
|
if ! command -v cargo >/dev/null 2>&1 && [ -n "${USERPROFILE:-}" ]; then
|
|
cargo_home_candidate="$(cygpath -u "${USERPROFILE}")/.cargo/bin"
|
|
if [ -d "$cargo_home_candidate" ]; then
|
|
export PATH="$cargo_home_candidate:$PATH"
|
|
fi
|
|
fi
|
|
|
|
if [ "${{ matrix.arch }}" = "x64" ]; then
|
|
extra_native_lib_dirs="-L native=/mingw64/lib"
|
|
if command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then
|
|
libgcc_a_path="$(x86_64-w64-mingw32-gcc -print-libgcc-file-name 2>/dev/null || true)"
|
|
if [ -n "$libgcc_a_path" ] && [ -f "$libgcc_a_path" ]; then
|
|
libgcc_dir="$(dirname "$libgcc_a_path")"
|
|
extra_native_lib_dirs="$extra_native_lib_dirs -L native=$libgcc_dir"
|
|
echo "Using libgcc from $libgcc_dir"
|
|
fi
|
|
fi
|
|
export RUSTFLAGS="${RUSTFLAGS:-} $extra_native_lib_dirs -C target-feature=+crt-static -C link-arg=-static"
|
|
else
|
|
export RUSTFLAGS="${RUSTFLAGS:-} -L native=/clangarm64/lib -C target-feature=+crt-static -C link-arg=-static"
|
|
fi
|
|
|
|
echo "▶ cargo test --release --workspace --all-targets --target $target_triple"
|
|
cargo test --release --workspace --all-targets --target "$target_triple"
|