diff --git a/.gitea/workflows/bench-pages.yml b/.gitea/workflows/bench-pages.yml index 7fb608e..32aa0ec 100644 --- a/.gitea/workflows/bench-pages.yml +++ b/.gitea/workflows/bench-pages.yml @@ -19,8 +19,10 @@ jobs: - uses: actions/checkout@v4 - name: Install SSH client run: | - apt-get update -qq - apt-get install -y -qq --no-install-recommends openssh-client + if ! command -v ssh >/dev/null 2>&1; then + apt-get update -qq + apt-get install -y -qq --no-install-recommends openssh-client + fi - name: Render measured benchmark history env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} diff --git a/.gitea/workflows/fast-pr.yml b/.gitea/workflows/fast-pr.yml index ed5c9af..fcb5ccd 100644 --- a/.gitea/workflows/fast-pr.yml +++ b/.gitea/workflows/fast-pr.yml @@ -17,7 +17,34 @@ jobs: CARGO_BUILD_JOBS: 2 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Detect README-only change + id: surface + run: | + surface=full + if [ "$GITHUB_EVENT_NAME" = pull_request ] && + { [ "$GITHUB_BASE_REF" = main ] || [ "$GITHUB_BASE_REF" = next ]; } && + base="$(git merge-base HEAD "origin/$GITHUB_BASE_REF" 2>/dev/null)" && + changed="$(git diff --name-only "$base" HEAD)" && + [ "$changed" = README.md ]; then + surface=documentation + fi + echo "surface=$surface" >> "$GITHUB_OUTPUT" + - name: Check README-only change + if: steps.surface.outputs.surface == 'documentation' + run: | + base="$(git merge-base HEAD "origin/$GITHUB_BASE_REF")" + git diff --check "$base" HEAD + if git grep -nIE '^[[:space:]]*-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----[[:space:]]*$' --; then + echo "private key material found in tracked source" >&2 + exit 1 + else + status=$? + [ "$status" -eq 1 ] + fi - name: Check source + if: steps.surface.outputs.surface != 'documentation' run: | rustup component add rustfmt cargo fmt --check diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 4cb5b49..22fe149 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -22,8 +22,10 @@ jobs: fetch-depth: 0 - name: Install Pages SSH client run: | - apt-get update -qq - apt-get install -y -qq --no-install-recommends openssh-client + if ! command -v ssh >/dev/null 2>&1; then + apt-get update -qq + apt-get install -y -qq --no-install-recommends openssh-client + fi - name: Install Rust quality tools run: rustup component add rustfmt clippy - name: Formatting @@ -54,12 +56,18 @@ jobs: run: | set -o pipefail cargo test --release --locked -- --ignored --nocapture --test-threads=1 | tee bench-current.txt + - name: Restore coverage tool + uses: actions/cache@v4 + with: + path: /root/.cargo/bin/cargo-llvm-cov + key: cargo-llvm-cov-0.8.7-rust-1.97.1-${{ runner.os }} - name: Coverage tool run: | rustup component add llvm-tools-preview - if ! command -v cargo-llvm-cov >/dev/null 2>&1; then - cargo install --locked cargo-llvm-cov --version 0.8.7 + if [ "$(cargo llvm-cov --version 2>/dev/null || true)" != 'cargo-llvm-cov 0.8.7' ]; then + cargo install --locked --force cargo-llvm-cov --version 0.8.7 fi + [ "$(cargo llvm-cov --version)" = 'cargo-llvm-cov 0.8.7' ] - name: Unit test coverage run: | mkdir -p coverage