Skip to content

Commit 4260fad

Browse files
committed
Use docker for CI
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent 57b8c71 commit 4260fad

2 files changed

Lines changed: 88 additions & 17 deletions

File tree

.github/workflows/build.yaml

Lines changed: 80 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,70 @@ jobs:
2121

2222
build:
2323
runs-on: ubuntu-latest
24+
outputs:
25+
server_image: ${{ steps.meta.outputs.server_image }}
2426

2527
steps:
2628
- uses: actions/checkout@v4
2729

28-
- name: Set up JDK
29-
uses: actions/setup-java@v4
30-
with:
31-
java-version: '17'
32-
java-package: 'jdk+fx'
33-
distribution: 'zulu'
30+
- name: Set build metadata
31+
id: meta
32+
run: |
33+
echo "server_image=oie-ci-server:${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
34+
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
35+
echo "ANT_BUILD_ARGS=" >> "$GITHUB_ENV"
36+
else
37+
echo "ANT_BUILD_ARGS=-DdisableSigning=true -Dcoverage=true" >> "$GITHUB_ENV"
38+
fi
3439
35-
- name: Build OIE (signed)
36-
if: github.ref == 'refs/heads/main'
37-
working-directory: server
38-
run: ant -f mirth-build.xml
40+
- name: Build production image
41+
run: |
42+
rm -rf /tmp/oie-buildx-cache /tmp/oie-buildx-cache-new
43+
docker buildx build \
44+
--build-arg "ANT_BUILD_ARGS=${ANT_BUILD_ARGS}" \
45+
--cache-to type=local,dest=/tmp/oie-buildx-cache-new,mode=max \
46+
--target jre-run \
47+
-t "${{ steps.meta.outputs.server_image }}" \
48+
--load \
49+
.
3950
40-
- name: Build OIE (unsigned)
41-
if: github.ref != 'refs/heads/main'
42-
working-directory: server
43-
run: ant -f mirth-build.xml -DdisableSigning=true -Dcoverage=true
51+
- name: Export build artifacts and test results
52+
run: |
53+
rm -rf docker-build-output
54+
cp -R /tmp/oie-buildx-cache-new /tmp/oie-buildx-cache
55+
docker buildx build \
56+
--build-arg "ANT_BUILD_ARGS=${ANT_BUILD_ARGS}" \
57+
--cache-from type=local,src=/tmp/oie-buildx-cache \
58+
--target build-output-export \
59+
--output type=local,dest=docker-build-output \
60+
.
4461
4562
- name: Package distribution
46-
run: tar czf openintegrationengine.tar.gz -C server/ setup --transform 's|^setup|openintegrationengine/|'
63+
run: tar czf openintegrationengine.tar.gz -C docker-build-output/app/server setup --transform 's|^setup|openintegrationengine/|'
4764

4865
- name: Create artifact
4966
uses: actions/upload-artifact@v4
5067
with:
5168
name: oie-build
5269
path: openintegrationengine.tar.gz
5370

71+
- name: Save server image
72+
run: docker save "${{ steps.meta.outputs.server_image }}" | gzip > oie-server-image.tar.gz
73+
74+
- name: Upload server image
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: oie-server-image
78+
path: oie-server-image.tar.gz
79+
5480
- name: Stage Test Results
5581
if: (!cancelled())
5682
run: |
5783
mkdir -p aggregate-test-results
58-
# Copy the directory structures
59-
cp -r --parents */build/test-results aggregate-test-results/
84+
cp -r --parents docker-build-output/app/client/build/test-results aggregate-test-results/
85+
cp -r --parents docker-build-output/app/command/build/test-results aggregate-test-results/
86+
cp -r --parents docker-build-output/app/donkey/build/test-results aggregate-test-results/
87+
cp -r --parents docker-build-output/app/server/build/test-results aggregate-test-results/
6088
6189
- name: Upload Test Results
6290
if: (!cancelled())
@@ -66,3 +94,38 @@ jobs:
6694
path: |
6795
aggregate-test-results/**/*.xml
6896
97+
docker_smoke:
98+
runs-on: ubuntu-latest
99+
needs: build
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
configuration:
104+
- alpine-temurin21-derby
105+
- alpine-temurin21-postgres
106+
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Download server image
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: oie-server-image
114+
115+
- name: Load server image
116+
run: gunzip -c oie-server-image.tar.gz | docker load
117+
118+
- name: Build runner image
119+
run: docker build -t oie-ci-runner:${{ github.sha }} ci/runner
120+
121+
- name: Boot and tear down configuration
122+
run: |
123+
docker run --rm \
124+
--add-host host.docker.internal:host-gateway \
125+
-v /var/run/docker.sock:/var/run/docker.sock \
126+
-v "$GITHUB_WORKSPACE:/workspace" \
127+
oie-ci-runner:${{ github.sha }} \
128+
--workspace /workspace \
129+
--configuration "${{ matrix.configuration }}" \
130+
--server-image "${{ needs.build.outputs.server_image }}"
131+

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ WORKDIR /app/server
3131
RUN source "$HOME/.sdkman/bin/sdkman-init.sh" \
3232
&& ANT_OPTS="-Dfile.encoding=UTF8" ant -f mirth-build.xml ${ANT_BUILD_ARGS}
3333

34+
# Stage 1c: Present artifacts for export if not running within docker
35+
FROM scratch AS build-output-export
36+
COPY --from=builder /app/server/setup /app/server/setup/
37+
COPY --from=builder /app/client/build/test-results /app/client/build/test-results/
38+
COPY --from=builder /app/command/build/test-results /app/command/build/test-results/
39+
COPY --from=builder /app/donkey/build/test-results /app/donkey/build/test-results/
40+
COPY --from=builder /app/server/build/test-results /app/server/build/test-results/
41+
3442
##########################################
3543
#
3644
# Ubuntu JDK Image

0 commit comments

Comments
 (0)