From 77bf11093e60f2a050eac6fa172880de5cd8a8e9 Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Tue, 14 Nov 2023 13:28:00 +0100 Subject: [PATCH] Generate test reports on the CI --- .github/workflows/ci.yml | 168 ++++++++++++++++++++++++++++++ .github/workflows/test-report.yml | 22 ++++ 2 files changed, 190 insertions(+) create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f83e50c8..f0775cf2a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,14 @@ jobs: run: ./mill -i __.compile - name: Unit tests run: ./mill -i unitTests + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc unit-tests 'Scala CLI Unit Tests' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-unit-tests + path: test-report.xml jvm-tests-1: timeout-minutes: 120 @@ -59,6 +67,14 @@ jobs: SCALA_CLI_IT_GROUP: 1 - name: Fat jar integration test run: ./mill integration.test.jvmBootstrapped 'scala.cli.integration.StandaloneLauncherTests.*' + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc jvm-tests-1 'Scala CLI JVM Tests (1)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-jvm-tests-1 + path: test-report.xml jvm-tests-2: timeout-minutes: 120 @@ -75,6 +91,14 @@ jobs: run: ./mill -i integration.test.jvm env: SCALA_CLI_IT_GROUP: 2 + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc jvm-tests-2 'Scala CLI JVM Tests (2)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-jvm-tests-2 + path: test-report.xml jvm-tests-3: timeout-minutes: 120 @@ -91,6 +115,14 @@ jobs: run: ./mill -i integration.test.jvm env: SCALA_CLI_IT_GROUP: 3 + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc jvm-tests-3 'Scala CLI JVM Tests (3)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-jvm-tests-3 + path: test-report.xml generate-linux-launcher: timeout-minutes: 120 @@ -141,6 +173,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 1 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc linux-tests-1 'Scala CLI Linux Tests (1)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-linux-tests-1 + path: test-report.xml native-linux-tests-2: needs: generate-linux-launcher @@ -165,6 +205,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 2 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc linux-tests-2 'Scala CLI Linux Tests (2)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-linux-tests-2 + path: test-report.xml native-linux-tests-3: needs: generate-linux-launcher @@ -189,6 +237,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 3 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc linux-tests-3 'Scala CLI Linux Tests (3)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-linux-tests-3 + path: test-report.xml generate-linux-arm64-native-launcher: runs-on: "macOS-m1" @@ -262,6 +318,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 1 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc macos-tests-1 'Scala CLI MacOS Tests (1)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-macos-tests-1 + path: test-report.xml native-macos-tests-2: needs: generate-macos-launcher @@ -286,6 +350,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 2 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc macos-tests-2 'Scala CLI MacOS Tests (2)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-macos-tests-2 + path: test-report.xml native-macos-tests-3: needs: generate-macos-launcher @@ -310,6 +382,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 3 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc macos-tests-3 'Scala CLI MacOS Tests (3)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-macos-tests-3 + path: test-report.xml generate-macos-m1-launcher: timeout-minutes: 120 @@ -363,6 +443,14 @@ jobs: UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc macos-m1-tests 'Scala CLI MacOS M1 Tests' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-macos-m1-tests + path: test-report.xml generate-windows-launcher: timeout-minutes: 120 @@ -426,6 +514,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 1 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: scala-cli shebang .github/scripts/generate-junit-reports.sc windows-tests-1 'Scala CLI Windows Tests (1)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-windows-tests-1 + path: test-report.xml native-windows-tests-2: needs: generate-windows-launcher @@ -458,6 +554,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 2 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: scala-cli shebang .github/scripts/generate-junit-reports.sc windows-tests-2 'Scala CLI Windows Tests (2)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-windows-tests-2 + path: test-report.xml native-windows-tests-3: needs: generate-windows-launcher @@ -490,6 +594,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 3 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: scala-cli shebang .github/scripts/generate-junit-reports.sc windows-tests-3 'Scala CLI Windows Tests (3)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-windows-tests-3 + path: test-report.xml generate-mostly-static-launcher: timeout-minutes: 120 @@ -541,6 +653,14 @@ jobs: SCALA_CLI_SODIUM_JNI_ALLOW: false - name: Docker integration tests run: ./mill integration.docker-slim.test + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc native-mostly-static-tests-1 'Scala CLI Native Mostly Static Tests (1)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-native-mostly-static-tests-1 + path: test-report.xml - name: Login to GitHub Container Registry if: startsWith(github.ref, 'refs/tags/v') uses: docker/login-action@v3 @@ -574,6 +694,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 2 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc native-mostly-static-tests-2 'Scala CLI Native Mostly Static Tests (2)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-native-mostly-static-tests-2 + path: test-report.xml native-mostly-static-tests-3: needs: generate-mostly-static-launcher @@ -598,6 +726,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 3 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc native-mostly-static-tests-3 'Scala CLI Native Mostly Static Tests (3)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-native-mostly-static-tests-3 + path: test-report.xml generate-static-launcher: timeout-minutes: 120 @@ -649,6 +785,14 @@ jobs: SCALA_CLI_SODIUM_JNI_ALLOW: false - name: Docker integration tests run: ./mill integration.docker.test + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc native-static-tests-1 'Scala CLI Native Static Tests (1)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-native-static-tests-1 + path: test-report.xml - name: Login to GitHub Container Registry if: startsWith(github.ref, 'refs/tags/v') uses: docker/login-action@v3 @@ -684,6 +828,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 2 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc native-static-tests-2 'Scala CLI Native Static Tests (2)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-native-static-tests-2 + path: test-report.xml native-static-tests-3: needs: generate-static-launcher @@ -710,6 +862,14 @@ jobs: SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/ SCALA_CLI_IT_GROUP: 3 SCALA_CLI_SODIUM_JNI_ALLOW: false + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc native-static-tests-3 'Scala CLI Native Static Tests (3)' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-native-static-tests-3 + path: test-report.xml docs-tests: # for now, let's run those tests only on ubuntu @@ -729,6 +889,14 @@ jobs: run: .github/scripts/build-website.sh - name: Test documentation run: ./mill -i docs-tests.test + - name: Convert Mill test reports to JUnit XML format + run: .github/scripts/generate-junit-reports.sc docs-tests 'Scala CLI Docs Tests' test-report.xml out/ + - name: Upload test report + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results-docs-tests + path: test-report.xml checks: timeout-minutes: 15 diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 0000000000..95927d4f0b --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,22 @@ +name: 'Test Report' +on: + workflow_run: + workflows: ['CI'] + types: + - completed +permissions: + statuses: write + checks: write + contents: write + pull-requests: write + actions: write +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: dorny/test-reporter@v1 + with: + artifact: /test-results-(.*)/ + name: 'Test report $1' + path: '*.xml' + reporter: java-junit \ No newline at end of file