Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build OpenIntegrationEngine
name: Build Open Integration Engine

on:
push:
Expand All @@ -9,6 +9,16 @@ on:
- main

jobs:
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}

build:
runs-on: ubuntu-latest

Expand All @@ -30,7 +40,7 @@ jobs:
- name: Build OIE (unsigned)
if: github.ref != 'refs/heads/main'
working-directory: server
run: ant -f mirth-build.xml -DdisableSigning=true
run: ant -f mirth-build.xml -DdisableSigning=true -Dcoverage=true

- name: Package distribution
run: tar czf openintegrationengine.tar.gz -C server/ setup --transform 's|^setup|openintegrationengine/|'
Expand All @@ -40,3 +50,19 @@ jobs:
with:
name: oie-build
path: openintegrationengine.tar.gz

- name: Stage Test Results
if: (!cancelled())
run: |
mkdir -p aggregate-test-results
# Copy the directory structures
cp -r --parents */build/test-results aggregate-test-results/

- name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v4
with:
name: Test Results
path: |
aggregate-test-results/**/*.xml

38 changes: 38 additions & 0 deletions .github/workflows/upload_test_results.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test Results

on:
workflow_run:
workflows: ["Build Open Integration Engine"]
types:
- completed

permissions: {}

jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'

permissions:
checks: write
# needed unless run with comment_mode: off
pull-requests: write
# required by download step to access artifacts API
actions: read

steps:
- name: Download and Extract Artifacts
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
path: artifacts

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/Test Results/**/*.xml"
109 changes: 84 additions & 25 deletions client/ant-build.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project name="mirth-client" basedir="." default="help" xmlns:unless="ant:unless">
<project name="mirth-client" basedir="." default="help"
xmlns:jacoco="antlib:org.jacoco.ant" xmlns:unless="ant:unless" xmlns:if="ant:if">

<target name="help">
<echo>OIE Client Build Help</echo>
<echo>-----------------------</echo>
Expand Down Expand Up @@ -67,9 +69,18 @@
<property name="plugins.xsltstep" value="${extensions}/xsltstep" />
</target>

<target name="clean" depends="init">
<target name="clean" depends="init, clean-legacy-dirs">
<delete dir="${classes}" />
<delete dir="${test_classes}" />
<delete dir="${dist}" />
<delete dir="${setup}" />
<delete dir="${build.dir}" />
</target>

<target name="clean-legacy-dirs" depends="init">
<delete dir="${basedir}/code-coverage-reports" />
<delete dir="${basedir}/junit-reports" />
<delete dir="${basedir}/junit-html" />
</target>

<target name="compile" depends="clean, init">
Expand Down Expand Up @@ -352,30 +363,78 @@
resource="org/jacoco/ant/antlib.xml"
classpathref="jacoco.classpath"/>

<target name="test-coverage" depends="test-compile">
<description>Run unit tests WITH JaCoCo coverage.</description>

<delete dir="${jacoco.data.dir}" />
<delete dir="${reports.jacoco.dir}" />

<jacoco:agent property="jacoco.agent.arg"
destfile="${jacoco.exec.file}"
exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" />

<antcall target="test-run" />

<jacoco:report>
<executiondata>
<file file="${jacoco.exec.file}" />
</executiondata>
<structure name="${ant.project.name}">
<classfiles>
<fileset dir="${classes}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src}" />
</sourcefiles>
</structure>
<html destdir="${reports.jacoco.html}" />
<xml destfile="${reports.jacoco.xml}"/>
</jacoco:report>
</target>

<target name="test-run" depends="test-compile">
<property name="junit-reports" value="junit-reports" />
<property name="code-coverage-reports" value="code-coverage-reports" />
<mkdir dir="${junit-reports}" />
<mkdir dir="${code-coverage-reports}" />

<jacoco:coverage destfile="${code-coverage-reports}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant" exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
<junit haltonfailure="false" fork="true" forkmode="once">
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx2048m" />
<!-- https://stackoverflow.com/questions/54205486 -->
<jvmarg value="-Xshare:off" />
<classpath>
<path refid="testclasspath" />
<dirset dir="${test_classes}"/>
</classpath>
<formatter type="xml" />
<batchtest todir="${junit-reports}">
<fileset dir="${test_classes}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<description>Run unit tests. Coverage is only enabled if 'jacoco.agent.arg' is set.</description>

<delete dir="${test.results.dir}" />
<delete dir="${reports.tests.dir}" />
<mkdir dir="${test.results.dir}" />
<mkdir dir="${reports.tests.dir}" />

<junit haltonfailure="false"
failureproperty="test.failed"
errorproperty="test.failed"
fork="true"
forkmode="once">

<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx2048m" />
<!-- https://stackoverflow.com/questions/54205486 -->
<jvmarg value="-Xshare:off" />
<jvmarg line="${jacoco.agent.arg}" if:set="jacoco.agent.arg" />

<classpath>
<path refid="testclasspath" />
<dirset dir="${test_classes}"/>
</classpath>

<formatter type="xml" />

<batchtest todir="${test.results.dir}">
<fileset dir="${test_classes}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>

<!-- Generate HTML report from JUnit XML output -->
<junitreport todir="${test.results.dir}">
<fileset dir="${test.results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports.tests.dir}" />
</junitreport>

<fail if="test.failed" message="Unit tests failed. For details, check reports in ${reports.tests.dir}."/>
</target>

<target name="remove-classes" depends="init">
Expand Down
19 changes: 19 additions & 0 deletions client/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# top level directories
src=${basedir}/src
test=${basedir}/test
build.dir=${basedir}/build
server=${basedir}/../server
donkey_src=${basedir}/../donkey/src/main/java
donkey_lib=${basedir}/../donkey/lib
Expand All @@ -13,5 +14,23 @@ dist=${basedir}/dist
# jars
client.jar=mirth-client.jar

# Reports
reports.dir=${build.dir}/reports

# JUnit Raw Results (XML)
test.results.dir=${build.dir}/test-results/test

# JUnit Human-Readable Reports (HTML)
reports.tests.dir=${reports.dir}/tests/test

# JaCoCo Execution Data (.exec)
jacoco.data.dir=${build.dir}/jacoco
jacoco.exec.file=${jacoco.data.dir}/test.exec

# JaCoCo Reports (HTML and XML)
reports.jacoco.dir=${reports.dir}/jacoco/test
reports.jacoco.html=${reports.jacoco.dir}/html
reports.jacoco.xml=${reports.jacoco.dir}/jacocoTestReport.xml

# This value is used as the modified time for the files inside of jar, zip, and war files
archive.entry.date=1999-01-01T00:00:00.000Z
20 changes: 19 additions & 1 deletion command/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ src=${basedir}/src
classes=${basedir}/classes
lib=${basedir}/lib
conf=${basedir}/conf
build=${basedir}/build
build.dir=${basedir}/build
dist=${basedir}/dist
test=${basedir}/test
testlib=${basedir}/testlib
Expand All @@ -14,5 +14,23 @@ server=${basedir}/../server
cli.jar=mirth-cli.jar
cli-launcher.jar=mirth-cli-launcher.jar

# Reports
reports.dir=${build.dir}/reports

# JUnit Raw Results (XML)
test.results.dir=${build.dir}/test-results/test

# JUnit Human-Readable Reports (HTML)
reports.tests.dir=${reports.dir}/tests/test

# JaCoCo Execution Data (.exec)
jacoco.data.dir=${build.dir}/jacoco
jacoco.exec.file=${jacoco.data.dir}/test.exec

# JaCoCo Reports (HTML and XML)
reports.jacoco.dir=${reports.dir}/jacoco/test
reports.jacoco.html=${reports.jacoco.dir}/html
reports.jacoco.xml=${reports.jacoco.dir}/jacocoTestReport.xml

# This value is used as the modified time for the files inside of jar, zip, and war files
archive.entry.date=1999-01-01T00:00:00.000Z
Loading