Running Regression Tests and Spockbench #891
Workflow file for this run
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: Regression Tests and Spockbench | |
| run-name: Running Regression Tests and Spockbench | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| jobs: | |
| pull-and-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| pgver: [15, 16, 17, 18] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout spock | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Checkout spockbench | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: pgedge/spockbench | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| path: spockbench | |
| ref: master | |
| - name: Add permissions | |
| run: | | |
| sudo chmod -R a+w ${GITHUB_WORKSPACE} | |
| - name: Set up Docker | |
| # Codacy wants us to use full commit SHA. This is for v3 | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3 | |
| - name: Set up docker compose | |
| # Codacy wants us to use full commit SHA. This is for v1 | |
| uses: docker/setup-compose-action@364cc21a5de5b1ee4a7f5f9d3fa374ce0ccde746 # v1 | |
| with: | |
| version: latest | |
| - name: Build docker container | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/ | |
| # Build docker image once for specific version, needed for this test | |
| docker build \ | |
| --build-arg PGVER=${{ matrix.pgver }} \ | |
| -t spock -f tests/docker/Dockerfile-step-1.el9 . | |
| - name: Start docker cluster | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/tests/docker/ | |
| echo PG_VER=${{ matrix.pgver }} >> pgedge.env | |
| docker compose up --wait -d | |
| timeout-minutes: 20 | |
| - name: Run tests on all nodes | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/tests/docker/ | |
| # Launch tests in background with per-node timeout and capture PIDs | |
| docker compose exec -T pgedge-n1 bash -c "~/tests/run-tests.sh" & | |
| PID1=$! | |
| docker compose exec -T pgedge-n2 bash -c "~/tests/run-tests.sh" & | |
| PID2=$! | |
| docker compose exec -T pgedge-n3 bash -c "~/tests/run-tests.sh" & | |
| PID3=$! | |
| # Wait for all jobs and capture their exit codes | |
| wait $PID1 | |
| EXIT1=$? | |
| wait $PID2 | |
| EXIT2=$? | |
| wait $PID3 | |
| EXIT3=$? | |
| # Fail if any node failed | |
| if [ $EXIT1 -ne 0 ] || [ $EXIT2 -ne 0 ] || [ $EXIT3 -ne 0 ]; then | |
| echo "ERROR: One or more nodes failed" | |
| exit 1 | |
| fi | |
| echo "All nodes completed successfully" | |
| timeout-minutes: 10 | |
| - name: Collect node logs | |
| if: ${{ always() }} | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/tests/docker/ | |
| mkdir -p node-logs | |
| # Collect PostgreSQL logs and spockbench output from each node | |
| for node in n1 n2 n3; do | |
| echo "Collecting logs from $node..." | |
| docker compose cp pgedge-$node:/home/pgedge/pgedge/data/pg${{ matrix.pgver }}/log node-logs/$node-pg-log/ || true | |
| docker compose cp pgedge-$node:/home/pgedge/spock/spockbench-$node.out node-logs/ || true | |
| docker compose logs pgedge-$node > node-logs/$node-container.log 2>&1 || true | |
| done | |
| - name: Upload node logs | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spockbench-node-logs-${{ matrix.pgver }} | |
| path: tests/docker/node-logs/ | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| - name: Check spockbench output | |
| if: ${{ always() }} | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/tests/docker | |
| ./check-outputs.sh | |
| - name: Cleanup spockbench docker container | |
| if: ${{ always() }} | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/tests/docker/ | |
| docker compose down | |
| - name: Run regression tests | |
| if: ${{ always() }} | |
| run: | | |
| REG_CT_NAME="spock-regress-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}" | |
| echo "REG_CT_NAME=$REG_CT_NAME" >> "$GITHUB_ENV" | |
| docker run --name "$REG_CT_NAME" -e PGVER=${{ matrix.pgver }} spock /home/pgedge/run-spock-regress.sh | |
| timeout-minutes: 15 | |
| - name: Collect regression artifacts (from container) | |
| if: ${{ always() }} | |
| run: | | |
| docker cp "$REG_CT_NAME":/home/pgedge/spock/tests/regress/regression_output "${GITHUB_WORKSPACE}/tests/regress/" || true | |
| docker rm -f "$REG_CT_NAME" || true | |
| - name: Upload regression artifacts | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: regress-${{ matrix.pgver }} | |
| path: | | |
| tests/regress/regression_output/** | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| - name: Run TAP tests | |
| if: ${{ always() }} | |
| run: | | |
| TAP_CT_NAME="spock-tap-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}" | |
| echo "TAP_CT_NAME=$TAP_CT_NAME" >> "$GITHUB_ENV" | |
| docker run --name "$TAP_CT_NAME" -e PGVER=${{ matrix.pgver }} --workdir=/home/pgedge/spock/tests/tap \ | |
| spock /home/pgedge/spock/tests/tap/run_tests.sh | |
| timeout-minutes: 15 | |
| - name: Collect TAP artifacts (from container) | |
| if: ${{ always() }} | |
| run: | | |
| docker cp "$TAP_CT_NAME":/home/pgedge/spock/tests/tap/logs "${GITHUB_WORKSPACE}/tests/tap/logs" || true | |
| docker cp "$TAP_CT_NAME":/home/pgedge/spock/tests/logs "${GITHUB_WORKSPACE}/tests/logs" || true | |
| docker rm -f "$TAP_CT_NAME" || true | |
| - name: Upload TAP artifacts | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tap-${{ matrix.pgver }} | |
| path: | | |
| tests/tap/logs/** | |
| tests/logs/** | |
| if-no-files-found: ignore | |
| retention-days: 7 |