|
| 1 | +name: Integration Tests (PostgreSQL) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions |
| 8 | +permissions: |
| 9 | + # NOTE: actions/upload-artifact makes no use of permissions |
| 10 | + # See https://github.com/actions/upload-artifact/issues/197#issuecomment-832279436 |
| 11 | + contents: read # for "git clone" |
| 12 | + |
| 13 | +defaults: |
| 14 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun |
| 15 | + run: |
| 16 | + # Enable fail-fast behavior using set -eo pipefail |
| 17 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference |
| 18 | + shell: bash |
| 19 | + |
| 20 | +jobs: |
| 21 | + run-integration-tests: |
| 22 | + name: Integration Tests |
| 23 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on |
| 24 | + runs-on: ubuntu-20.04 |
| 25 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservices |
| 26 | + services: |
| 27 | + # NB: The hostname of the service container is automatically mapped to the label name |
| 28 | + db: |
| 29 | + # https://github.com/docker-library/postgres/blob/ad464b0375fc64e70e01305bf93183428a2ef0ec/11/Dockerfile |
| 30 | + # NOTE: it's better to have the same as in infra/docker/postgres.yml |
| 31 | + image: postgres:11.3 |
| 32 | + env: |
| 33 | + # NOTE: it's better to have credentials the same as in infra/docker/postgres.yml |
| 34 | + POSTGRES_USER: mystamps |
| 35 | + POSTGRES_PASSWORD: secret |
| 36 | + POSTGRES_DATABASE: mystamps |
| 37 | + # https://docs.github.com/en/actions/using-containerized-services/about-service-containers#mapping-docker-host-and-service-container-ports |
| 38 | + ports: |
| 39 | + # <host port>:<container port> |
| 40 | + - "5432:5432" |
| 41 | + steps: |
| 42 | + - name: Clone source code |
| 43 | + uses: actions/[email protected] # https://github.com/actions/checkout |
| 44 | + with: |
| 45 | + # Whether to configure the token or SSH key with the local git config. Default: true |
| 46 | + persist-credentials: false |
| 47 | + - name: Install JDK |
| 48 | + uses: actions/[email protected] # https://github.com/actions/setup-java |
| 49 | + with: |
| 50 | + distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions |
| 51 | + java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax |
| 52 | + cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies |
| 53 | + - name: Run integration tests |
| 54 | + env: |
| 55 | + SPRING_PROFILES_ACTIVE: postgres |
| 56 | + run: ./src/main/scripts/execute-command.sh integration-tests |
| 57 | + - name: Save RobotFramework reports |
| 58 | + if: ${{ failure() }} |
| 59 | + uses: actions/[email protected] # https://github.com/actions/upload-artifact |
| 60 | + with: |
| 61 | + name: robotframework-reports |
| 62 | + path: target/robotframework-reports/ |
0 commit comments