This repository was archived by the owner on Feb 21, 2026. It is now read-only.
See description #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: [push, pull_request] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_USER: postgres | |
| POSTGRES_DB: zero2prod | |
| SQLX_VERSION: 0.8.6 | |
| SQLX_FEATURES: "postgres" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
| POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
| POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - "5432:5432" | |
| strategy: | |
| matrix: | |
| toolchain: [stable, beta, nightly] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| - uses: go-task/setup-task@v1 | |
| with: | |
| version: 3.x | |
| - run: cargo install sqlx-cli | |
| --version=${{ env.SQLX_VERSION }} | |
| --features ${{ env.SQLX_FEATURES }} | |
| --no-default-features | |
| --locked | |
| - run: task migration-run | |
| - run: cargo build | |
| - run: cargo test | |
| lint: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
| POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
| POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - "5432:5432" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: go-task/setup-task@v1 | |
| with: | |
| version: 3.x | |
| - run: cargo install sqlx-cli | |
| --version=${{ env.SQLX_VERSION }} | |
| --features ${{ env.SQLX_FEATURES }} | |
| --no-default-features | |
| --locked | |
| - run: task migration-run | |
| - run: cargo clippy -- -D warnings | |
| fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - run: cargo fmt -- --check | |
| audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: cargo install cargo-audit | |
| - run: cargo audit | |
| coverage: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
| POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
| POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - "5432:5432" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: go-task/setup-task@v1 | |
| with: | |
| version: 3.x | |
| - run: cargo install sqlx-cli | |
| --version=${{ env.SQLX_VERSION }} | |
| --features ${{ env.SQLX_FEATURES }} | |
| --no-default-features | |
| --locked | |
| - run: task migration-run | |
| - run: cargo install cargo-tarpaulin | |
| - run: cargo tarpaulin --ignore-tests |