name: CI
on:
pull_request:
merge_group: {}
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-D warnings"
jobs:
stealth:
name: Stealth
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Assert launch surfaces
env:
GH_TOKEN: ${{ github.token }}
run: bash scripts/assert-launch.sh canact/canact
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 15
env:
CARGO_TARGET_DIR: target/ci-lint
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 with:
toolchain: "1.85"
components: rustfmt, clippy
- uses: taiki-e/install-action@e67fa11c4b9316fa714ddf0abed07a0c3143b95b with:
tool: cargo-deny@0.20.2
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 with:
save-if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'workflow_dispatch' }}
- run: cargo fmt --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo clippy --locked --all-targets --features runtime -- -D warnings
- run: cargo clippy --locked --all-targets --features cli -- -D warnings
- run: bash scripts/deny-check.sh
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
checks: write
env:
CARGO_TARGET_DIR: target/ci-test
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 with:
toolchain: "1.85"
- uses: taiki-e/install-action@e67fa11c4b9316fa714ddf0abed07a0c3143b95b with:
tool: cargo-nextest@0.9.140
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 with:
save-if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'workflow_dispatch' }}
- name: Unit and integration tests
run: |
set -euo pipefail
out="${CARGO_TARGET_DIR}/junit"
mkdir -p "$out"
# nextest writes junit.xml under workspace target/nextest, not CARGO_TARGET_DIR
cargo nextest run --locked --profile ci
cp target/nextest/ci/junit.xml "${out}/default.xml"
cargo nextest run --locked --features runtime --profile ci
cp target/nextest/ci/junit.xml "${out}/runtime.xml"
cargo nextest run --locked --features cli --profile ci
cp target/nextest/ci/junit.xml "${out}/cli.xml"
- run: cargo test --locked --doc
- name: Test summary
if: always()
uses: test-summary/action@37b508cfee6d4d080eedd00b5bb240a6a784a6a5 with:
paths: target/ci-test/junit/*.xml
show: all
workflow-sanity:
name: Workflow sanity
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: rhysd/actionlint@914e7df21a07ef503a81201c76d2b11c789d3fca - uses: zizmorcore/zizmor-action@70fb788f84895a7701f5643d103d587e460b5c99 with:
inputs: .github/workflows
min-severity: high
version: "1.30.0"
advanced-security: "false"
online-audits: "false"