name: CI on: pull_request: push: branches: [main] env: CARGO_TERM_COLOR: always SQLX_OFFLINE: "true" jobs: check: name: fmt + clippy + test runs-on: ubuntu-24.04 services: postgres: image: postgres:16-alpine env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres ports: - 5432:5432 options: >- --health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 5s --health-retries 10 env: # sqlx::test сам создаёт временные БД и накатывает ./migrations. DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres steps: - 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: Format check run: cargo fmt --all -- --check - name: Clippy run: cargo clippy --all-targets -- -D warnings - name: Tests run: cargo test --all-targets