-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (111 loc) · 3.26 KB
/
main_ci.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# https://docs.github.com/en/actions
# The workflow is used for code quality and integrity checks for pull requests
# Pushes on master are currently built and deployed with Jenkins
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CI: true
POSTGRES_DB: testing
POSTGRES_USER: testing
POSTGRES_PASSWORD: testing
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5432
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: [12]
# postgres-version: [12, 13, 14, 15, 16]
max-parallel: 4
fail-fast: false
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
ports:
- 5432:5432
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Setup Test ENV
run: mv conf-github-ci.json conf-test.json
- name: Cleanup
uses: gradle/gradle-build-action@v2
with:
arguments: clean
- name: Spotless Check
uses: gradle/gradle-build-action@v2
with:
arguments: spotlessCheck scoverageClasses
- name: Test
uses: gradle/gradle-build-action@v2
with:
arguments: testClasses assemble reportScoverage
- name: Archive test report
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Report
path: build/reports/tests/test
- name: Archive test result (xml)
if: always()
uses: actions/upload-artifact@v3
with:
name: Unit Test Results
path: build/test-results/test/TEST-*.xml
- name: Archive code coverage results
if: always()
uses: actions/upload-artifact@v3
with:
name: Coverage Report
path: build/reports/scoverage
- name: Test Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Unit/Integration Tests
path: build/test-results/test/TEST-*.xml
reporter: java-junit
list-suites: "all"
list-tests: "all"
fail-on-error: "true"
max-annotations: "10"
- name: Coverage Report
uses: 5monkeys/cobertura-action@master
with:
path: build/reports/scoverage/cobertura.xml
minimum_coverage: 80
publish-test-results:
name: "Publish Unit Tests Results"
needs: build-and-test
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml