Skip to content

Commit a9b8c2f

Browse files
STAND-128: Add GitHub Actions workflow to build and test in Standalone 2.x Reff App (#86)
* Replace the embedded mysql with mariadb4j in Ref App 2.x * removing nashorn-core * updating to the latest snapshot * resized MainFrame and updated readme * added unit tests * STAND-128: Add GitHub Actions workflow to build and test in Standalone 2.x Reff App * trying to use the alpha version instead of snapshot * adding openmrs-standalone.jar at build time in zip * switching back 2.8.0-SNAPSHOT * update to openmrs core version 2.8.1-SNAPSHOT * Added vm_arguments --add-opens=java.base/java.lang=ALL-UNNAMED * Checkout & build openmrs-core inside the same workflow for snapshot versions * Using the 2.8.x branch instead of master * ensures Maven knows the main artifact * removing --add-opens=java.base/java.lang=ALL-UNNAMED * updating documentation to the readme.md
1 parent dc9a3cf commit a9b8c2f

File tree

5 files changed

+213
-8
lines changed

5 files changed

+213
-8
lines changed

.github/maven-settings.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.2.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<profiles>
5+
<profile>
6+
<repositories>
7+
<repository>
8+
<id>openmrs-repo</id>
9+
<name>OpenMRS Repository</name>
10+
<url>https://mavenrepo.openmrs.org/public</url>
11+
</repository>
12+
<repository>
13+
<releases>
14+
<checksumPolicy>warn</checksumPolicy>
15+
</releases>
16+
<snapshots>
17+
<checksumPolicy>warn</checksumPolicy>
18+
</snapshots>
19+
<id>archetype</id>
20+
<url>https://mavenrepo.openmrs.org/public</url>
21+
</repository>
22+
<repository>
23+
<id>openmrs-repo-thirdparty</id>
24+
<name>OpenMRS Thirdparty Nexus Repository</name>
25+
<url>https://mavenrepo.openmrs.org/thirdparty</url>
26+
</repository>
27+
<repository>
28+
<id>mks-nexus-public</id>
29+
<name>Mekom Repository</name>
30+
<url>https://nexus.mekomsolutions.net/repository/maven-public</url>
31+
</repository>
32+
</repositories>
33+
<pluginRepositories>
34+
<pluginRepository>
35+
<snapshots>
36+
<enabled>false</enabled>
37+
</snapshots>
38+
<id>openmrs-repo</id>
39+
<name>OpenMRS Nexus Repository</name>
40+
<url>https://mavenrepo.openmrs.org/public</url>
41+
</pluginRepository>
42+
</pluginRepositories>
43+
<id>openmrs</id>
44+
</profile>
45+
</profiles>
46+
<activeProfiles>
47+
<activeProfile>openmrs</activeProfile>
48+
</activeProfiles>
49+
<pluginGroups>
50+
<pluginGroup>org.openmrs.maven.plugins</pluginGroup>
51+
</pluginGroups>
52+
</settings>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Standalone 2.x Test CI
2+
3+
on:
4+
push:
5+
branches: [openmrs-emr2]
6+
pull_request:
7+
branches: [openmrs-emr2]
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build-linux:
18+
name: on Linux (Java 21)
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Checkout openmrs-core
25+
uses: actions/checkout@v4
26+
with:
27+
repository: openmrs/openmrs-core
28+
ref: 2.8.x
29+
path: openmrs-core
30+
31+
- name: Set up JDK 21
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '21'
35+
distribution: 'temurin'
36+
37+
- name: Build and install openmrs-core
38+
run: |
39+
cd openmrs-core
40+
mvn clean install -DskipTests
41+
42+
- name: Run Maven Clean
43+
run: mvn clean --settings .github/maven-settings.xml
44+
45+
- name: Run Maven Install
46+
run: mvn install --settings .github/maven-settings.xml
47+
48+
build-windows:
49+
name: on Windows (Java 21)
50+
runs-on: windows-latest
51+
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
56+
- name: Checkout openmrs-core
57+
uses: actions/checkout@v4
58+
with:
59+
repository: openmrs/openmrs-core
60+
ref: 2.8.x
61+
path: openmrs-core
62+
63+
- name: Set up JDK 21
64+
uses: actions/setup-java@v4
65+
with:
66+
java-version: '21'
67+
distribution: 'temurin'
68+
69+
- name: Build and install openmrs-core
70+
run: |
71+
cd openmrs-core
72+
mvn clean install -DskipTests
73+
74+
- name: Run Maven Clean
75+
run: mvn clean --settings .github/maven-settings.xml
76+
77+
- name: Run Maven Install
78+
run: mvn install --settings .github/maven-settings.xml
79+
80+
build-macos:
81+
name: on macOS (Java 21)
82+
runs-on: macos-15
83+
steps:
84+
- name: Checkout repository
85+
uses: actions/checkout@v4
86+
87+
- name: Checkout openmrs-core
88+
uses: actions/checkout@v4
89+
with:
90+
repository: openmrs/openmrs-core
91+
ref: 2.8.x
92+
path: openmrs-core
93+
94+
- name: Set up JDK 21
95+
uses: actions/setup-java@v4
96+
with:
97+
java-version: '21'
98+
distribution: 'temurin'
99+
100+
- name: Build and install openmrs-core
101+
run: |
102+
cd openmrs-core
103+
mvn clean install -DskipTests
104+
105+
- name: Run Maven Clean
106+
run: mvn clean --settings .github/maven-settings.xml
107+
108+
- name: Run Maven Install
109+
run: mvn install --settings .github/maven-settings.xml

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,49 @@
1111
-> output is in the target folder, as referenceapplkication-standalone-(refapp.version).zip
1212
-> the contents of that zip are in the similarly-named folder under /target, if you want to test in-place
1313

14+
### Building with OpenMRS Core Snapshots
15+
16+
The **Reference Application Standalone 2.x** depends on **OpenMRS Core 2.8.x-SNAPSHOT** artifacts.
17+
Since **snapshot artifacts are not published** to Maven Central or the OpenMRS public Maven repository, they must be **built and installed locally** before compiling the Standalone.
18+
19+
#### Local builds
20+
21+
If you are building locally, you need to install OpenMRS Core 2.8.x into your Maven cache first:
22+
23+
```bash
24+
git clone https://github.com/openmrs/openmrs-core.git
25+
cd openmrs-core
26+
git checkout 2.8.x
27+
mvn clean install -DskipTests
28+
```
29+
30+
This makes the required `2.8.x-SNAPSHOT` artifacts available in your local `~/.m2/repository`.
31+
32+
#### CI builds
33+
34+
On CI (e.g., GitHub Actions), we explicitly build and install `openmrs-core` so that snapshot dependencies are resolved during the Standalone build:
35+
36+
```yaml
37+
- name: Checkout openmrs-core
38+
uses: actions/checkout@v4
39+
with:
40+
repository: openmrs/openmrs-core
41+
ref: 2.8.x
42+
path: openmrs-core
43+
44+
- name: Build and install openmrs-core
45+
run: |
46+
cd openmrs-core
47+
mvn clean install -DskipTests
48+
```
49+
50+
👉 This step ensures **snapshot versions are available during CI pipelines**, preventing build failures caused by missing `2.8.x-SNAPSHOT` artifacts.
51+
52+
#### Future updates
53+
54+
If the Standalone project upgrades to depend on a different OpenMRS Core branch (e.g., `3.0.x`), the CI workflow will need to be updated to build and install that matching snapshot version (e.g., `ref: 3.0.x`)..
55+
56+
1457
## HOW TO RUN FROM ECLIPSE
1558

1659
- Copy your war file into the "tomcat/webapps" folder. Where the tomcat folder is at the root of the project.

pom-step-02.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,14 @@
186186
<executions>
187187
<execution>
188188
<id>package-jar-with-dependencies</id>
189-
<phase>prepare-package</phase>
189+
<phase>package</phase>
190190
<goals>
191191
<goal>single</goal>
192192
</goals>
193193
<configuration>
194194
<finalName>openmrs-standalone</finalName>
195195
<appendAssemblyId>false</appendAssemblyId>
196+
<attach>true</attach>
196197
<outputDirectory>${project.build.directory}</outputDirectory>
197198
<descriptorRefs>
198199
<descriptorRef>jar-with-dependencies</descriptorRef>

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<liquibase.plugin.version>4.23.2</liquibase.plugin.version>
2323

2424
<tomcat.version>9.0.106</tomcat.version>
25-
<openmrs.version>2.8.0-SNAPSHOT</openmrs.version>
25+
<openmrs.version>2.8.1-SNAPSHOT</openmrs.version>
2626
<refapp.version>2.14.0-SNAPSHOT</refapp.version>
2727
<mariadb4jVersion>3.2.0</mariadb4jVersion>
2828
<junitVersion>5.12.2</junitVersion>
@@ -156,22 +156,22 @@
156156
<plugin>
157157
<groupId>org.apache.maven.plugins</groupId>
158158
<artifactId>maven-enforcer-plugin</artifactId>
159-
<version>1.0</version>
159+
<version>3.6.1</version>
160160
</plugin>
161161
<plugin>
162162
<groupId>org.apache.maven.plugins</groupId>
163163
<artifactId>maven-resources-plugin</artifactId>
164-
<version>2.7</version>
164+
<version>3.3.1</version>
165165
</plugin>
166166
<plugin>
167167
<groupId>org.apache.maven.plugins</groupId>
168168
<artifactId>maven-compiler-plugin</artifactId>
169-
<version>2.3.2</version>
169+
<version>3.14.0</version>
170170
</plugin>
171171
<plugin>
172172
<groupId>org.apache.maven.plugins</groupId>
173173
<artifactId>maven-dependency-plugin</artifactId>
174-
<version>2.3</version>
174+
<version>3.8.1</version>
175175
</plugin>
176176
<plugin>
177177
<groupId>org.liquibase</groupId>
@@ -188,12 +188,12 @@
188188
<plugin>
189189
<groupId>org.codehaus.mojo</groupId>
190190
<artifactId>exec-maven-plugin</artifactId>
191-
<version>1.2.1</version>
191+
<version>3.5.1</version>
192192
</plugin>
193193
<plugin>
194194
<groupId>org.apache.maven.plugins</groupId>
195195
<artifactId>maven-assembly-plugin</artifactId>
196-
<version>2.3</version>
196+
<version>3.7.1</version>
197197
</plugin>
198198

199199
<!--This plugin's configuration is used to store Eclipse m2e settings

0 commit comments

Comments
 (0)