From ca73cfd69aacfdb8316be3896336ef96cf6e1eee Mon Sep 17 00:00:00 2001 From: Divya Bhatt Date: Fri, 12 Apr 2024 14:58:35 +0100 Subject: [PATCH 1/4] To fix junit-tests not found --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5eccf180..1092246a 100644 --- a/build.sbt +++ b/build.sbt @@ -62,4 +62,4 @@ lazy val defaultClientSettings: Seq[Setting[_]] = Seq( ) -Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", sys.env.getOrElse("SBT_JUNIT_OUTPUT", "junit")) +Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", sys.env.getOrElse("SBT_JUNIT_OUTPUT", "junit-tests")) From 1db4da4fe7a5cf25caebf7c53dab688375591533 Mon Sep 17 00:00:00 2001 From: Divya Bhatt Date: Mon, 15 Apr 2024 10:28:16 +0100 Subject: [PATCH 2/4] Try test-result as recomended by EnricoMi to fix CI failing for not able to get test files --- .github/workflows/testonpush.yml | 3 +-- build.sbt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testonpush.yml b/.github/workflows/testonpush.yml index 4475e6f9..4f91ba05 100644 --- a/.github/workflows/testonpush.yml +++ b/.github/workflows/testonpush.yml @@ -27,11 +27,10 @@ jobs: - name: Test env: CAPI_TEST_KEY: ${{ secrets.CAPI_TEST_KEY }} - SBT_JUNIT_OUTPUT: ./junit-tests JAVA_OPTS: -XX:+UseCompressedOops run: sbt test - uses: EnricoMi/publish-unit-test-result-action@v2 if: always() #runs even if there is a test failure with: - files: junit-tests/*.xml + files: test-results/**/TEST-*.xml diff --git a/build.sbt b/build.sbt index 1092246a..84942e74 100644 --- a/build.sbt +++ b/build.sbt @@ -61,5 +61,4 @@ lazy val defaultClientSettings: Seq[Setting[_]] = Seq( """ ) - -Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", sys.env.getOrElse("SBT_JUNIT_OUTPUT", "junit-tests")) +Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-u", s"test-results/scala-${scalaVersion.value}", "-o") \ No newline at end of file From 85aba9ed264b4e428472068a02542d5959ca1e3c Mon Sep 17 00:00:00 2001 From: Divya Bhatt Date: Mon, 15 Apr 2024 11:17:45 +0100 Subject: [PATCH 3/4] add runTest in releaseprocess --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 84942e74..40f11377 100644 --- a/build.sbt +++ b/build.sbt @@ -15,6 +15,7 @@ lazy val root = (project in file(".")) checkSnapshotDependencies, inquireVersions, runClean, + runTest, setReleaseVersion, commitReleaseVersion, tagRelease, From 0e4149eccbb397b4a430d10da9dc31bc8be89315 Mon Sep 17 00:00:00 2001 From: Divya Bhatt Date: Fri, 19 Apr 2024 18:20:19 +0100 Subject: [PATCH 4/4] Various CI fixes including using pull request trigger We are doing this because push is very bad choice of trigger for CI on github PRs. Example: https://github.com/guardian/mobile-apps-api/pull/2760 Co-authored-Roberto Tyley --- .github/workflows/{testonpush.yml => ci.yml} | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) rename .github/workflows/{testonpush.yml => ci.yml} (64%) diff --git a/.github/workflows/testonpush.yml b/.github/workflows/ci.yml similarity index 64% rename from .github/workflows/testonpush.yml rename to .github/workflows/ci.yml index 4f91ba05..3e32e027 100644 --- a/.github/workflows/testonpush.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,13 @@ -name: Test on push - +name: CI on: + workflow_dispatch: + pull_request: + + # triggering CI default branch improves caching + # see https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache push: - branches: [ "**" ] - workflow_dispatch: {} + branches: + - main jobs: test: @@ -15,10 +19,10 @@ jobs: pull-requests: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: corretto java-version: 11