name: Testing # adr: docs/adrs/20260612000000_adopt_sccache_for_ci_bare_builds.md # This workflow includes sccache for bare CI builds outside Docker containers, replacing Swatinem/rust-cache. # See ADR for evidence and rationale. # Path policy: skip this workflow when every changed file is documentation. # See .github/workflows/docs-lint.yaml for the lightweight docs-only workflow. on: push: paths-ignore: - "**/*.md" - "project-words.txt" pull_request: paths-ignore: - "**/*.md" - "project-words.txt" env: CARGO_TERM_COLOR: always jobs: unit: name: Unit (${{ matrix.toolchain }}) runs-on: ubuntu-latest timeout-minutes: ${{ matrix.timeout_minutes }} strategy: matrix: include: - toolchain: nightly components: rustfmt, clippy, llvm-tools-preview timeout_minutes: 45 run_format: true - toolchain: stable components: clippy, llvm-tools-preview timeout_minutes: 90 run_format: false steps: - id: checkout name: Checkout Repository uses: actions/checkout@v6 - id: setup name: Setup Toolchain uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.toolchain }} components: ${{ matrix.components }} - id: node name: Setup Node.js uses: actions/setup-node@v6 with: node-version: "20" - id: sccache name: Install sccache (GHA backend) uses: mozilla-actions/sccache-action@v0.0.10 - id: enable-sccache name: Enable sccache run: | echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" - id: fetch name: Download Dependencies run: cargo fetch --verbose - id: linter name: Install Internal Linter run: cargo install --locked --git https://github.com/torrust/torrust-linting --bin linter - id: tools name: Install Tools uses: taiki-e/install-action@v2 with: tool: cargo-llvm-cov, cargo-nextest - id: format name: Run Formatting-Checks if: ${{ matrix.run_format }} run: cargo fmt --check - id: lint name: Run All Linters run: linter all - id: test-docs name: Run Documentation Tests run: cargo test --doc --workspace - id: test name: Run Unit Tests run: cargo test --tests --benches --examples --workspace --all-targets --all-features docker-e2e: # Skip this job when container.yaml is also running for the same event — it builds # the same image and runs the same E2E tests. container.yaml triggers on pushes to # develop/main/releases and on PRs targeting develop/main. # For feature branch pushes and PRs targeting other branches, container.yaml does not # run, so this job provides the only E2E coverage. See issue #1854. name: Docker E2E runs-on: ubuntu-latest timeout-minutes: 90 if: >- !(github.event_name == 'pull_request' && (github.base_ref == 'develop' || github.base_ref == 'main')) && !(github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases/'))) steps: - id: checkout name: Checkout Repository uses: actions/checkout@v6 - id: setup name: Setup Toolchain uses: dtolnay/rust-toolchain@stable with: toolchain: stable - id: sccache name: Install sccache (GHA backend) uses: mozilla-actions/sccache-action@v0.0.10 - id: enable-sccache name: Enable sccache run: | echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" - id: fetch name: Download Dependencies run: cargo fetch --verbose - id: setup-buildx name: Setup Buildx uses: docker/setup-buildx-action@v4 - id: build-tracker-image name: Build Tracker Image uses: docker/build-push-action@v7 with: file: ./Containerfile push: false load: true target: release tags: torrust-tracker:e2e-local cache-from: type=gha,scope=testing-docker-e2e cache-to: type=gha,scope=testing-docker-e2e,mode=max - id: run-tracker-e2e-tests name: Run E2E Tests run: cargo run --bin e2e_tests_runner -- --config-toml-path "./share/default/config/tracker.e2e.container.sqlite3.toml" --tracker-image "torrust-tracker:e2e-local" --skip-build - id: run-qbittorrent-e2e-test-sqlite3 name: Run qBittorrent E2E Test (SQLite) run: cargo run --bin qbittorrent_e2e_runner -- --tracker-image "torrust-tracker:e2e-local" --skip-build --db-driver sqlite3 --timeout-seconds 600 - id: run-qbittorrent-e2e-test-mysql name: Run qBittorrent E2E Test (MySQL) run: cargo run --bin qbittorrent_e2e_runner -- --tracker-image "torrust-tracker:e2e-local" --skip-build --db-driver mysql --timeout-seconds 600 - id: run-qbittorrent-e2e-test-postgresql name: Run qBittorrent E2E Test (PostgreSQL) run: cargo run --bin qbittorrent_e2e_runner -- --tracker-image "torrust-tracker:e2e-local" --skip-build --db-driver postgresql --timeout-seconds 600