mason-sharp is running the unit tests. #93
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: Docker tests | |
| run-name: ${{ github.actor }} is running the unit tests. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| run-scripts: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| pgver: [16, 17] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout lolor | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Add permissions | |
| run: | | |
| sudo chmod -R a+w ${GITHUB_WORKSPACE} | |
| - name: Set up Docker | |
| uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2 | |
| - name: Set up docker-compose | |
| uses: docker/setup-compose-action@2fe291b7677a45ee1269ec56a42604c143505e7e # v1 | |
| - name: Build and run docker images | |
| run: | | |
| cd docker | |
| echo PG_VER=${{ matrix.pgver }} >> pgedge.env | |
| docker build --build-arg PGVER=${{ matrix.pgver }} -t lolor -f Dockerfile.el9 . | |
| docker build -t lolor-tester -f Dockerfile.tester . | |
| docker compose up -d | |
| env: | |
| PG_VER: ${{ matrix.pgver }} | |
| - name: Wait for tests to complete | |
| id: test_step | |
| continue-on-error: true | |
| run: | | |
| while [ "$(docker inspect -f '{{.State.Running}}' tester)" == "true" ]; do | |
| echo "Waiting for tests to complete..." | |
| sleep 1 | |
| done | |
| docker logs n1 | |
| docker logs n2 | |
| docker logs n3 | |
| grep -Eq "FAIL|ERROR" tests/out.txt && exit 1 || exit 0 | |
| - name: Upload Log File as Artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: latest-log-${{ matrix.pgver }} | |
| path: tests/out.txt | |
| if: always() | |
| - name: Fail the Job if tests failed | |
| if: steps.test_step.outcome == 'failure' | |
| run: exit 1 |