# visa CI on git.b4l.co.th (Gitea Actions). # # leaks: gitleaks over the whole history on every push and pull request # (.gitea/scripts/gitleaks.sh, rules in .gitleaks.toml). The pull # request trigger covers AGit pull requests, whose commits arrive # without a branch push. The pre-commit hook in .githooks/ scans the # staged changes before they leave a computer. # check: cargo fmt, clippy and the tests against a throwaway PostgreSQL 18, # the version on cnx01 (each #[sqlx::test] creates its own database). name: CI on: push: pull_request: workflow_dispatch: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: "0" RUST_TOOLCHAIN: "1.98.1" jobs: leaks: name: secret scan runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: gitleaks run: bash .gitea/scripts/gitleaks.sh check: name: fmt, clippy, tests runs-on: ubuntu-latest timeout-minutes: 60 services: postgres: image: postgres:18 env: POSTGRES_USER: visa POSTGRES_PASSWORD: visa-ci POSTGRES_DB: visa options: >- --health-cmd "pg_isready -U visa" --health-interval 5s --health-timeout 5s --health-retries 20 env: DATABASE_URL: postgres://visa:visa-ci@postgres:5432/visa # the tests wait on the database more than on the CPU RUST_TEST_THREADS: "16" steps: - uses: actions/checkout@v4 - name: Rust toolchain run: bash .gitea/scripts/rust-toolchain.sh "$RUST_TOOLCHAIN" - uses: actions/cache@v4 with: path: | ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db target key: check-${{ runner.os }}-${{ env.RUST_TOOLCHAIN }}-${{ hashFiles('Cargo.lock') }} restore-keys: check-${{ runner.os }}-${{ env.RUST_TOOLCHAIN }}- - name: Format run: cargo fmt --all --check - name: Clippy run: cargo clippy --all-targets --locked -- -D warnings - name: Tests run: cargo test --locked