Skip to content

Commit

Permalink
KH-520: Validate on PR & self-rebuild upon dependency changes. (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliouzbett authored May 16, 2024
1 parent ba7c7e6 commit e990723
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 55 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/build-publish.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/check-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Check for dependency changes

on:
workflow_dispatch:
schedule:
- cron: '*/60 * * * *'

jobs:
check-deps:
uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-check-deps-build-publish.yml@main
with:
java-version: "8"
maven-args: "-P prod -DskipTests=true"
secrets:
NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }}
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
validate:
uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main
with:
java-version: "8"
maven-phase: "install"
maven-args: "-P validator -P prod"
use-secrets: true
secrets:
NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }}

release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: validate
uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main
with:
java-version: "8"
maven-args: "-P prod -DskipTests=true"
secrets:
NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }}
5 changes: 2 additions & 3 deletions base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<relativePath></relativePath>
</parent>

<groupId>com.ozonehis</groupId>
<artifactId>ozone-cambodia</artifactId>
<version>1.7.0-SNAPSHOT</version>
<description>Ozone Cambodia</description>
Expand Down Expand Up @@ -91,7 +90,7 @@
</snapshotRepository>
</distributionManagement>

<!--
<!--
Disable OpenMRS Initalizer Validator due to an error when running it consequently in 2 Maven sub-modules.
OpennMRS config validation will be done in the child Maven project "prod" which should validate this project to a great extent.
See Slack conversation: https://mekomsolutions.slack.com/archives/G421UNF5L/p1715787009629219?thread_ts=1715774419.673979&cid=G421UNF5L
Expand Down Expand Up @@ -130,4 +129,4 @@
</build>
</profile>
</profiles> -->
</project>
</project>
45 changes: 43 additions & 2 deletions prod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<relativePath></relativePath>
</parent>

<groupId>com.ozonehis</groupId>
<artifactId>ozone-cambodia-prod</artifactId>
<version>1.7.0-SNAPSHOT</version>
<description>Ozone Cambodia - with production dependencies</description>
Expand All @@ -24,6 +23,9 @@
<ozone.artifactId>ozone-cambodia</ozone.artifactId>
<ozone.groupId>com.ozonehis</ozone.groupId>
<ozone.version>1.7.0-SNAPSHOT</ozone.version>

<!-- Classifier for the dependency report artifact -->
<dependencyReportClassifier>dependencies</dependencyReportClassifier>
</properties>

<dependencies>
Expand Down Expand Up @@ -59,6 +61,45 @@
</execution>
</executions>
</plugin>
<!-- Compile a dependency report -->
<plugin>
<groupId>net.mekomsolutions.maven.plugin</groupId>
<artifactId>dependency-tracker-maven-plugin</artifactId>
<executions>
<execution>
<id>Compile dependency report</id>
<phase>compile</phase>
<goals>
<goal>track</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Attach the dependency report to the build -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>Attach the dependency report</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>
${project.build.directory}/${project.artifactId}-${project.version}-dependencies.txt</file>
<type>txt</type>
<classifier>${dependencyReportClassifier}</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -121,4 +162,4 @@
</build>
</profile>
</profiles>
</project>
</project>

0 comments on commit e990723

Please sign in to comment.