-
Notifications
You must be signed in to change notification settings - Fork 411
157 lines (133 loc) · 5.31 KB
/
maven.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
on:
push:
branches: [ master ]
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
MAVEN_NASHORN: ""
MAVEN_BYTEBUDDY: ""
DOCKER_RESOURCES: ./model/src/test/resources/docker
jobs:
build-jdk11:
uses: ./.github/workflows/run-build-jdk11.yml
with:
DOCKER_RESOURCES: ./model/src/test/resources/docker
build-additional:
uses: ./.github/workflows/run-build-additional.yml
with:
DOCKER_RESOURCES: ./model/src/test/resources/docker
codeql:
uses: ./.github/workflows/run-codeql.yml
build:
name: Tests on Docker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- jdk: 3.8.6-eclipse-temurin-18
nashorn: ""
bytebuddy: ""
- jdk: 3.9.3-eclipse-temurin-20
nashorn: ""
bytebuddy: ""
- jdk: 3.9.7-eclipse-temurin-21
nashorn: ""
bytebuddy: "-Dnet.bytebuddy.experimental=true"
# Groovy not compatible jdk22: gmavenplus-plugin JsonUtilSpock.groovy Unsupported class file major version 66
# - jdk: 3.9.7-eclipse-temurin-22
# nashorn: ""
# bytebuddy: "-Dbytebuddy.experimental=true"
env:
JSQL_DOCKERFILE: ${{ matrix.jdk }}
MAVEN_NASHORN: ${{ matrix.nashorn }}
# experimental enabled on jdk21 to prevent 'Mockito cannot mock this class: class org.jsoup.nodes.Document'
MAVEN_BYTEBUDDY: ${{ matrix.bytebuddy }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Disable shallow clone to prevent Sonar warning
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 18
- name: Set Maven dependencies cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Install Maven dependencies
run: mvn clean install -DskipTests dependency:tree
- name: Run databases and LAMP
run: |
docker-compose -f $DOCKER_RESOURCES/docker-compose.yml build --parallel
docker-compose -f $DOCKER_RESOURCES/docker-compose.yml up -d
- name: List images and containers
run: docker images && docker container ls
- name: Database health checks and configuration
run: |
$DOCKER_RESOURCES/scripts/healthcheck/healthcheck.sh
$DOCKER_RESOURCES/scripts/buff.sh
$DOCKER_RESOURCES/scripts/verify.sh
- name: Build project container
run: docker build -t jsql:latest --build-arg JSQL_DOCKERFILE -f $DOCKER_RESOURCES/Dockerfile.jsql .
- name: Unit and integration tests with Sonar scan
# profile to skipITs/skipTests (env var MAVEN_OPS not working)
# mvn goal site last to apply skin to generated reports
# remove goal pmd:pmd: random StackOverflowError
run: |
$DOCKER_RESOURCES/scripts/run-on-docker.sh '
mvn clean install \
--no-transfer-progress \
-Dorg.slf4j.simpleLogger.log.org.sonarsource.scanner.maven.SonarQubeMojo=error \
-P tests \
sonar:sonar \
org.pitest:pitest-maven:mutationCoverage \
jxr:jxr \
javadoc:javadoc \
surefire-report:report \
surefire-report:failsafe-report-only \
dependency:analyze-report \
spotbugs:check \
versions:dependency-updates-report \
checkstyle:checkstyle \
site
'
- name: Databases statistics
run: $DOCKER_RESOURCES/scripts/verify.sh
- name: Copy files and coverage reports from container
# Sonar scans unmerged reports, Codacy/Codecov requires scanning each files (or reports merged)
run: |
mkdir -p shared-resources/site shared-resources/model shared-resources/view
docker cp docker_jsql-container:target/site/. shared-resources/site
docker cp docker_jsql-container:view/. shared-resources/view
docker cp docker_jsql-container:model/. shared-resources/model
docker cp docker_jsql-container:pom.xml shared-resources
- name: Codecov scan
run: cd shared-resources && bash <(curl -s https://codecov.io/bash) || true
- name: Codacy scan
run: cd shared-resources && bash <(curl -Ls https://coverage.codacy.com/get.sh) || true
- name: Publish coverage
run: |
git checkout docs
git config user.name "Github Actions"
git config user.email no-response@github.com
git pull -s ours # ignore remote changes when updated by parallel jobs
rm -r site/ || echo 'Folder(s) not found'
cp -r "shared-resources/site/." "site/"
for i in view model; do
mkdir -p "site/$i/" && cp -r "shared-resources/$i/target/site/." "site/$i/"
mkdir -p "site/$i/pit-reports/" && cp -r "shared-resources/$i/target/pit-reports/." "site/$i/pit-reports/"
done;
git add -f site/
git commit -m "Publish reports"
git push --force # failed to push some refs
release:
needs: [build-jdk11, build, build-additional, codeql]
uses: ./.github/workflows/release.yml
secrets: inherit