diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bd8f714b4e0..b7d47237ee5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -173,7 +173,49 @@ jobs: uses: ./.github/actions/nix_upload_store if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }} + test_postgres: + name: Rust - test_postgres${{ matrix.test_projects != 'stable' && format('_{0}', matrix.test_projects) || '' }} + runs-on: ubuntu-22.04 + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: test + ports: + - 5433:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + defaults: + run: + shell: nix develop ./tools/nix#rust${{ matrix.test_projects == 'nightly' && '_nightly' || '' }} --keep CI --ignore-environment --command bash {0} + strategy: + fail-fast: false + matrix: + test_projects: + - stable + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + ref: ${{ github.event.inputs.commit_sha }} + + - name: Install Nix + uses: ./.github/actions/cache_nix + with: + cache-unique-id: ${{ matrix.test_projects }} + id: nix-installer + + - uses: ./.github/actions/cache_rust + with: + job_name: "${{ github.job }}-${{ matrix.test_projects }}" + + - name: Run postgres test on ${{ matrix.test_projects }} + run: make -f implementations/rust/Makefile test_postgres + + - name: Nix Upload Store + uses: ./.github/actions/nix_upload_store + if: ${{ steps.nix-installer.outputs.cache-hit != 'true' }} check: name: Rust - check_${{ matrix.check_projects }} diff --git a/implementations/rust/Makefile b/implementations/rust/Makefile index d487fb52ba2..d7ebf49dbc3 100644 --- a/implementations/rust/Makefile +++ b/implementations/rust/Makefile @@ -48,6 +48,13 @@ nextest: nextest_%: cargo --locked nextest --config-file $(ROOT_DIR)/tools/nextest/.config/nextest.toml run -E 'package($*)' --no-fail-fast cargo --locked test --doc +test_postgres: + export OCKAM_POSTGRES_HOST=localhost + export OCKAM_POSTGRES_PORT=5433 + export OCKAM_POSTGRES_DATABASE_NAME=test + export OCKAM_POSTGRES_USER=postgres + export OCKAM_POSTGRES_PASSWORD=password + cargo --locked nextest --config-file $(ROOT_DIR)/tools/nextest/.config/nextest.toml run -E 'test(sql) or test(cli_state)' --no-fail-fast --test-threads 1 lint: lint_cargo_fmt_check lint_cargo_deny lint_cargo_clippy lint_cargo_fmt_check: