The job checks first that it may hold the key (a runner that reports 3.1.0 or newer, which masks a multi-line secret in the log; on a pull request, a head branch in this repository, asked in the job-level expression and again in the script from the head repository's name), installs the system packages and the toolchain, writes the key to a directory of its own for one step (no ~/.ssh configuration; the step removes the directory itself on any way out but its last line), fetches with `ssh -i` and the committed host key (`cargo fetch --locked`) and deletes it, and a step that always runs deletes it again. The checks action has no input and no secret and every cargo command in it is --offline. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
70 lines
2.8 KiB
YAML
70 lines
2.8 KiB
YAML
name: Linux checks
|
|
description: >
|
|
Linux validation for Gitea CI: formatting, Clippy, the build, the tests, the
|
|
dependency policy, the third-party notices and the release tooling tests. It
|
|
runs after the job has fetched every dependency (the steps before it in
|
|
.gitea/workflows/ci.yml: system packages, the Rust toolchain and `cargo fetch`
|
|
with the read-only deploy key for the private VoelinProtocol repository) and
|
|
has deleted the key (docs/ci.md, "VoelinProtocol access"). This action has no
|
|
input and no secret, and every cargo command in it is --offline (or has
|
|
CARGO_NET_OFFLINE set where a script or a plugin starts cargo): it needs no key
|
|
and cannot use one, so the build scripts, procedural macros and tests it runs
|
|
hold none.
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: rustfmt (own crates)
|
|
env:
|
|
CARGO_NET_OFFLINE: "true"
|
|
run: |
|
|
set -euo pipefail
|
|
packages=$(scripts/own-crates.sh)
|
|
read -r -a packages <<< "$packages"
|
|
cargo fmt "${packages[@]}" --check
|
|
shell: bash
|
|
- name: clippy (own crates, deny warnings)
|
|
env:
|
|
CARGO_NET_OFFLINE: "true"
|
|
run: |
|
|
set -euo pipefail
|
|
packages=$(scripts/own-crates.sh)
|
|
read -r -a packages <<< "$packages"
|
|
cargo clippy "${packages[@]}" --all-targets --no-deps --locked --offline -- -D warnings
|
|
shell: bash
|
|
- name: clippy (workspace, report warnings)
|
|
run: cargo clippy --workspace --all-targets --locked --offline
|
|
shell: bash
|
|
- name: Build
|
|
run: cargo build --workspace --all-targets --locked --offline
|
|
shell: bash
|
|
- name: Test (X11 enabled)
|
|
run: |
|
|
# DISPLAY is assigned by xvfb-run, then expanded by the inner shell.
|
|
# shellcheck disable=SC2016
|
|
xvfb-run -a bash -c 'VOELIN_X11_TEST_DISPLAY="$DISPLAY" cargo test --workspace --locked --offline'
|
|
shell: bash
|
|
- name: Install cargo-deny and cargo-about
|
|
# The only cargo commands here that go online: they download two tools from
|
|
# crates.io and build them. They read no manifest of this workspace and
|
|
# nothing in the job gives them a key.
|
|
run: |
|
|
cargo install cargo-deny --locked --version 0.20.2
|
|
cargo install cargo-about --locked --version 0.9.2 --features cli
|
|
shell: bash
|
|
- name: Dependency policy
|
|
# cargo-deny's own --offline would also stop it from fetching the RustSec
|
|
# advisory database, which the check needs (from github.com, no key).
|
|
# CARGO_NET_OFFLINE keeps only the `cargo metadata` it runs offline.
|
|
env:
|
|
CARGO_NET_OFFLINE: "true"
|
|
run: cargo deny --locked --workspace check
|
|
shell: bash
|
|
- name: Third-party notices
|
|
env:
|
|
CARGO_NET_OFFLINE: "true"
|
|
run: scripts/notices.sh --check
|
|
shell: bash
|
|
- name: Release tooling regressions
|
|
run: python3 scripts/test-gitea-release.py
|
|
shell: bash
|