apalis-postgres 1.0.0-rc.7

Background task processing for rust using apalis and postgres
Documentation
name: Coverage

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  DATABASE_URL: postgres://postgres:postgres@localhost/postgres
  SQLX_OFFLINE: true

jobs:
  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:17
        env:
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: >-
          --health-cmd="pg_isready -U postgres"
          --health-interval=10s
          --health-timeout=5s
          --health-retries=5
    steps:
      - name: Checkout sources
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Install cargo-tarpaulin
        run: cargo install cargo-tarpaulin

      - name: Cache cargo registry
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}

      - name: Install cargo-binstall
        uses: cargo-bins/cargo-binstall@v1.17.7

      - name: Install sqlx-cli
        run: cargo binstall sqlx-cli --locked --force

      - name: Set up database
        run: sqlx database create

      - name: Run migrations
        run: sqlx migrate run

      - name: Generate code coverage
        run: cargo tarpaulin --all-features --verbose --workspace --timeout 120 --out xml -- --test-threads=1

      - name: Upload to codecov.io
        uses: codecov/codecov-action@v5
        with:
          file: cobertura.xml
          fail_ci_if_error: false
          token: ${{ secrets.CODECOV_TOKEN }}