feat: convert to workspace with pluggable storage backends (#2) #39
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: "Tests" | |
| on: | |
| push: | |
| branches: ["latest"] | |
| paths: | |
| - src/** | |
| - crates/** | |
| - Cargo.toml | |
| - Cargo.lock | |
| - .github/workflows/test.yaml | |
| pull_request: | |
| branches: ["latest"] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| name: test | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: zerolease | |
| POSTGRES_PASSWORD: zerolease | |
| POSTGRES_DB: zerolease_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: clippy | |
| cache-directories: | | |
| ~/.cargo/registry | |
| ~/.cargo/bin | |
| target | |
| - name: Lint workspace (clippy) | |
| run: | | |
| cargo clippy --workspace --all-targets | |
| cargo clippy -p zerolease --all-targets --features vsock,kms | |
| cargo clippy -p zerolease-provider --all-targets --features vault | |
| cargo clippy --manifest-path crates/zerolease-store-postgres/Cargo.toml --all-targets | |
| - name: Install cargo-nextest | |
| shell: bash | |
| run: | | |
| if [[ -z $(which cargo-nextest) ]]; then | |
| curl -sL https://get.nexte.st/latest/linux -o nextest.tgz | |
| tar xfz nextest.tgz | |
| mv cargo-nextest /home/runner/.cargo/bin | |
| fi | |
| - name: Run workspace tests | |
| run: cargo nextest run --workspace | |
| - name: Run vsock tests | |
| run: cargo nextest run -p zerolease --features vsock | |
| - name: Run PostgreSQL integration tests | |
| env: | |
| DATABASE_URL: postgres://zerolease:zerolease@localhost/zerolease_test | |
| run: cargo nextest run --manifest-path crates/zerolease-store-postgres/Cargo.toml --run-ignored ignored-only --test-threads=1 | |
| - name: Run KMS integration tests | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| ZEROLEASE_KMS_TEST_KEY_ID: alias/zerolease-test | |
| ZEROLEASE_KMS_TEST_REGION: us-west-2 | |
| run: cargo nextest run -p zerolease --features kms -E 'test(keysource::kms)' --run-ignored ignored-only --test-threads=1 | |
| - name: Run doctests | |
| run: | | |
| cargo test --workspace --doc | |
| cargo test --manifest-path crates/zerolease-store-postgres/Cargo.toml --doc | |
| coverage: | |
| name: coverage | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: zerolease | |
| POSTGRES_PASSWORD: zerolease | |
| POSTGRES_DB: zerolease_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Generate coverage (workspace tests) | |
| run: cargo llvm-cov --workspace --lcov --output-path lcov-workspace.info | |
| - name: Generate coverage (vsock tests) | |
| run: cargo llvm-cov -p zerolease --features vsock --lcov --output-path lcov-vsock.info --no-clean | |
| - name: Generate coverage (PostgreSQL tests) | |
| env: | |
| DATABASE_URL: postgres://zerolease:zerolease@localhost/zerolease_test | |
| run: cargo llvm-cov --manifest-path crates/zerolease-store-postgres/Cargo.toml --lcov --output-path lcov-postgres.info -- --ignored --test-threads=1 | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: lcov-workspace.info,lcov-vsock.info,lcov-postgres.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} |