mirror of
https://github.com/babichjacob/ac-qu-ai-nt.git
synced 2025-10-01 16:37:53 -04:00
263 lines
9.6 KiB
YAML
263 lines
9.6 KiB
YAML
name: Check, build, and test
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
# This workflow is definitely expensive for GitHub,
|
|
# so let's not let files that won't affect the project's ability to build and test trigger it
|
|
paths-ignore:
|
|
- ".github/**"
|
|
- "**/.gitignore"
|
|
- "**/CHANGELOG.md"
|
|
- "**/README.md"
|
|
- "**/LICENSE-*"
|
|
pull_request:
|
|
branches: ["main"]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
audit-and-deny-and-clippy-and-formatting:
|
|
name: Check cargo-audit, cargo-deny, clippy, and formatting
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 4
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install stable Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Install cargo-audit
|
|
uses: taiki-e/install-action@cargo-audit
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: cargo-audit
|
|
run: cargo-audit audit --deny warnings
|
|
|
|
- name: cargo-deny
|
|
uses: EmbarkStudios/cargo-deny-action@v2
|
|
|
|
- name: Clippy
|
|
run: cargo clippy
|
|
env:
|
|
RUSTFLAGS: "--deny warnings"
|
|
|
|
- name: Formatting
|
|
run: cargo fmt --check --verbose
|
|
|
|
check-and-build:
|
|
strategy:
|
|
matrix:
|
|
minimal_or_latest:
|
|
- build_command: cargo minimal-versions build --direct --verbose
|
|
cache_key: minimal
|
|
check_command: cargo minimal-versions check --direct --verbose
|
|
job_name_suffix: with minimal versions of direct dependencies
|
|
|
|
- build_command: cargo build --verbose
|
|
cache_key: latest
|
|
check_command: cargo check --verbose
|
|
job_name_suffix: (with latest (typically) versions of dependencies)
|
|
|
|
supporteds:
|
|
- runner: macos-latest
|
|
target: aarch64-apple-darwin
|
|
|
|
- runner: macos-latest
|
|
target: x86_64-apple-darwin
|
|
|
|
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && sudo ln -s /bin/g++ /bin/musl-g++
|
|
runner: ubuntu-latest
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && sudo ln -s /bin/g++ /bin/musl-g++
|
|
runner: ubuntu-latest
|
|
target: aarch64-unknown-linux-musl
|
|
|
|
- runner: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools && sudo ln -s /bin/g++ /bin/musl-g++
|
|
runner: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
# I would like to support this but I don't know how to install the dependencies to be able to
|
|
# - runner: windows-latest
|
|
# target: aarch64-pc-windows-gnullvm
|
|
|
|
- runner: windows-latest
|
|
target: aarch64-pc-windows-msvc
|
|
|
|
# I don't think supporting this is up to me
|
|
# I forgot where I learned this, but
|
|
# I don't think I can use a non-Rust dependency (i.e. llama.cpp) here
|
|
# - runner: windows-latest
|
|
# target: x86_64-pc-windows-gnu
|
|
|
|
- runner: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
name: Check and build ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }}) ${{ matrix.minimal_or_latest.job_name_suffix }}
|
|
runs-on: ${{ matrix.supporteds.runner }}
|
|
timeout-minutes: 8
|
|
env:
|
|
# https://github.com/rust-lang/stacker/issues/80#issuecomment-1547991131
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc # TODO: shouldn't this be something to do with musl, not gcc?
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install prerequisite build chain
|
|
if: matrix.supporteds.install_prerequisite
|
|
run: ${{ matrix.supporteds.install_prerequisite }}
|
|
|
|
- name: Install stable Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.supporteds.target }}
|
|
|
|
- name: Install cargo-hack
|
|
uses: taiki-e/install-action@cargo-hack
|
|
- name: Install cargo-minimal-versions
|
|
uses: taiki-e/install-action@cargo-minimal-versions
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: ${{ matrix.supporteds.target }}-${{ matrix.minimal_or_latest.cache_key }}
|
|
cache-on-failure: "true"
|
|
|
|
- name: Check
|
|
run: ${{ matrix.minimal_or_latest.check_command }} --target ${{ matrix.supporteds.target }}
|
|
|
|
- name: Build
|
|
run: ${{ matrix.minimal_or_latest.build_command }} --target ${{ matrix.supporteds.target }}
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
supporteds:
|
|
- runner: macos-latest
|
|
target: aarch64-apple-darwin
|
|
|
|
- runner: macos-latest
|
|
target: x86_64-apple-darwin
|
|
|
|
# Not able to be tested in GitHub Actions (without emulation, at least)
|
|
# - runner: ubuntu-latest
|
|
# target: aarch64-unknown-linux-gnu
|
|
|
|
# Not able to be tested in GitHub Actions (without emulation, at least)
|
|
# - runner: ubuntu-latest
|
|
# target: aarch64-unknown-linux-musl
|
|
|
|
- runner: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools && sudo ln -s /bin/g++ /bin/musl-g++
|
|
runner: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
# Not able to be tested in GitHub Actions (without emulation, at least)
|
|
# - runner: windows-latest
|
|
# target: aarch64-pc-windows-gnullvm
|
|
|
|
# Not able to be tested in GitHub Actions (without emulation, at least)
|
|
# - runner: windows-latest
|
|
# target: aarch64-pc-windows-msvc
|
|
|
|
# I don't think supporting this is up to me
|
|
# I forgot where I learned this, but
|
|
# I don't think I can use a non-Rust dependency (i.e. llama.cpp) here
|
|
# - runner: windows-latest
|
|
# target: x86_64-pc-windows-gnu
|
|
|
|
- runner: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
name: Test ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }})
|
|
runs-on: ${{ matrix.supporteds.runner }}
|
|
timeout-minutes: 8
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install prerequisite build chain
|
|
if: matrix.supporteds.install_prerequisite
|
|
run: ${{ matrix.supporteds.install_prerequisite }}
|
|
|
|
- name: Install stable Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.supporteds.target }}
|
|
|
|
- name: Install Nextest
|
|
uses: taiki-e/install-action@cargo-nextest
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: ${{ matrix.supporteds.target }}-latest
|
|
cache-on-failure: "true"
|
|
|
|
- name: Build tests
|
|
run: cargo build --tests --target ${{ matrix.supporteds.target }}
|
|
- name: Test
|
|
run: cargo nextest run --target ${{ matrix.supporteds.target }}
|
|
|
|
msrv:
|
|
strategy:
|
|
matrix:
|
|
supporteds:
|
|
- runner: macos-latest
|
|
target: aarch64-apple-darwin
|
|
|
|
- runner: macos-latest
|
|
target: x86_64-apple-darwin
|
|
|
|
- runner: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools && sudo ln -s /bin/g++ /bin/musl-g++
|
|
runner: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
- prerequisite_step: rm ~/.cargo/bin/cargo.exe; rm ~/.cargo/bin/rust-analyzer.exe; rm ~/.cargo/bin/rustfmt.exe; rustup update
|
|
runner: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
name: Verify MSRV for ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }})
|
|
runs-on: ${{ matrix.supporteds.runner }}
|
|
timeout-minutes: 8
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: ${{ matrix.supporteds.target }}-latest-variable
|
|
cache-on-failure: "true"
|
|
|
|
- name: Run prerequisite setup step
|
|
if: matrix.supporteds.prerequisite_step
|
|
run: ${{ matrix.supporteds.prerequisite_step }}
|
|
|
|
- name: Install cargo-msrv
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-msrv
|
|
|
|
- name: Verify core's declared MSRV (minimum supported Rust version)
|
|
run: cargo-msrv verify --output-format json
|
|
working-directory: ./core
|
|
- name: Verify cli-clap's declared MSRV (minimum supported Rust version)
|
|
run: cargo-msrv verify --output-format json
|
|
working-directory: ./cli-clap
|
|
- name: Verify gui-eframe's declared MSRV (minimum supported Rust version)
|
|
run: cargo-msrv verify --output-format json
|
|
working-directory: ./gui-eframe
|
|
- name: Verify tui-ratatui's declared MSRV (minimum supported Rust version)
|
|
run: cargo-msrv verify --output-format json
|
|
working-directory: ./tui-ratatui
|
|
- name: Verify multibinary's declared MSRV (minimum supported Rust version)
|
|
run: cargo-msrv verify --output-format json
|
|
working-directory: ./multibinary
|