Skip to content

TUI: syntax-highlighted diff view for write/edit tool output #523

TUI: syntax-highlighted diff view for write/edit tool output

TUI: syntax-highlighted diff view for write/edit tool output #523

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
security-events: write
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-fmt:
name: Lint (fmt)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check formatting
run: cargo +nightly fmt --check
lint-clippy:
name: Lint (clippy)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-targets: "false"
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Clippy
run: cargo clippy --workspace --features full -- -D warnings
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
test:
name: Test (${{ matrix.os }})
needs: [lint-fmt, lint-clippy]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-targets: "false"
- uses: mozilla-actions/sccache-action@v0.0.9
- uses: taiki-e/install-action@nextest
- name: Run tests
run: cargo nextest run --workspace --features full --lib --bins
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
- name: Run doc tests
run: cargo test --workspace --features full --doc
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
integration:
name: Integration Tests
needs: [lint-fmt, lint-clippy]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-targets: "false"
- uses: mozilla-actions/sccache-action@v0.0.9
- uses: taiki-e/install-action@nextest
- name: Run integration tests (testcontainers)
run: cargo nextest run --workspace --features full --profile ci --test '*integration*'
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
coverage:
name: Coverage
needs: [lint-fmt, lint-clippy]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-targets: "false"
- uses: mozilla-actions/sccache-action@v0.0.9
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: Generate coverage
run: cargo llvm-cov nextest --workspace --features full --lib --bins --lcov --output-path lcov.info
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false
docker-build-and-scan:
name: Docker Build and Security Scan
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-targets: "false"
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Build binary for Docker (debug)
run: |
cargo build
mkdir -p binaries
cp target/debug/zeph binaries/zeph-amd64
cp target/debug/zeph binaries/zeph-arm64
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
- uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: zeph:local
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: zeph:local
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH
ignore-unfixed: true
exit-code: '1'
- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: trivy-results.sarif
ci-status:
name: CI Status
if: always()
needs: [lint-fmt, lint-clippy, test, integration, coverage, docker-build-and-scan]
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Check all jobs
run: |
results=(
"${{ needs.lint-fmt.result }}"
"${{ needs.lint-clippy.result }}"
"${{ needs.test.result }}"
"${{ needs.integration.result }}"
"${{ needs.coverage.result }}"
"${{ needs.docker-build-and-scan.result }}"
)
for r in "${results[@]}"; do
if [[ "$r" != "success" ]]; then
echo "::error::One or more jobs failed or were cancelled"
exit 1
fi
done
echo "All jobs passed"