-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (54 loc) · 1.63 KB
/
common.integration-test.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
on:
workflow_call:
inputs:
working-directory:
type: string
required: true
healthcheck:
type: string
required: true
secrets:
NAV_TOKEN:
required: true
jobs:
integration-test:
name: Integration Test
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Git"
run: git fetch --unshallow
- name: "Java"
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: "Gradle"
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
- name: "Build"
env:
NAV_TOKEN: ${{ secrets.NAV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
run: ./gradlew assemble --scan
- name: "Start docker containers"
run: |
JWK=$(cat ./mocks/jwk.json) docker compose up --build --detach
- name: "Health check"
timeout-minutes: 5
run: |
echo Wait on service...
bash -c 'while [[ "$(curl --connect-timeout 2 -s -o /dev/null -w ''%{http_code}'' ${{ inputs.healthcheck }})" != "200" ]]; do echo ...; sleep 5; done; echo Service is up;'
- name: "Run integration tests"
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
- name: "Build"
working-directory: ${{ inputs.working-directory }}
run: ./gradlew iTest --scan
- name: "Stop docker containers"
run: |
docker compose down --remove-orphans --volumes