From 25670ea55afe09039145511dcbb27858226f705f Mon Sep 17 00:00:00 2001 From: "Kipchumba C. Bett" Date: Tue, 2 Jul 2024 10:39:32 +0300 Subject: [PATCH 1/4] KH-520: Fix failing builds on PR from forked repositories --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9913b528..4fa9bd6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,10 @@ jobs: with: java-version: "8" maven-phase: "install" - maven-args: "-P prod" # Remove -Pvalidator to temporarily bypass validation - use-secrets: true + maven-args: + ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' ? '-P prod -DskipTests': '' }} + use-secrets: + ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' ? true: false }} secrets: NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }} @@ -26,7 +28,7 @@ jobs: uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main with: java-version: "8" - maven-args: "-P prod -DskipTests=true" + maven-args: "-P prod -DskipTests" secrets: NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }} From 4b3627d60c034b8a732aceeeeea5c170db1c1314 Mon Sep 17 00:00:00 2001 From: "Kipchumba C. Bett" Date: Tue, 2 Jul 2024 10:54:58 +0300 Subject: [PATCH 2/4] KH-520: Introduce validate-prod only on push to main --- .github/workflows/ci.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fa9bd6d..f4d603ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,15 +9,24 @@ on: types: [published] jobs: + validate-pr: + if: ${{ github.event_name == 'pull_request' }} + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main + with: + java-version: "8" + maven-phase: "install" + secrets: + NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }} + validate: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main with: java-version: "8" maven-phase: "install" - maven-args: - ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' ? '-P prod -DskipTests': '' }} - use-secrets: - ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' ? true: false }} + maven-args: "-P prod -DskipTests" + use-secrets: true secrets: NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }} From 04bb40e5c809d231b0bf4777433fc88d0b47f667 Mon Sep 17 00:00:00 2001 From: "Kipchumba C. Bett" Date: Tue, 2 Jul 2024 11:52:06 +0300 Subject: [PATCH 3/4] KH-520: Enable OpenMRS iniz configurations validation --- .github/workflows/ci.yml | 3 ++- base/pom.xml | 13 +++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4d603ef..25c24ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,8 @@ jobs: with: java-version: "8" maven-phase: "install" - secrets: + maven-args: "-P validator -DskipTests" + secrets: # We don't the secrets here. we make them not required. NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }} diff --git a/base/pom.xml b/base/pom.xml index ee7c98d1..2993b84e 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -248,16 +248,9 @@ See Slack conversation: https://mekomsolutions.slack.com/archives/G421UNF5L/p1715787009629219?thread_ts=1715774419.673979&cid=G421UNF5L --> - - \ No newline at end of file + + From 9c9af7400999391dbdf4758a0ae0beefaf0944bc Mon Sep 17 00:00:00 2001 From: "Kipchumba C. Bett" Date: Tue, 2 Jul 2024 12:27:58 +0300 Subject: [PATCH 4/4] Don't skip tests --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25c24ef5..d2131c69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: with: java-version: "8" maven-phase: "install" - maven-args: "-P validator -DskipTests" - secrets: # We don't the secrets here. we make them not required. + maven-args: "-P validator" + secrets: # We don't need secrets here. we should make them not required. NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.MEKOM_NEXUS_PASSWORD }} @@ -26,7 +26,7 @@ jobs: with: java-version: "8" maven-phase: "install" - maven-args: "-P prod -DskipTests" + maven-args: "-P prod" use-secrets: true secrets: NEXUS_USERNAME: ${{ secrets.MEKOM_NEXUS_USERNAME }}