Standing-Man commented on code in PR #3749:
URL: https://github.com/apache/iggy/pull/3749#discussion_r3687519083


##########
.github/actions/rust/pre-merge/action.yml:
##########
@@ -316,12 +309,87 @@ runs:
           echo "DAG scope:                     full workspace (${TOTAL_CRATES} 
crates)"
         fi
         echo "All targets build:             ${bins_duration}s ($(date -ud 
@${bins_duration} +'%M:%S'))"
-        echo "Tests compile:                 ${compile_duration}s ($(date -ud 
@${compile_duration} +'%M:%S'))"
-        echo "Tests execute:                 ${test_duration}s ($(date -ud 
@${test_duration} +'%M:%S'))"
+        echo "Tests compile and archive:     ${compile_duration}s ($(date -ud 
@${compile_duration} +'%M:%S'))"
         echo "-----------------------------------------"
         echo "Total build:                   ${build_duration}s ($(date -ud 
@${build_duration} +'%M:%S'))"
-        echo "Total time:                    ${total_duration}s ($(date -ud 
@${total_duration} +'%M:%S'))"
         echo "========================================="
+        du -h "$ARTIFACT_DIR"/*
+      shell: bash
+
+    - name: Upload archived Rust tests
+      if: inputs.task == 'test-build'
+      uses: actions/upload-artifact@v7
+      with:
+        name: rust-nextest-archive-${{ github.run_id }}-${{ github.run_attempt 
}}
+        path: ${{ runner.temp }}/rust-nextest-archive
+        compression-level: 0
+        if-no-files-found: error
+        retention-days: 1
+
+    - name: Download archived Rust tests
+      if: startsWith(inputs.task, 'test-run-')
+      uses: actions/download-artifact@v8
+      with:
+        name: rust-nextest-archive-${{ github.run_id }}-${{ github.run_attempt 
}}
+        path: ${{ runner.temp }}/rust-nextest-archive
+
+    - name: Run archived tests with coverage
+      if: startsWith(inputs.task, 'test-run-')
+      run: |
+        TASK="${{ inputs.task }}"
+        if [[ ! "$TASK" =~ ^test-run-([0-9]+)$ ]]; then
+          echo "::error::Invalid archived test task: $TASK"
+          exit 1
+        fi
+        PARTITION_INDEX="${BASH_REMATCH[1]}"
+        ARTIFACT_DIR="${RUNNER_TEMP}/rust-nextest-archive"
+        NEXTEST_FILTER=$(cat "$ARTIFACT_DIR/nextest-filter.txt")
+
+        mkdir -p target/debug
+        tar -C target/debug -xf "$ARTIFACT_DIR/connector-plugins.tar"
+        tar -C target/debug -xzf "$ARTIFACT_DIR/runtime-binaries.tar.gz"
+
+        RUNTIME_BINARIES=(
+          iggy
+          iggy-server
+          iggy-server-ng
+          iggy-connectors
+          iggy-mcp
+          iggy-bench
+        )
+        CARGO_BIN_ENV=()
+        for binary in "${RUNTIME_BINARIES[@]}"; do
+          binary_path="${GITHUB_WORKSPACE}/target/debug/${binary}"
+          if [[ ! -x "$binary_path" ]]; then
+            echo "::error::Required test runtime binary not found after 
extraction: ${binary_path}"
+            exit 1
+          fi
+          CARGO_BIN_ENV+=("CARGO_BIN_EXE_${binary}=${binary_path}")
+        done
+
+        source <(cargo llvm-cov show-env --sh)
+
+        if [[ "$RUNNER_OS" == "Linux" ]]; then
+          sudo sysctl -w vm.max_map_count=2000000 || true
+          eval "$(dbus-launch --sh-syntax)"
+          export DBUS_SESSION_BUS_ADDRESS
+          eval "$(echo -n "test" | gnome-keyring-daemon --unlock 
--components=secrets)"
+          echo -n "warmup" | secret-tool store --label="ci-warmup" ci-test 
warmup
+        fi
+
+        test_start=$(date +%s)
+        env "${CARGO_BIN_ENV[@]}" cargo nextest run \
+          --archive-file "$ARTIFACT_DIR/rust-tests.tar.zst" \
+          --extract-to "$GITHUB_WORKSPACE" \
+          --extract-overwrite \
+          --workspace-remap "$GITHUB_WORKSPACE" \
+          --no-fail-fast \
+          --profile ci \
+          --partition "hash:${PARTITION_INDEX}/2" \
+          -E "$NEXTEST_FILTER"
+        test_end=$(date +%s)
+        test_duration=$((test_end - test_start))
+        echo "::notice::Partition ${PARTITION_INDEX}/2 executed in 
${test_duration}s ($(date -ud @${test_duration} +'%M:%S'))"
 
         cargo llvm-cov report --codecov --output-path codecov.json

Review Comment:
   I’ve updated the PR description and added `test-partition-count` input to 
remove the hardcoded partition count.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to