Some checks failed
ci / test (pull_request) Has been cancelled
Path allowlist on push-to-main and pull_request: src/, crates/, tests/, Cargo.toml, Cargo.lock, and this workflow. workflow_dispatch still always runs. No branch protections, so a skipped run is not a merge trap.
75 lines
2.6 KiB
YAML
75 lines
2.6 KiB
YAML
name: ci
|
|
|
|
# Tests and clippy run on the Pi runner (aarch64) inside a rust container, so
|
|
# this CI proves the aarch64 build too. Jobs use the runner's `docker` label.
|
|
#
|
|
# Path allowlist: skip the cargo job when the change cannot affect the Rust
|
|
# build (docs, android, scripts, sibling workflows, markdown). No required
|
|
# status checks on main, so a missing run is not a merge trap.
|
|
# workflow_dispatch has no path filter — it always runs the suite.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "src/**"
|
|
- "crates/**"
|
|
- "tests/**"
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- ".forgejo/workflows/ci.yml"
|
|
pull_request:
|
|
paths:
|
|
- "src/**"
|
|
- "crates/**"
|
|
- "tests/**"
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- ".forgejo/workflows/ci.yml"
|
|
workflow_dispatch:
|
|
|
|
# One cargo job on the Pi at a time. Overlapping PR+main runs shared the
|
|
# container name `onionwire-ci` (docker Conflict) and OOM-killed with 137.
|
|
concurrency:
|
|
group: onionwire-ci-pi
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: never
|
|
RUST_IMAGE: rust:1.91-bookworm
|
|
CARGO_REGISTRY_VOLUME: onionwire-cargo-registry
|
|
CARGO_TARGET_VOLUME: onionwire-target-ci
|
|
BUILD_CONTAINER: onionwire-ci-${{ github.run_id }}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: docker
|
|
timeout-minutes: 120
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
- name: cargo test + clippy on aarch64
|
|
run: |
|
|
set -euo pipefail
|
|
cd "${GITHUB_WORKSPACE}"
|
|
echo "workspace: $GITHUB_WORKSPACE"
|
|
docker volume create "$CARGO_REGISTRY_VOLUME" > /dev/null
|
|
docker volume create "$CARGO_TARGET_VOLUME" > /dev/null
|
|
docker rm -f "$BUILD_CONTAINER" > /dev/null 2>&1 || true
|
|
docker create --name "$BUILD_CONTAINER" -i \
|
|
-e CARGO_TARGET_DIR=/target \
|
|
-e CARGO_BUILD_JOBS=2 \
|
|
-e CARGO_TERM_COLOR=never \
|
|
-v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \
|
|
-v "$CARGO_TARGET_VOLUME":/target \
|
|
-w /src \
|
|
"$RUST_IMAGE" \
|
|
sh -euxc 'mkdir -p /src && tar xzf - -C /src && cd /src \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends pkg-config libssl-dev \
|
|
&& rustup component add clippy \
|
|
&& cargo test --locked \
|
|
&& cargo clippy --locked --all-targets -- -D warnings'
|
|
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees . \
|
|
| docker start -a -i "$BUILD_CONTAINER"
|
|
docker rm -f "$BUILD_CONTAINER" > /dev/null
|