[pre-commit.ci] pre-commit autoupdate (#161) #468
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: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
cargo_checks: | |
name: Cargo checks | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run cargo check | |
run: cargo check --all --all-targets --workspace | |
- name: Run cargo fmt check | |
run: cargo fmt --all -- --check | |
build_server: | |
name: Build server | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
targets: | |
# Developer/GNU targets | |
- aarch64-unknown-linux-gnu | |
- x86_64-unknown-linux-gnu | |
# Musl targets | |
- aarch64-unknown-linux-musl | |
- armv7-unknown-linux-musleabi | |
- i686-unknown-linux-musl | |
# - mips-unknown-linux-musl # Broken | |
- x86_64-unknown-linux-musl | |
# Windows targets | |
- i686-pc-windows-gnu | |
- x86_64-pc-windows-gnu | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Build | |
run: cross build -p bh_agent_server --release --target ${{ matrix.targets }} | |
- name: Prepare artifact | |
run: | | |
mkdir -p dist | |
if [[ "${{ matrix.targets }}" == *"windows"* ]]; then | |
cp target/${{ matrix.targets }}/release/bh_agent_server.exe dist/bh_agent_server-${{ matrix.targets }}.exe | |
else | |
cp target/${{ matrix.targets }}/release/bh_agent_server dist/bh_agent_server-${{ matrix.targets }} | |
fi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bh_agent_server-${{ matrix.targets }} | |
path: dist/bh_agent_server-${{ matrix.targets }}* | |
build_server_macos: | |
name: Build server (macOS) | |
runs-on: macos-14 | |
strategy: | |
fail-fast: false | |
matrix: | |
targets: | |
- aarch64-apple-darwin | |
- x86_64-apple-darwin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install target | |
run: rustup target add ${{ matrix.targets }} | |
- name: Build | |
run: cargo build -p bh_agent_server --release --target ${{ matrix.targets }} | |
- name: Prepare artifact | |
run: mkdir dist && cp target/${{ matrix.targets }}/release/bh_agent_server dist/bh_agent_server-${{ matrix.targets }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bh_agent_server-${{ matrix.targets }} | |
path: dist/bh_agent_server-${{ matrix.targets }} | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: ./target/wheels/*.tar.gz | |
build_wheels: | |
name: Build ${{matrix.rust-target }} wheels for Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
rust-target: | |
- 'x86_64-pc-windows-msvc' | |
- 'i686-pc-windows-msvc' | |
- 'x86_64-apple-darwin' | |
- 'aarch64-apple-darwin' | |
- 'x86_64-unknown-linux-gnu' | |
- 'i686-unknown-linux-gnu' | |
- 'aarch64-unknown-linux-gnu' | |
- 'armv7-unknown-linux-gnueabihf' | |
- 's390x-unknown-linux-gnu' | |
- 'powerpc64le-unknown-linux-gnu' | |
include: | |
- os: ubuntu-22.04 | |
- os: windows-2022 | |
rust-target: 'x86_64-pc-windows-msvc' | |
- os: windows-2022 | |
rust-target: 'i686-pc-windows-msvc' | |
- os: macos-14 | |
rust-target: 'x86_64-apple-darwin' | |
- os: macos-14 | |
rust-target: 'aarch64-apple-darwin' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup QEMU | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: docker/setup-qemu-action@v3 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: build | |
args: --release -i python${{ matrix.python-version }} --target ${{ matrix.rust-target }} | |
manylinux: auto | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.rust-target }}-${{ matrix.python-version }} | |
path: ./target/wheels/*.whl | |
test_python: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
fail-fast: false | |
name: Tests on Python ${{ matrix.python-version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install host binaries | |
run: sudo apt-get update && sudo apt-get install -y busybox-static qemu-user-static | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Build bh_agent_server for host platform | |
run: cargo build -p bh_agent_server | |
- name: Build bh_agent_server x86_64-unknown-linux-musl | |
run: cross build --target x86_64-unknown-linux-musl -p bh_agent_server | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install binharness | |
run: pip install -e .[dev] | |
- name: Run pytest | |
run: pytest |