-
Notifications
You must be signed in to change notification settings - Fork 157
192 lines (187 loc) · 7.8 KB
/
build.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Build and Test
on:
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'demo/**'
- '.github/workflows/site.yml'
jobs:
build-tools:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'ci-skip')"
strategy:
matrix:
java: [ '11' ]
fail-fast: false
steps:
- uses: actions/[email protected]
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build tools
run: mvn -B install --file fhir-tools -Dmaven.wagon.http.retryHandler.count=3
- name: Build samples with condensed json
run: mvn -B install --file fhir-examples -P condense-json -Dmaven.wagon.http.retryHandler.count=3
- name: Build parent with condensed json
run: mvn -B install --file fhir-parent -P integration,condense-json -Dmaven.wagon.http.retryHandler.count=3
- name: Build sample generator
run: mvn -B package --file fhir-examples-generator -Dmaven.wagon.http.retryHandler.count=3
- name: Build benchmark
run: mvn -B package --file fhir-benchmark -Dmaven.wagon.http.retryHandler.count=3
build:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'ci-skip')"
strategy:
matrix:
java: [ '11' ]
fail-fast: false
steps:
- uses: actions/[email protected]
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Fetch target branch
env:
BASE: ${{ github['base_ref'] }}
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/${BASE}:refs/remotes/origin/${BASE}
- name: Build tools and samples
run: |
mvn -B install --file fhir-tools --no-transfer-progress -Dmaven.wagon.http.retryHandler.count=3
mvn -B install --file fhir-examples --no-transfer-progress -Dmaven.wagon.http.retryHandler.count=3
- name: Build parent with tests
env:
BASE: origin/${{ github['base_ref'] }}
run: |
mvn -version
model_paths=(
fhir-model
fhir-examples
)
validation_paths=(
fhir-validation
fhir-profile/src/main
fhir-term/src/main
fhir-path/src/main
fhir-model/src/main
fhir-examples
)
search_paths=(
fhir-search
fhir-examples
)
jdbc_paths=(
fhir-persistence-jdbc
fhir-persistence-params
fhir-search/src/main
fhir-persistence/src/main
fhir-persistence-schema/src/main
fhir-examples
)
PROFILES_ARR=(integration condense-json)
if [ -n "$(git --no-pager diff --name-only ${BASE} ${GITHUB_SHA} -- ${model_paths[@]})" ]; then
echo "Changes affect fhir-model, running ALL"
PROFILES_ARR+=(model-all-tests)
else
echo "No changes affect fhir-model, running MINIMAL"
fi
if [ -n "$(git --no-pager diff --name-only ${BASE} ${GITHUB_SHA} -- ${validation_paths[@]})" ]; then
echo "Changes affect fhir-validation, running ALL"
PROFILES_ARR+=(validation-all-tests)
else
echo "No changes affect fhir-validation, running MINIMAL"
fi
if [ -n "$(git --no-pager diff --name-only ${BASE} ${GITHUB_SHA} -- ${search_paths[@]})" ]; then
echo "Changes affect fhir-search, running ALL"
PROFILES_ARR+=(search-all-tests)
else
echo "No changes affect fhir-search, running MINIMAL"
fi
if [ -n "$(git --no-pager diff --name-only ${BASE} ${GITHUB_SHA} -- ${jdbc_paths[@]})" ]; then
echo "Changes affect fhir-persistence-jdbc, running ALL"
PROFILES_ARR+=(jdbc-all-tests)
else
echo "No changes affect fhir-persistence-jdbc, running MINIMAL"
fi
# Convert the PROFILES_ARR array to a comma-delimited string
PROFILES=$(IFS=, ; echo "${PROFILES_ARR[*]}")
echo "Using profiles ${PROFILES}"
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline -f fhir-parent --no-transfer-progress -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:resolve-plugins -f fhir-parent --no-transfer-progress -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
mvn -B package --file fhir-parent -P "${PROFILES}" --no-transfer-progress -Dmaven.wagon.httpconnectionManager.ttlSeconds=240 -Dmaven.wagon.http.retryHandler.count=3
e2e-tests:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'ci-skip')"
strategy:
matrix:
java: [ '11' ]
fail-fast: false
steps:
- uses: actions/[email protected]
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build tools and samples
run: |
mvn -B install --file fhir-tools --no-transfer-progress -Dmaven.wagon.http.retryHandler.count=3
mvn -B install --file fhir-examples --no-transfer-progress -Dmaven.wagon.http.retryHandler.count=3
- name: Build parent without tests
# As the e2e tests are the fastest, opting to put javadoc:javadoc in fhir-parent
# The profile avoids UML diagram creation
run: |
JAVADOC_GOAL=""
if [ "${{ matrix.java }}" = "11" ]
then
JAVADOC_GOAL=" -Pvalidate-javadoc javadoc:javadoc "
fi
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline -f fhir-parent --no-transfer-progress -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:resolve-plugins -f fhir-parent --no-transfer-progress -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
mvn -B ${JAVADOC_GOAL} install --file fhir-parent -DskipTests -P include-fhir-igs,integration,condense-json --no-transfer-progress -Dmaven.wagon.httpconnectionManager.ttlSeconds=240 -Dmaven.wagon.http.retryHandler.count=3
- name: free disk space
run: |
# create and remove a 200 MB file to make sure we have the room needed later
dd if=/dev/urandom oflag=direct of=balloon.dat bs=1024k count=200
rm -f balloon.dat
sudo apt clean
docker system prune -f
df -h
- name: Server Integration Tests
env:
# debian-based linux uses C.UTF-8 by default and Derby doesn't like that
LC_ALL: en_US.UTF-8
run: |
export WORKSPACE=${GITHUB_WORKSPACE}
build/pre-integration-test.sh
env
mvn -B test -DskipTests=false -f fhir-server-test --no-transfer-progress -Dmaven.wagon.httpconnectionManager.ttlSeconds=240 -Dmaven.wagon.http.retryHandler.count=3
build/post-integration-test.sh
- name: Gather error logs
if: failure()
run: |
it_results=SIT/integration-test-results
rm -fr ${it_results} 2>/dev/null
mkdir -p ${it_results}/server-logs
mkdir -p ${it_results}/fhir-server-test
cp pre-it-logs.zip ${it_results}/
echo "Gathering post-test server logs..."
cp -r SIT/wlp/usr/servers/defaultServer/logs ${it_results}/server-logs
echo "Gathering integration test output"
cp -r ${GITHUB_WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test || true
- name: Upload logs
if: always()
uses: actions/[email protected]
with:
name: integration-test-results-${{ matrix.java }}
path: SIT/integration-test-results
concurrency:
group: build-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true