Repository: denoland/deno
Pull request: ci: add back test result artifacts

Shard 1 is also now working. It actually wasn't 😅

<img width="880" height="346" alt="image" src="https://github.com/user-attachments/assets/34e301de-52f2-4752-a4e6-af70fed36811" />


Changed files:
filename: .github/workflows/ci.generate.ts
patch: @@ -10,6 +10,7 @@ import {
   defineMatrix,
   type ExpressionValue,
   job,
+  literal,
   step,
 } from "jsr:@david/gagen@0.2.18";
 
@@ -963,8 +964,9 @@ const buildJobs = buildItems.map((rawBuildItem) => {
         return Array.from({ length: total }, (_, i) => ({
           test_crate: tc.name,
           test_package: tc.package,
-          shard_index: i,
-          shard_total: total,
+          // make these strings so index isn't falsy when 0
+          shard_index: i.toString(),
+          shard_total: total.toString(),
           shard_label: total > 1 ? `(${i + 1}/${total}) ` : "",
         }));
       }),
@@ -1077,6 +1079,20 @@ const buildJobs = buildItems.map((rawBuildItem) => {
               "fi",
             ],
           },
+          {
+            name: "Upload test results",
+            uses: "actions/upload-artifact@v6",
+            if: conditions.status.always().and(isNotTag),
+            with: {
+              name:
+                `test-results-${buildItem.os}-${buildItem.arch}-${buildItem.profile}-${testMatrix.test_crate}${
+                  testMatrix.shard_total.greaterThan(1).then(
+                    literal("-shard-").concat(testMatrix.shard_index),
+                  ).else("")
+                }.json`,
+              path: `target/test_results_${testMatrix.test_crate}.json`,
+            },
+          },
           saveCacheStep.if(buildItem.save_cache),
         ),
       },

filename: .github/workflows/ci.yml
patch: @@ -361,38 +361,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -500,6 +500,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-macos-x86_64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -769,38 +775,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -907,6 +913,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-macos-x86_64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
   build-debug-macos-aarch64:
     name: build debug macos-aarch64
     needs:
@@ -1059,38 +1071,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -1212,6 +1224,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-macos-aarch64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -1604,38 +1622,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -1756,6 +1774,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-macos-aarch64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
   build-debug-windows-x86_64:
     name: build debug windows-x86_64
     needs:
@@ -1891,38 +1915,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -2021,6 +2045,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-windows-x86_64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -2408,38 +2438,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -2537,6 +2567,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-windows-x86_64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
   build-debug-windows-aarch64:
     name: build debug windows-aarch64
     needs:
@@ -2672,38 +2708,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -2802,6 +2838,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-windows-aarch64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -3094,38 +3136,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -3223,6 +3265,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-windows-aarch64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
   build-release-linux-x86_64:
     name: build release linux-x86_64
     needs:
@@ -3542,38 +3590,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -3761,6 +3809,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-linux-x86_64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -4116,38 +4170,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -4336,6 +4390,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-linux-x86_64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -4586,38 +4646,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -4728,6 +4788,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-linux-aarch64-debug-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
       - name: Cache cargo home
         uses: cirruslabs/cache/save@v4
         if: '!startsWith(github.ref, ''refs/tags/'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && github.ref == ''refs/heads/main'''
@@ -5157,38 +5223,38 @@ jobs:
         include:
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: integration
             test_package: integration_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: node_compat
             test_package: node_compat_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 0
-            shard_total: 2
+            shard_index: '0'
+            shard_total: '2'
             shard_label: '(1/2) '
           - test_crate: specs
             test_package: specs_tests
-            shard_index: 1
-            shard_total: 2
+            shard_index: '1'
+            shard_total: '2'
             shard_label: '(2/2) '
           - test_crate: unit
             test_package: unit_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
           - test_crate: unit_node
             test_package: unit_node_tests
-            shard_index: 0
-            shard_total: 1
+            shard_index: '0'
+            shard_total: '1'
             shard_label: ''
       fail-fast: false
     env:
@@ -5379,6 +5445,12 @@ jobs:
       - name: Ensure no git changes
         if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && github.event_name == ''pull_request'''
         run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+      - name: Upload test results
+        uses: actions/upload-artifact@v6
+        if: '!startsWith(github.ref, ''refs/tags/'') && !(!contains(github.event.pull_request.labels.*.name, ''ci-full'') && github.event_name == ''pull_request'') && (matrix.shard_index == 0 || github.event_name == ''pull_request'') && always()'
+        with:
+          name: 'test-results-linux-aarch64-release-${{ matrix.test_crate }}${{ matrix.shard_total > 1 && format(''-shard-{0}'', matrix.shard_index) || '''' }}.json'
+          path: 'target/test_results_${{ matrix.test_crate }}.json'
   lint:
     name: 'lint ${{ matrix.profile }} ${{ matrix.os }}-${{ matrix.arch }}'
     needs:

filename: tests/util/lib/test_runner.rs
patch: @@ -48,9 +48,9 @@ pub fn filter_to_shard<T>(
 ) -> CollectedTestCategory<T> {
   let all_names = collect_test_names(&category);
 
-  let my_tests = assign_shard_tests(&all_names, shard);
-
   let total_count = all_names.len();
+  let my_tests = assign_shard_tests(all_names, shard);
+
   let shard_count = my_tests.len();
   crate::eprintln!(
     "shard {}/{}: running {shard_count}/{total_count} tests",
@@ -77,11 +77,11 @@ fn collect_test_names<T>(category: &CollectedTestCategory<T>) -> Vec<String> {
 }
 
 fn assign_shard_tests(
-  all_names: &[String],
+  all_names: Vec<String>,
   shard: &ShardConfig,
 ) -> HashSet<String> {
   // round-robin: distribute by sorted name index
-  let mut sorted: Vec<_> = all_names.to_vec();
+  let mut sorted: Vec<_> = all_names;
   sorted.sort();
   sorted
     .into_iter()
@@ -434,14 +434,9 @@ impl JsonReporter {
       let data = self.data.lock();
       serde_json::to_string(&*data).unwrap()
     };
-    let shard_suffix = match ShardConfig::from_env() {
-      Some(shard) => format!("_shard-{}", shard.index),
-      None => String::new(),
-    };
-    let file_path = crate::root_path().join("target").join(format!(
-      "test_results_{}{shard_suffix}.json",
-      self.test_module_name
-    ));
+    let file_path = crate::root_path()
+      .join("target")
+      .join(format!("test_results_{}.json", self.test_module_name));
 
     file_path.write(json);
   }