-
Notifications
You must be signed in to change notification settings - Fork 33
67 lines (63 loc) · 3.03 KB
/
integration-tests-postgres.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Integration Tests (PostgreSQL)
on:
push:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
# NOTE: actions/upload-artifact makes no use of permissions
# See https://github.com/actions/upload-artifact/issues/197#issuecomment-832279436
contents: read # for "git clone"
defaults:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
run:
# Enable fail-fast behavior using set -eo pipefail
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
shell: bash
jobs:
run-integration-tests:
name: Integration Tests
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: ubuntu-20.04
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservices
services:
db:
# https://hub.docker.com/_/postgres
# https://github.com/docker-library/postgres/blob/ad464b0375fc64e70e01305bf93183428a2ef0ec/11/Dockerfile
# NOTE: it's better to have the same as in infra/docker/postgres.yml
image: postgres:11.3
env:
# NOTE: it's better to have credentials the same as in infra/docker/postgres.yml
POSTGRES_USER: mystamps
POSTGRES_PASSWORD: secret
POSTGRES_DATABASE: mystamps
# https://docs.github.com/en/actions/using-containerized-services/about-service-containers#mapping-docker-host-and-service-container-ports
ports:
# <host port>:<container port>
- '5432:5432'
steps:
- name: Clone source code
uses: actions/checkout@v4.2.2 # https://github.com/actions/checkout
with:
# Whether to configure the token or SSH key with the local git config. Default: true
persist-credentials: false
- name: Install JDK
uses: actions/setup-java@v4.4.0 # https://github.com/actions/setup-java
with:
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax
- name: Restore existing cache
uses: actions/cache@v4.1.2 # https://github.com/actions/cache
with:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#input-parameters-for-the-cache-action
key: maven-repository-${{ hashFiles('pom.xml') }}
path: ~/.m2/repository
restore-keys: maven-repository-
- name: Run integration tests
env:
SPRING_PROFILES_ACTIVE: postgres
run: ./src/main/scripts/execute-command.sh integration-tests
- name: Save RobotFramework reports
if: ${{ failure() }}
uses: actions/upload-artifact@v4.4.3 # https://github.com/actions/upload-artifact
with:
name: robotframework-reports
path: target/robotframework-reports/