Skip to content

Commit 741827b

Browse files
committed
Cover DBs and Ubuntu in CI
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent fe8249e commit 741827b

9 files changed

Lines changed: 198 additions & 21 deletions

.github/workflows/build.yaml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,43 @@ jobs:
2222
build:
2323
runs-on: ubuntu-latest
2424
outputs:
25-
server_image: ${{ steps.meta.outputs.server_image }}
25+
alpine_server_image: ${{ steps.meta.outputs.alpine_server_image }}
26+
ubuntu_server_image: ${{ steps.meta.outputs.ubuntu_server_image }}
2627

2728
steps:
2829
- uses: actions/checkout@v4
2930

3031
- name: Set build metadata
3132
id: meta
3233
run: |
33-
echo "server_image=oie-ci-server:${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
34+
echo "alpine_server_image=oie-ci-server:alpine-temurin21-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
35+
echo "ubuntu_server_image=oie-ci-server:ubuntu-temurin21-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
3436
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
3537
echo "ANT_BUILD_ARGS=" >> "$GITHUB_ENV"
3638
else
3739
echo "ANT_BUILD_ARGS=-DdisableSigning=true -Dcoverage=true" >> "$GITHUB_ENV"
3840
fi
3941
40-
- name: Build production image
42+
- name: Build Alpine production image
4143
run: |
4244
rm -rf /tmp/oie-buildx-cache /tmp/oie-buildx-cache-new
4345
docker buildx build \
4446
--build-arg "ANT_BUILD_ARGS=${ANT_BUILD_ARGS}" \
4547
--cache-to type=local,dest=/tmp/oie-buildx-cache-new,mode=max \
4648
--target jre-run \
47-
-t "${{ steps.meta.outputs.server_image }}" \
49+
-t "${{ steps.meta.outputs.alpine_server_image }}" \
50+
--load \
51+
.
52+
53+
- name: Build Ubuntu production image
54+
run: |
55+
cp -R /tmp/oie-buildx-cache-new /tmp/oie-buildx-cache
56+
docker buildx build \
57+
--build-arg "ANT_BUILD_ARGS=${ANT_BUILD_ARGS}" \
58+
--cache-from type=local,src=/tmp/oie-buildx-cache \
59+
--cache-to type=local,dest=/tmp/oie-buildx-cache-new,mode=max \
60+
--target jdk-run \
61+
-t "${{ steps.meta.outputs.ubuntu_server_image }}" \
4862
--load \
4963
.
5064
@@ -68,14 +82,23 @@ jobs:
6882
name: oie-build
6983
path: openintegrationengine.tar.gz
7084

71-
- name: Save server image
72-
run: docker save "${{ steps.meta.outputs.server_image }}" | gzip > oie-server-image.tar.gz
85+
- name: Save Alpine server image
86+
run: docker save "${{ steps.meta.outputs.alpine_server_image }}" | gzip > oie-server-image-alpine-temurin21.tar.gz
7387

74-
- name: Upload server image
88+
- name: Upload Alpine server image
7589
uses: actions/upload-artifact@v4
7690
with:
77-
name: oie-server-image
78-
path: oie-server-image.tar.gz
91+
name: oie-server-image-alpine-temurin21
92+
path: oie-server-image-alpine-temurin21.tar.gz
93+
94+
- name: Save Ubuntu server image
95+
run: docker save "${{ steps.meta.outputs.ubuntu_server_image }}" | gzip > oie-server-image-ubuntu-temurin21.tar.gz
96+
97+
- name: Upload Ubuntu server image
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: oie-server-image-ubuntu-temurin21
101+
path: oie-server-image-ubuntu-temurin21.tar.gz
79102

80103
- name: Stage Test Results
81104
if: (!cancelled())
@@ -102,18 +125,24 @@ jobs:
102125
matrix:
103126
configuration:
104127
- alpine-temurin21-derby
128+
- alpine-temurin21-mysql
105129
- alpine-temurin21-postgres
130+
- alpine-temurin21-sqlserver
131+
- ubuntu-temurin21-derby
132+
- ubuntu-temurin21-postgres
106133

107134
steps:
108135
- uses: actions/checkout@v4
109136

110137
- name: Download server image
111138
uses: actions/download-artifact@v4
112139
with:
113-
name: oie-server-image
140+
name: ${{ startsWith(matrix.configuration, 'ubuntu-') && 'oie-server-image-ubuntu-temurin21' || 'oie-server-image-alpine-temurin21' }}
114141

115142
- name: Load server image
116-
run: gunzip -c oie-server-image.tar.gz | docker load
143+
run: |
144+
IMAGE_ARCHIVE="${{ startsWith(matrix.configuration, 'ubuntu-') && 'oie-server-image-ubuntu-temurin21.tar.gz' || 'oie-server-image-alpine-temurin21.tar.gz' }}"
145+
gunzip -c "$IMAGE_ARCHIVE" | docker load
117146
118147
- name: Build runner image
119148
run: docker build -t oie-ci-runner:${{ github.sha }} ci/runner
@@ -127,7 +156,7 @@ jobs:
127156
oie-ci-runner:${{ github.sha }} \
128157
--workspace /workspace \
129158
--configuration "${{ matrix.configuration }}" \
130-
--server-image "${{ needs.build.outputs.server_image }}" \
159+
--server-image "${{ startsWith(matrix.configuration, 'ubuntu-') && needs.build.outputs.ubuntu_server_image || needs.build.outputs.alpine_server_image }}" \
131160
--results-root ci/test-results
132161
133162
- name: Upload Docker Smoke Test Results
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
services:
2+
db:
3+
image: mariadb:11.8
4+
environment:
5+
MARIADB_ROOT_PASSWORD: root_password
6+
MARIADB_DATABASE: mirthdb
7+
MARIADB_USER: mirthdb
8+
MARIADB_PASSWORD: mirthdb
9+
healthcheck:
10+
test:
11+
- CMD-SHELL
12+
- mariadb-admin ping -h 127.0.0.1 -umirthdb -pmirthdb
13+
interval: 10s
14+
timeout: 5s
15+
retries: 20
16+
start_period: 20s
17+
18+
oie:
19+
image: ${OIE_IMAGE}
20+
depends_on:
21+
db:
22+
condition: service_healthy
23+
environment:
24+
DATABASE: mysql
25+
DATABASE_URL: jdbc:mysql://db:3306/mirthdb
26+
DATABASE_USERNAME: mirthdb
27+
DATABASE_PASSWORD: mirthdb
28+
DATABASE_MAX_CONNECTIONS: 20
29+
DATABASE_MAX_RETRY: 10
30+
DATABASE_RETRY_WAIT: 5000
31+
ports:
32+
- "8443:8443"
33+
healthcheck:
34+
test:
35+
- CMD-SHELL
36+
- bash -lc 'exec 3<>/dev/tcp/127.0.0.1/8443'
37+
interval: 10s
38+
timeout: 5s
39+
retries: 30
40+
start_period: 40s

ci/configurations/alpine-temurin21-postgres.compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
db:
3-
image: postgres:16-alpine
3+
image: postgres:18.3-alpine
44
environment:
55
POSTGRES_USER: mirthdb
66
POSTGRES_PASSWORD: mirthdb
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
services:
2+
db:
3+
platform: linux/amd64
4+
image: mcr.microsoft.com/mssql/server:2025-latest
5+
environment:
6+
ACCEPT_EULA: Y
7+
MSSQL_PID: Developer
8+
MSSQL_SA_PASSWORD: OieSqlServerPassw0rd!
9+
healthcheck:
10+
test:
11+
- CMD-SHELL
12+
- /opt/mssql-tools18/bin/sqlcmd -C -S 127.0.0.1 -U sa -P "$$MSSQL_SA_PASSWORD" -Q "SELECT 1" || /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P "$$MSSQL_SA_PASSWORD" -Q "SELECT 1"
13+
interval: 10s
14+
timeout: 5s
15+
retries: 30
16+
start_period: 30s
17+
18+
db-init:
19+
platform: linux/amd64
20+
image: mcr.microsoft.com/mssql/server:2025-latest
21+
depends_on:
22+
db:
23+
condition: service_healthy
24+
environment:
25+
MSSQL_SA_PASSWORD: OieSqlServerPassw0rd!
26+
restart: "no"
27+
entrypoint:
28+
- /bin/bash
29+
- -lc
30+
- /opt/mssql-tools18/bin/sqlcmd -C -S db -U sa -P "$$MSSQL_SA_PASSWORD" -Q "IF DB_ID('mirthdb') IS NULL CREATE DATABASE mirthdb;" || /opt/mssql-tools/bin/sqlcmd -S db -U sa -P "$$MSSQL_SA_PASSWORD" -Q "IF DB_ID('mirthdb') IS NULL CREATE DATABASE mirthdb;"
31+
32+
oie:
33+
image: ${OIE_IMAGE}
34+
depends_on:
35+
db-init:
36+
condition: service_completed_successfully
37+
environment:
38+
DATABASE: sqlserver
39+
DATABASE_URL: jdbc:jtds:sqlserver://db:1433/mirthdb
40+
DATABASE_USERNAME: sa
41+
DATABASE_PASSWORD: OieSqlServerPassw0rd!
42+
DATABASE_MAX_CONNECTIONS: 20
43+
DATABASE_MAX_RETRY: 20
44+
DATABASE_RETRY_WAIT: 5000
45+
ports:
46+
- "8443:8443"
47+
healthcheck:
48+
test:
49+
- CMD-SHELL
50+
- bash -lc 'exec 3<>/dev/tcp/127.0.0.1/8443'
51+
interval: 10s
52+
timeout: 5s
53+
retries: 30
54+
start_period: 40s
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
oie:
3+
image: ${OIE_IMAGE}
4+
ports:
5+
- "8443:8443"
6+
healthcheck:
7+
test:
8+
- CMD-SHELL
9+
- bash -lc 'exec 3<>/dev/tcp/127.0.0.1/8443'
10+
interval: 10s
11+
timeout: 5s
12+
retries: 30
13+
start_period: 40s
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
services:
2+
db:
3+
image: postgres:18.3-alpine
4+
environment:
5+
POSTGRES_USER: mirthdb
6+
POSTGRES_PASSWORD: mirthdb
7+
POSTGRES_DB: mirthdb
8+
healthcheck:
9+
test:
10+
- CMD-SHELL
11+
- pg_isready -U mirthdb -d mirthdb
12+
interval: 10s
13+
timeout: 5s
14+
retries: 15
15+
start_period: 5s
16+
17+
oie:
18+
image: ${OIE_IMAGE}
19+
depends_on:
20+
db:
21+
condition: service_healthy
22+
environment:
23+
DATABASE: postgres
24+
DATABASE_URL: jdbc:postgresql://db:5432/mirthdb
25+
DATABASE_USERNAME: mirthdb
26+
DATABASE_PASSWORD: mirthdb
27+
DATABASE_MAX_CONNECTIONS: 20
28+
DATABASE_MAX_RETRY: 10
29+
DATABASE_RETRY_WAIT: 5000
30+
ports:
31+
- "8443:8443"
32+
healthcheck:
33+
test:
34+
- CMD-SHELL
35+
- bash -lc 'exec 3<>/dev/tcp/127.0.0.1/8443'
36+
interval: 10s
37+
timeout: 5s
38+
retries: 30
39+
start_period: 40s

ci/runner/compose.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import uuid
33
from pathlib import Path
44

5-
MAX_COMMAND_TIMEOUT_SECONDS = 15
5+
MAX_COMMAND_TIMEOUT_SECONDS = 90
66

77

88
def sanitize_project_name(name: str) -> str:

ci/runner/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from compose import compose_down, compose_up, sanitize_project_name
1616
from junitxml import JUnitReport
1717

18-
MAX_OPERATION_TIMEOUT_SECONDS = 15
18+
MAX_OPERATION_TIMEOUT_SECONDS = 90
1919
DEFAULT_TIMEOUT_SECONDS = MAX_OPERATION_TIMEOUT_SECONDS
2020
DEFAULT_BASE_URL = "https://host.docker.internal:8443"
2121
DEFAULT_USERNAME = "admin"
@@ -35,7 +35,7 @@ def parse_args() -> argparse.Namespace:
3535
parser.add_argument("--password", default=DEFAULT_PASSWORD, help="REST password.")
3636
parser.add_argument("--tests-root", default=DEFAULT_TESTS_ROOT, help="Root directory containing test fixtures.")
3737
parser.add_argument("--results-root", default=DEFAULT_RESULTS_ROOT, help="Directory where JUnit XML results are written.")
38-
parser.add_argument("--timeout", type=int, default=DEFAULT_TIMEOUT_SECONDS, help="Timeout in seconds for any harness operation. Capped at 15 seconds.")
38+
parser.add_argument("--timeout", type=int, default=DEFAULT_TIMEOUT_SECONDS, help="Timeout in seconds for any harness operation. Capped at 90 seconds.")
3939
parser.add_argument("--keep-alive", action="store_true", help="Leave the compose stack running after a successful check.")
4040
args = parser.parse_args()
4141
args.timeout = normalize_timeout(args.timeout)

ci/runtests.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,31 @@ param(
88
$ErrorActionPreference = "Stop"
99
$PSNativeCommandUseErrorActionPreference = $true
1010
$RootDir = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
11-
$ServerImage = if ($env:SERVER_IMAGE) { $env:SERVER_IMAGE } else { "oie-ci-server:local" }
11+
$AlpineServerImage = "oie-ci-server:local-alpine-temurin21"
12+
$UbuntuServerImage = "oie-ci-server:local-ubuntu-temurin21"
1213
$RunnerImage = if ($env:RUNNER_IMAGE) { $env:RUNNER_IMAGE } else { "oie-ci-runner:local" }
1314
$ResultsDir = Join-Path $RootDir "ci/test-results"
1415

1516
function Build-Images {
16-
$serverBuildArgs = @("build", "-t", $ServerImage)
17+
$serverBuildArgs = @("build")
1718
if ($AntBuildArgs) {
1819
$serverBuildArgs += @( "--build-arg", "ANT_BUILD_ARGS=$AntBuildArgs" )
1920
}
2021
if ($DisableUnitTests) {
2122
$serverBuildArgs += @( "--build-arg", "ANT_BUILD_ARGS=-DdisableTests=true -DdisableSigning=true" )
2223
}
23-
$serverBuildArgs += $RootDir
24+
docker @($serverBuildArgs + @( "--target", "jre-run", "-t", $AlpineServerImage, $RootDir ))
25+
docker @($serverBuildArgs + @( "--target", "jdk-run", "-t", $UbuntuServerImage, $RootDir ))
2426

25-
docker @serverBuildArgs
2627
docker build -t $RunnerImage (Join-Path $RootDir "ci/runner")
2728
}
2829

2930
function Invoke-Configuration([string]$Name) {
31+
$serverImage = if ($Name -like "ubuntu-*") { $UbuntuServerImage } else { $AlpineServerImage }
3032
$runnerArgs = @(
3133
"--workspace", "/workspace",
3234
"--configuration", $Name,
33-
"--server-image", $ServerImage,
35+
"--server-image", $serverImage,
3436
"--results-root", "ci/test-results"
3537
)
3638

0 commit comments

Comments
 (0)