|
| 1 | +name: PostgreSQL metastore |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + workflow_dispatch: |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | +concurrency: |
| 10 | + group: postgres-metastore-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 12 | +jobs: |
| 13 | + contract-and-smoke: |
| 14 | + runs-on: ubuntu-24.04 |
| 15 | + timeout-minutes: 90 |
| 16 | + services: |
| 17 | + postgres: |
| 18 | + image: postgres:17-alpine |
| 19 | + env: |
| 20 | + POSTGRES_PASSWORD: contract |
| 21 | + POSTGRES_DB: contract |
| 22 | + ports: |
| 23 | + - 55439:5432 |
| 24 | + options: >- |
| 25 | + --health-cmd "pg_isready -U postgres" |
| 26 | + --health-interval 5s --health-timeout 5s --health-retries 12 |
| 27 | + env: |
| 28 | + P_TEST_REVIEW_S3_URL: http://127.0.0.1:59087 |
| 29 | + P_TEST_POSTGRES_URL: postgresql://postgres:contract@127.0.0.1:55439/contract?sslmode=disable |
| 30 | + CARGO_BUILD_JOBS: 2 |
| 31 | + P_BUILD_NO_UI: 1 |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - name: Prepare Linux build resources |
| 35 | + run: | |
| 36 | + sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL |
| 37 | + if sudo fallocate -l 16G /swap.build && sudo chmod 600 /swap.build \ |
| 38 | + && sudo mkswap /swap.build && sudo swapon /swap.build; then |
| 39 | + echo "Added 16G swap" |
| 40 | + else |
| 41 | + sudo rm -f /swap.build |
| 42 | + echo "::warning title=Swap::Could not add swap; continuing without it" |
| 43 | + fi |
| 44 | + free -h |
| 45 | + df -h / |
| 46 | + - uses: ./.github/actions/setup-rust-ci |
| 47 | + with: |
| 48 | + cache-key: postgres-metastore |
| 49 | + tools: nextest |
| 50 | + - name: Start isolated MinIO |
| 51 | + run: | |
| 52 | + docker run -d --name migration-minio -p 127.0.0.1:59087:9000 -e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin quay.io/parseablehq/minio:edge server /data |
| 53 | + docker exec migration-minio mkdir -p /data/review /data/migration-unit |
| 54 | + curl --fail --retry 30 --retry-all-errors --retry-delay 1 http://127.0.0.1:59087/minio/health/ready |
| 55 | + - name: Migration and regressions on PostgreSQL 17 and MinIO |
| 56 | + run: 'cargo test --locked --lib metastore:: -- --nocapture --test-threads=1' |
| 57 | + - name: Full library suite with PostgreSQL |
| 58 | + run: cargo test --locked --lib -- --test-threads=1 |
| 59 | + - name: Full library suite without PostgreSQL |
| 60 | + run: env -u P_TEST_POSTGRES_URL -u P_TEST_REVIEW_S3_URL cargo test --locked --lib -- --nocapture --test-threads=1 |
| 61 | + - name: LocalFS migration and legacy locators |
| 62 | + run: env -u P_TEST_REVIEW_S3_URL cargo test --locked --lib migration::tests::migration_round_trip_postgres -- --nocapture |
| 63 | + - name: Deadline against paused PostgreSQL |
| 64 | + env: |
| 65 | + P_TEST_POSTGRES_CONTAINER: ${{ job.services.postgres.id }} |
| 66 | + run: cargo test --locked --lib postgres_health_deadline_regression -- --nocapture --test-threads=1 |
| 67 | + - name: Shared contract and SQL fault tests (must execute) |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + set -o pipefail |
| 71 | + cargo test --locked --lib contract_tests::object_store_contract -- --nocapture 2>&1 | tee postgres-contract.log |
| 72 | + cargo test --locked --lib contract_tests::postgres_contract -- --ignored --nocapture 2>&1 | tee -a postgres-contract.log |
| 73 | + cargo test --locked --lib contract_tests::postgres_startup_cleanup -- --ignored --nocapture 2>&1 | tee -a postgres-contract.log |
| 74 | + python3 - <<'PY' |
| 75 | + from pathlib import Path |
| 76 | + text = Path('postgres-contract.log').read_text() |
| 77 | + assert 'postgres_contract ... ok' in text, text |
| 78 | + assert 'postgres_startup_cleanup ... ok' in text, text |
| 79 | + assert '0 failed; 0 ignored;' in text, text |
| 80 | + assert 'skipping PostgreSQL' not in text, text |
| 81 | + PY |
| 82 | + - name: Build smoke binary |
| 83 | + run: cargo build --locked |
| 84 | + - name: Object store, SQL plaintext and verified TLS end to end |
| 85 | + run: python3 scripts/postgres-metastore-smoke.py |
| 86 | + - name: Offline migration end to end |
| 87 | + run: python3 scripts/postgres-metastore-migration-smoke.py |
| 88 | + - name: Offline migration with verified PostgreSQL TLS |
| 89 | + env: |
| 90 | + P_MIGRATION_TLS: 1 |
| 91 | + run: python3 scripts/postgres-metastore-migration-smoke.py |
| 92 | + - name: Remove isolated MinIO |
| 93 | + if: always() |
| 94 | + run: docker rm -f migration-minio |
| 95 | + - uses: actions/upload-artifact@v4 |
| 96 | + if: always() |
| 97 | + with: |
| 98 | + name: postgres-metastore-evidence |
| 99 | + path: | |
| 100 | + postgres-contract.log |
| 101 | + .postgres-smoke/results.json |
| 102 | + .postgres-smoke/runs/*.json |
| 103 | + docs/validation/postgres-metastore-smoke.json |
| 104 | + docs/validation/postgres-migration*.json |
| 105 | + .postgres-smoke/*.log |
| 106 | + if-no-files-found: error |
0 commit comments