Audit and verification of AGI2 deviations #30
Workflow file for this run
This file contains hidden or 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: Rust CI | |
| on: | |
| push: | |
| branches: ["master"] | |
| tags: ["v*"] | |
| paths-ignore: | |
| - "README.md" | |
| pull_request: | |
| branches: ["master"] | |
| paths-ignore: | |
| - "README.md" | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: "0" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: rust-ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint-doc: | |
| name: Lint/Docs (${{ matrix.toolchain }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| toolchain: [stable, beta] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install native GUI deps (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libglib2.0-dev libgtk-4-dev | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| components: rustfmt, clippy | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Rustfmt (stable) | |
| if: matrix.toolchain == 'stable' | |
| run: cargo fmt --all --check | |
| - name: Clippy (stable) | |
| if: matrix.toolchain == 'stable' | |
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| - name: Check workspace | |
| run: cargo check --workspace --all-targets --all-features --locked | |
| - name: Tests (stable) | |
| if: matrix.toolchain == 'stable' | |
| env: | |
| CMR_REQUIRE_DOCKER_SMTP: "1" | |
| run: | | |
| cargo test --workspace --locked | |
| cargo test --workspace --all-features --locked | |
| - name: Run cmr-client example (stable) | |
| if: matrix.toolchain == 'stable' | |
| run: cargo run -p cmr-client --example alice_bob_charlie --locked | |
| - name: Docs (stable) | |
| if: matrix.toolchain == 'stable' | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| run: cargo doc --workspace --no-deps --locked | |
| udeps: | |
| name: Udeps (nightly) | |
| needs: lint-doc | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install native GUI deps (Linux) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libglib2.0-dev libgtk-4-dev | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rust-src, rustc-dev, llvm-tools-preview | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-udeps | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-udeps | |
| - name: Run cargo-udeps | |
| run: cargo +nightly udeps --workspace --all-targets --all-features | |
| miri: | |
| name: Miri (nightly) | |
| needs: lint-doc | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: miri | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Run Miri tests (cmr-core) | |
| env: | |
| MIRIFLAGS: "-Zmiri-disable-isolation" | |
| run: | | |
| cargo +nightly miri setup | |
| cargo +nightly miri test -p cmr-core --lib | |
| nextest-linux: | |
| name: Nextest (Linux) | |
| needs: lint-doc | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install native GUI deps (Linux) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libglib2.0-dev libgtk-4-dev | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-nextest | |
| - name: Run nextest (no retries) | |
| env: | |
| NEXTEST_RETRIES: "0" | |
| CMR_REQUIRE_DOCKER_SMTP: "1" | |
| run: cargo nextest run --workspace --all-features --locked --no-fail-fast | |
| docker-smtp-linux: | |
| name: Docker SMTP Integration (Linux) | |
| needs: lint-doc | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Run dockerized SMTP integration test | |
| env: | |
| CMR_REQUIRE_DOCKER_SMTP: "1" | |
| run: cargo test -p cmr-peer --test docker_smtp --locked | |
| platform-hosted: | |
| name: ${{ matrix.name }} | |
| needs: lint-doc | |
| runs-on: ${{ matrix.runs_on }} | |
| env: | |
| # Avoid inheriting workspace-local target-cpu overrides from .cargo/config.toml | |
| # when building fixed CI targets (notably aarch64-apple-darwin + ring). | |
| CARGO_BUILD_RUSTFLAGS: "" | |
| RUSTFLAGS: "" | |
| VCPKGRS_DYNAMIC: "1" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Linux GNU x86_64 | |
| runs_on: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| run_tests: true | |
| - name: Linux GNU ARM64 | |
| runs_on: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| run_tests: true | |
| - name: macOS x86_64 | |
| runs_on: macos-15-intel | |
| target: x86_64-apple-darwin | |
| run_tests: true | |
| - name: macOS ARM64 | |
| runs_on: macos-14 | |
| target: aarch64-apple-darwin | |
| run_tests: true | |
| - name: Windows x86_64 | |
| runs_on: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| run_tests: true | |
| - name: Windows ARM64 | |
| runs_on: windows-11-arm | |
| target: aarch64-pc-windows-msvc | |
| run_tests: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install native GUI deps (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libglib2.0-dev libgtk-4-dev | |
| - name: Install native GUI deps (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew update | |
| brew install pkg-config gtk4 | |
| - name: Install native GUI deps (Windows) | |
| if: runner.os == 'Windows' && matrix.target != 'aarch64-pc-windows-msvc' | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $triplet = if ('${{ matrix.target }}' -like 'aarch64-*') { 'arm64-windows' } else { 'x64-windows' } | |
| if (-not $env:VCPKG_INSTALLATION_ROOT) { | |
| $env:VCPKG_INSTALLATION_ROOT = "$env:USERPROFILE/vcpkg" | |
| if (-not (Test-Path $env:VCPKG_INSTALLATION_ROOT)) { | |
| git clone https://github.com/microsoft/vcpkg $env:VCPKG_INSTALLATION_ROOT | |
| & "$env:VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.bat" | |
| } | |
| } | |
| & "$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe" install "glib:$triplet" "gtk:$triplet" | |
| "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "VCPKG_DEFAULT_TRIPLET=$triplet" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache Rust artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Target build | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.target }}" = "aarch64-pc-windows-msvc" ]; then | |
| echo "skipping cmr-gui build on Windows ARM64"; | |
| cargo build --workspace --all-features --exclude cmr-gui --target ${{ matrix.target }} --locked; | |
| else | |
| cargo build --workspace --all-features --target ${{ matrix.target }} --locked; | |
| fi | |
| - name: Native tests | |
| if: matrix.run_tests | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.target }}" = "aarch64-pc-windows-msvc" ]; then | |
| echo "skipping cmr-gui tests on Windows ARM64"; | |
| cargo test --workspace --locked --exclude cmr-gui -- --skip dockerized_smtp_preserves_binary_payload_bytes; | |
| cargo test --workspace --all-features --locked --exclude cmr-gui -- --skip dockerized_smtp_preserves_binary_payload_bytes; | |
| else | |
| cargo test --workspace --locked -- --skip dockerized_smtp_preserves_binary_payload_bytes; | |
| cargo test --workspace --all-features --locked -- --skip dockerized_smtp_preserves_binary_payload_bytes; | |
| fi | |
| platform-musl: | |
| name: Linux musl (${{ matrix.target }}) | |
| needs: lint-doc | |
| runs-on: ${{ matrix.runs_on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs_on: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| - runs_on: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-musl | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache musl toolchain + target artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .ci-cache/musl/cargo | |
| .ci-cache/musl/rustup | |
| target/${{ matrix.target }} | |
| key: ${{ runner.os }}-${{ matrix.target }}-alpine-3.23.3-${{ hashFiles('Cargo.lock', '.github/workflows/rust.yml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-alpine-3.23.3- | |
| - name: Validate and test in Alpine container | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .ci-cache/musl/cargo .ci-cache/musl/rustup | |
| docker run --rm \ | |
| -v "$PWD:/work" \ | |
| -v "$PWD/.ci-cache/musl/cargo:/root/.cargo" \ | |
| -v "$PWD/.ci-cache/musl/rustup:/root/.rustup" \ | |
| -w /work \ | |
| -e CARGO_TERM_COLOR=always \ | |
| -e TARGET=${{ matrix.target }} \ | |
| alpine:3.23.3 \ | |
| sh -euxc ' | |
| apk add --no-cache bash build-base clang lld curl ca-certificates git musl-dev pkgconf | |
| apk add --no-cache glib-dev gtk4.0-dev | |
| if ! command -v rustup >/dev/null 2>&1; then | |
| curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable | |
| fi | |
| . /root/.cargo/env | |
| rustup toolchain install stable --profile minimal --no-self-update | |
| rustup default stable | |
| rustup target add "$TARGET" | |
| gcc_ver="$(g++ -dumpversion)" | |
| cxx_base="/usr/include/c++/${gcc_ver}" | |
| case "$TARGET" in | |
| x86_64-unknown-linux-musl) | |
| export CC_x86_64_unknown_linux_musl=clang | |
| export CXX_x86_64_unknown_linux_musl=clang++ | |
| export CFLAGS_x86_64_unknown_linux_musl="--gcc-toolchain=/usr" | |
| export CXXFLAGS_x86_64_unknown_linux_musl="--gcc-toolchain=/usr -isystem ${cxx_base} -isystem ${cxx_base}/x86_64-alpine-linux-musl -isystem ${cxx_base}/backward" | |
| export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=clang | |
| ;; | |
| aarch64-unknown-linux-musl) | |
| export CC_aarch64_unknown_linux_musl=clang | |
| export CXX_aarch64_unknown_linux_musl=clang++ | |
| export CFLAGS_aarch64_unknown_linux_musl="--gcc-toolchain=/usr" | |
| export CXXFLAGS_aarch64_unknown_linux_musl="--gcc-toolchain=/usr -isystem ${cxx_base} -isystem ${cxx_base}/aarch64-alpine-linux-musl -isystem ${cxx_base}/backward" | |
| export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=clang | |
| ;; | |
| esac | |
| export MUSL_RUSTFLAGS="-C link-arg=-fuse-ld=lld" | |
| RUSTFLAGS="-D warnings ${MUSL_RUSTFLAGS}" cargo check --workspace --all-targets --all-features --target "$TARGET" --locked --exclude cmr-gui | |
| RUSTFLAGS="${MUSL_RUSTFLAGS}" cargo test --workspace --target "$TARGET" --locked --exclude cmr-gui -- --skip dockerized_smtp_preserves_binary_payload_bytes | |
| RUSTFLAGS="${MUSL_RUSTFLAGS}" cargo test --workspace --all-features --target "$TARGET" --locked --exclude cmr-gui -- --skip dockerized_smtp_preserves_binary_payload_bytes | |
| ' | |
| platform-bsd: | |
| name: BSD ${{ matrix.os }} ${{ matrix.architecture }} | |
| needs: lint-doc | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: freebsd | |
| version: "15.0" | |
| architecture: x86_64 | |
| - os: freebsd | |
| version: "15.0" | |
| architecture: aarch64 | |
| - os: openbsd | |
| version: "7.8" | |
| architecture: x86_64 | |
| - os: openbsd | |
| version: "7.8" | |
| architecture: aarch64 | |
| - os: netbsd | |
| version: "10.1" | |
| architecture: x86_64 | |
| - os: netbsd | |
| version: "10.1" | |
| architecture: aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: BSD validation + test | |
| uses: cross-platform-actions/action@v0.32.0 | |
| with: | |
| operating_system: ${{ matrix.os }} | |
| version: ${{ matrix.version }} | |
| architecture: ${{ matrix.architecture }} | |
| memory: 6G | |
| shell: sh | |
| environment_variables: CARGO_TERM_COLOR,RUSTFLAGS | |
| run: | | |
| set -eu | |
| as_root() { | |
| if command -v sudo >/dev/null 2>&1; then | |
| sudo "$@" | |
| elif command -v doas >/dev/null 2>&1; then | |
| doas "$@" | |
| else | |
| "$@" | |
| fi | |
| } | |
| ensure_rust() { | |
| if command -v cargo >/dev/null 2>&1; then | |
| return 0 | |
| fi | |
| if command -v pkg >/dev/null 2>&1; then | |
| as_root pkg update -f || true | |
| as_root pkg install -y rust || true | |
| elif command -v pkgin >/dev/null 2>&1; then | |
| as_root pkgin -y update || true | |
| as_root pkgin -y install rust || true | |
| elif command -v pkg_add >/dev/null 2>&1; then | |
| as_root pkg_add rust || true | |
| fi | |
| if ! command -v cargo >/dev/null 2>&1; then | |
| if command -v curl >/dev/null 2>&1; then | |
| curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal | |
| elif command -v ftp >/dev/null 2>&1; then | |
| ftp -o /tmp/rustup-init.sh https://sh.rustup.rs | |
| sh /tmp/rustup-init.sh -y --profile minimal | |
| else | |
| echo "Unable to install Rust toolchain in BSD runner" >&2 | |
| exit 1 | |
| fi | |
| fi | |
| } | |
| ensure_rust | |
| ensure_gui_deps() { | |
| if command -v pkg >/dev/null 2>&1; then | |
| as_root pkg update -f || true | |
| as_root pkg install -y pkgconf gtk4 glib || as_root pkg install -y pkgconf gtk4 | |
| elif command -v pkgin >/dev/null 2>&1; then | |
| as_root pkgin -y update || true | |
| as_root pkgin -y install pkgconf gtk4 glib2 || as_root pkgin -y install pkgconf gtk4 | |
| elif command -v pkg_add >/dev/null 2>&1; then | |
| as_root pkg_add -I pkgconf gtk+4 glib2 || as_root pkg_add -I pkgconf gtk+4 | |
| else | |
| echo "No supported package manager found to install GUI dependencies" >&2 | |
| exit 1 | |
| fi | |
| } | |
| ensure_gui_deps | |
| export PATH="/usr/local/bin:/usr/pkg/bin:$HOME/.cargo/bin:$PATH" | |
| cargo --version | |
| rustc --version | |
| if [ "${{ matrix.os }}" = "openbsd" ] || [ "${{ matrix.os }}" = "netbsd" ]; then | |
| export CXXFLAGS="-DNOJIT" | |
| fi | |
| if [ "${{ matrix.os }}" = "openbsd" ]; then | |
| EXCLUDE_OPTS="--exclude cmr-gui" | |
| else | |
| EXCLUDE_OPTS="" | |
| fi | |
| RUSTFLAGS="-C target-cpu=generic -D warnings" cargo check --workspace --all-targets --all-features --locked $EXCLUDE_OPTS | |
| RUSTFLAGS="-C target-cpu=generic" cargo test --workspace --locked $EXCLUDE_OPTS | |
| RUSTFLAGS="-C target-cpu=generic" cargo test --workspace --all-features --locked $EXCLUDE_OPTS |