Skip to content
Merged

213 #214

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ slow-timeout = { period = "60s", terminate-after = 2 }
retries = { backoff = "exponential", count = 2, delay = "1s" }
# Fail fast disabled to see all failures
fail-fast = false

# Enable JUnit XML output for Codecov Test Analytics
[profile.ci.junit]
path = "target/nextest/ci/junit.xml"
path = "junit.xml"
# Store output for failed tests only
store-success-output = false
store-failure-output = true
Expand Down
34 changes: 26 additions & 8 deletions .github/actions/cargo-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
description: "Additional arguments passed to cargo test"
required: false
default: ""
nextest-profile:
description: "Nextest profile to use (empty = use regular cargo test)"
required: false
default: ""
runs:
using: "composite"
steps:
Expand All @@ -30,19 +34,33 @@ runs:
ALL_FEATURES: ${{ inputs.all-features }}
NO_FAIL_FAST: ${{ inputs.no-fail-fast }}
EXTRA_ARGS: ${{ inputs.extra-args }}
NEXTEST_PROFILE: ${{ inputs.nextest-profile }}
run: |
set -euo pipefail
args=("--workspace")
if [ "${ALL_FEATURES}" = "true" ]; then
args+=("--all-features")
fi
if [ "${NO_FAIL_FAST}" = "true" ]; then
args+=("--no-fail-fast")
fi
if [ -n "${EXTRA_ARGS}" ]; then
# shellcheck disable=SC2206
extra_parts=(${EXTRA_ARGS})
args+=("${extra_parts[@]}")

if [ -n "${NEXTEST_PROFILE}" ]; then
# Use cargo-nextest with specified profile
args+=("--profile" "${NEXTEST_PROFILE}")
if [ -n "${EXTRA_ARGS}" ]; then
# shellcheck disable=SC2206
extra_parts=(${EXTRA_ARGS})
args+=("${extra_parts[@]}")
fi
cargo +"${TOOLCHAIN}" nextest run "${args[@]}"
else
# Use regular cargo test
if [ "${NO_FAIL_FAST}" = "true" ]; then
args+=("--no-fail-fast")
fi
if [ -n "${EXTRA_ARGS}" ]; then
# shellcheck disable=SC2206
extra_parts=(${EXTRA_ARGS})
args+=("${extra_parts[@]}")
fi
cargo +"${TOOLCHAIN}" test "${args[@]}"
fi
cargo +"${TOOLCHAIN}" test "${args[@]}"

92 changes: 29 additions & 63 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ jobs:
key: test-${{ matrix.rust }}
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install cargo-nextest
if: matrix.rust == needs.msrv.outputs.version
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: Verify lockfile is committed
if: matrix.rust == needs.msrv.outputs.version
shell: bash
Expand Down Expand Up @@ -301,34 +307,34 @@ jobs:
labels: ci, chore
delete-branch: true

- name: Tests (${{ matrix.rust }})
- name: Tests with nextest (${{ matrix.rust }})
if: matrix.rust == needs.msrv.outputs.version
uses: ./.github/actions/cargo-test
with:
toolchain: ${{ matrix.rust }}
all-features: ${{ inputs.all-features }}
nextest-profile: ci

- name: Generate test report (JSON format)
if: always()
continue-on-error: true
shell: bash
run: |
cargo +${{ matrix.rust }} test --all-features --workspace --no-fail-fast -- \
--format json -Z unstable-options --report-time > test-results-${{ matrix.rust }}.json || true
- name: Tests (${{ matrix.rust }})
if: matrix.rust != needs.msrv.outputs.version
uses: ./.github/actions/cargo-test
with:
toolchain: ${{ matrix.rust }}
all-features: ${{ inputs.all-features }}

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
- name: Upload test results to Codecov
if: matrix.rust == needs.msrv.outputs.version && !cancelled()
uses: codecov/test-results-action@v1
with:
name: test-results-${{ matrix.rust }}
path: test-results-${{ matrix.rust }}.json
retention-days: 30
token: ${{ secrets.CODECOV_TOKEN }}

- name: Add test summary
if: always() && matrix.rust == needs.msrv.outputs.version
run: |
echo "## Test Results (${{ matrix.rust }})" >> $GITHUB_STEP_SUMMARY
echo "Test artifacts uploaded with 30-day retention" >> $GITHUB_STEP_SUMMARY
echo "- Test report: \`test-results-${{ matrix.rust }}.json\`" >> $GITHUB_STEP_SUMMARY
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- JUnit XML: \`target/nextest/ci/junit.xml\`" >> $GITHUB_STEP_SUMMARY
echo "- [View Test Analytics](https://app.codecov.io/gh/RAprogramm/masterror/tests)" >> $GITHUB_STEP_SUMMARY

- name: Auto-commit README changes (any branch)
if: always() && matrix.rust == needs.msrv.outputs.version
Expand Down Expand Up @@ -382,7 +388,6 @@ jobs:
needs: [test, validate-codecov-yaml]
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5

Expand All @@ -402,50 +407,16 @@ jobs:
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Generate coverage for all tests
- name: Generate coverage with nextest
run: |
cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info

- name: Validate coverage file
run: |
set -euo pipefail
echo "=== Validating LCOV file ==="
if [ ! -f "lcov.info" ]; then
echo "ERROR: lcov.info not found"
exit 1
fi
size=$(wc -c < "lcov.info")
lines=$(wc -l < "lcov.info")
echo "✓ lcov.info: ${size} bytes, ${lines} lines"
if [ "$size" -eq 0 ]; then
echo "ERROR: lcov.info is empty"
exit 1
fi
echo "First 10 lines:"
head -10 "lcov.info"

- name: Generate JUnit XML test results
if: success() || failure()
run: |
mkdir -p target/nextest/ci
cargo nextest run --all-features --workspace --profile ci --no-fail-fast || true

- name: "Codecov: Upload coverage"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
fail_ci_if_error: false
use_oidc: true
name: codecov-coverage
verbose: true

- name: "Codecov: Upload test results"
if: success() || failure()
uses: codecov/test-results-action@v1
with:
files: ./target/nextest/ci/junit.xml
use_oidc: true
name: codecov-test-results

- name: Generate HTML coverage report
run: cargo llvm-cov --all-features --workspace --html
Expand All @@ -459,20 +430,15 @@ jobs:
target/llvm-cov/html/
retention-days: 30

- name: Add Codecov summary
- name: Add coverage summary
run: |
echo "## Codecov Reports" >> $GITHUB_STEP_SUMMARY
echo "## Code Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Code Coverage" >> $GITHUB_STEP_SUMMARY
echo "- LCOV report: \`lcov.info\`" >> $GITHUB_STEP_SUMMARY
echo "- HTML report: \`target/llvm-cov/html/\`" >> $GITHUB_STEP_SUMMARY
echo "- [View Coverage Dashboard](https://app.codecov.io/gh/RAprogramm/masterror)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Test Analytics" >> $GITHUB_STEP_SUMMARY
echo "- JUnit XML: \`target/nextest/ci/junit.xml\`" >> $GITHUB_STEP_SUMMARY
echo "- [View Test Analytics](https://app.codecov.io/gh/RAprogramm/masterror/tests)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All artifacts uploaded with 30-day retention." >> $GITHUB_STEP_SUMMARY
echo "Coverage artifacts uploaded with 30-day retention." >> $GITHUB_STEP_SUMMARY

benchmarks:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,3 @@ assert_eq!(problem.grpc.expect("grpc").name, "UNAUTHENTICATED");

MSRV: **1.90** · License: **MIT OR Apache-2.0** · No `unsafe`


Loading