From 12effa15576a66fb8147a37a2c1a5c6f3f91e255 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Fri, 5 Sep 2025 11:17:28 -0700 Subject: [PATCH 1/2] ci: add EnricoMi/publish-unit-test-result-action --- .github/actions/test-package/action.yml | 2 +- .github/workflows/ci.yml | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/actions/test-package/action.yml b/.github/actions/test-package/action.yml index d0541d7e62..7005ddc87c 100644 --- a/.github/actions/test-package/action.yml +++ b/.github/actions/test-package/action.yml @@ -21,7 +21,7 @@ runs: shell: bash run: | mkdir -p test-results - npm run test | tee -a ./test-results/${{ inputs.package_name }}-test-results.txt + npm run test - name: Store Test Results if: ${{ !cancelled() }} uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41e2950720..e2684311e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,11 +87,34 @@ jobs: with: package_name: ${{ matrix.package }} + report: + name: Test Report + runs-on: ubuntu-latest + needs: test + if: ${{ !cancelled() }} + permissions: + checks: write + pull-requests: write + contents: read + issues: read + steps: + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 + with: + path: artifacts + pattern: "*-test-output" + - name: List downloaded artifacts + run: ls -R ./artifacts/ + - name: Publish test reports + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "./artifacts/*/**/*" + results: name: Results runs-on: ubuntu-latest needs: test - if: ${{ always() }} + if: ${{ !cancelled() }} steps: - run: | case "${{ needs.test.result }}" in From 44cb5f93d3c9cc14048ceba10b1ead4f80c49aab Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Mon, 8 Sep 2025 08:52:00 -0700 Subject: [PATCH 2/2] ci: feed node-tap output to test report generator --- .github/actions/test-package/action.yml | 10 ++++++++++ .github/workflows/ci.yml | 23 ----------------------- packages/scratch-gui/.gitignore | 4 +--- packages/scratch-render/.gitignore | 1 + packages/scratch-svg-renderer/.gitignore | 1 + packages/scratch-vm/.gitignore | 1 + 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/actions/test-package/action.yml b/.github/actions/test-package/action.yml index 7005ddc87c..8be7c21d27 100644 --- a/.github/actions/test-package/action.yml +++ b/.github/actions/test-package/action.yml @@ -19,9 +19,19 @@ runs: - name: Test working-directory: ./packages/${{ inputs.package_name }} shell: bash + env: + TAP_REPORTER: "junit" + TAP_REPORTER_FILE: "test-results/junit.xml" run: | mkdir -p test-results npm run test + - name: Publish test reports + if: ${{ !cancelled() }} + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "./packages/${{ inputs.package_name }}/test-results/**/*" + check_name: "Test report for ${{ inputs.package_name }}" + test_file_prefix: "+packages/${{ inputs.package_name }}/" - name: Store Test Results if: ${{ !cancelled() }} uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2684311e4..0f2c846b71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,29 +87,6 @@ jobs: with: package_name: ${{ matrix.package }} - report: - name: Test Report - runs-on: ubuntu-latest - needs: test - if: ${{ !cancelled() }} - permissions: - checks: write - pull-requests: write - contents: read - issues: read - steps: - - name: Download artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 - with: - path: artifacts - pattern: "*-test-output" - - name: List downloaded artifacts - run: ls -R ./artifacts/ - - name: Publish test reports - uses: EnricoMi/publish-unit-test-result-action@v2 - with: - files: "./artifacts/*/**/*" - results: name: Results runs-on: ubuntu-latest diff --git a/packages/scratch-gui/.gitignore b/packages/scratch-gui/.gitignore index c851a6e0cf..c8164bfc32 100644 --- a/packages/scratch-gui/.gitignore +++ b/packages/scratch-gui/.gitignore @@ -8,6 +8,7 @@ npm-* # Testing /.nyc_output /coverage +/test-results # Build /build @@ -26,6 +27,3 @@ npm-* # for act .secrets - -# Generated test results -/test-results diff --git a/packages/scratch-render/.gitignore b/packages/scratch-render/.gitignore index bb895a642a..d0ebddd55e 100644 --- a/packages/scratch-render/.gitignore +++ b/packages/scratch-render/.gitignore @@ -9,6 +9,7 @@ npm-* /.nyc_output /.tap /coverage +/test-results # IDEA /.idea diff --git a/packages/scratch-svg-renderer/.gitignore b/packages/scratch-svg-renderer/.gitignore index 1fd12495e8..58c573c035 100644 --- a/packages/scratch-svg-renderer/.gitignore +++ b/packages/scratch-svg-renderer/.gitignore @@ -11,6 +11,7 @@ npm-* # Test /.tap +/test-results # Editors /#* diff --git a/packages/scratch-vm/.gitignore b/packages/scratch-vm/.gitignore index 442c1e4103..e44e4d8bac 100644 --- a/packages/scratch-vm/.gitignore +++ b/packages/scratch-vm/.gitignore @@ -9,6 +9,7 @@ npm-* /.nyc_output /.tap /coverage +/test-results # Editor /.idea