CI #188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [ master ] | |
push: | |
branches: [ master ] | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
jobs: | |
format: | |
name: Check code formatting | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@984d158d699777abbaa79de23de3134e60c187fa # stable branch | |
- name: Run cargo fmt | |
run: | | |
cargo fmt --all -- --check | |
build: | |
name: Build and test | |
env: | |
CARGO: cargo | |
TARGET_FLAGS: --target ${{ matrix.target }} | |
RUST_BACKTRACE: 1 | |
timeout-minutes: 30 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: | |
- linux-x86_64 | |
- macos-13 | |
- macos-14 | |
- windows | |
include: | |
- build: linux-x86_64 | |
os: ubuntu-24.04 | |
run-tests: 'true' | |
target: x86_64-unknown-linux-gnu | |
- build: macos-13 | |
os: macos-13 | |
run-tests: 'true' | |
target: x86_64-apple-darwin | |
- build: macos-14 | |
os: macos-14 | |
run-tests: 'true' | |
target: aarch64-apple-darwin | |
- build: windows | |
os: windows-2022 | |
run-tests: 'true' | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@984d158d699777abbaa79de23de3134e60c187fa # stable branch | |
- name: Install Rust toolchain target | |
run: | | |
rustup target add ${{ matrix.target }} | |
- name: Cargo Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.target }}-cargo- | |
- name: Build | |
run: ${{ env.CARGO }} build --release --verbose --workspace --all-targets ${{ env.TARGET_FLAGS }} | |
- name: Run tests | |
timeout-minutes: 5 | |
run: ${{ env.CARGO }} test --release --verbose ${{ env.TARGET_FLAGS }} | |
if: runner.os != 'macOS' && matrix.run-tests == 'true' | |
- name: Run tests | |
timeout-minutes: 5 | |
run: sudo ${{ env.CARGO }} test --release --verbose ${{ env.TARGET_FLAGS }} -- --skip tests::test_map_from_invoked_binary_present | |
if: runner.os == 'macOS' && matrix.run-tests == 'true' | |
build-freebsd: | |
name: Build and test (freebsd-x86_64) | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
box: | |
- fbsd_14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Display CPU info | |
run: lscpu | |
- name: Install VM tools | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -qq -o=Dpkg::Use-Pty=0 moreutils | |
sudo chronic apt-get install -qq -o=Dpkg::Use-Pty=0 vagrant virtualbox qemu libvirt-daemon-system | |
- name: Set up VM | |
shell: sudo bash {0} | |
run: | | |
vagrant plugin install vagrant-libvirt | |
ln -sf ci/Vagrantfile Vagrantfile | |
vagrant status | |
vagrant up --no-tty --provider libvirt ${{ matrix.box }} | |
- name: Build and test | |
shell: sudo bash {0} | |
run: vagrant ssh ${{ matrix.box }} -- bash /vagrant/ci/scripts/freebsd-build.sh |