Add GitHub CI security and release workflows

This commit is contained in:
Eric Wendland 2026-05-28 16:44:58 +02:00
commit 1006f41e45
10 changed files with 396 additions and 0 deletions

17
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
day: monday
time: "05:00"
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: "05:30"
open-pull-requests-limit: 5

90
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,90 @@
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
fmt-clippy-docs:
name: fmt, clippy, docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Build docs
run: cargo doc --workspace --no-deps
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
GETH_TEST_SKIP_IROH: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Check workspace
run: cargo check --workspace --all-targets
- name: Test workspace without live Iroh integration
run: cargo test --workspace
iroh-integration:
name: iroh integration smoke tests
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Run Iroh-heavy CLI integration tests serially
run: cargo test -p geth --test bootstrap -- --test-threads=1
- name: Run Iroh-heavy node integration tests
run: |
cargo test -p geth-node peer_ping_uses_signed_peer_card_over_iroh -- --nocapture
cargo test -p geth-node overlay_packets_route_over_dedicated_iroh_alpn_with_authorization -- --nocapture

44
.github/workflows/codeql.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: CodeQL
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "43 3 * * 2"
workflow_dispatch:
concurrency:
group: codeql-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: read
contents: read
security-events: write
env:
CARGO_TERM_COLOR: always
jobs:
analyze:
name: Analyze Rust
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: rust
build-mode: manual
- name: Build workspace for CodeQL
run: cargo build --workspace --all-targets
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3

21
.github/workflows/dependency-review.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Dependency Review
on:
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Review dependency changes
uses: actions/dependency-review-action@v4
with:
fail-on-severity: moderate

99
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,99 @@
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
prerelease:
description: "Mark the GitHub release as a prerelease"
required: false
default: "true"
type: choice
options: ["true", "false"]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux-x86_64
binary: geth
- os: macos-latest
target: macos
binary: geth
- os: windows-latest
target: windows-x86_64
binary: geth.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release -p geth
- name: Package Unix artifact
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME:-manual}"
pkg="geth-${version}-${{ matrix.target }}"
mkdir -p "${pkg}" dist
cp "target/release/${{ matrix.binary }}" "${pkg}/"
cp README.md "${pkg}/"
tar -czf "dist/${pkg}.tar.gz" "${pkg}"
- name: Package Windows artifact
if: runner.os == 'Windows'
shell: pwsh
run: |
$version = if ($env:GITHUB_REF_NAME) { $env:GITHUB_REF_NAME } else { "manual" }
$pkg = "geth-$version-${{ matrix.target }}"
New-Item -ItemType Directory -Force -Path $pkg, dist | Out-Null
Copy-Item "target/release/${{ matrix.binary }}" "$pkg/"
Copy-Item README.md "$pkg/"
Compress-Archive -Path "$pkg/*" -DestinationPath "dist/$pkg.zip" -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: geth-${{ matrix.target }}
path: dist/*
if-no-files-found: error
github-release:
name: publish GitHub release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: dist/*
prerelease: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'true' }}
generate_release_notes: true

39
.github/workflows/security.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Security
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "17 4 * * 1"
workflow_dispatch:
concurrency:
group: security-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
cargo-audit:
name: RustSec cargo-audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Scan Cargo.lock for advisories
run: cargo audit --deny warnings