Skip to content

Fix CI: stop workflow when build fails, skip artifact upload#1620

Merged
SteveL-MSFT merged 3 commits into
mainfrom
copilot/fix-build-failure-coverage-upload
Jul 10, 2026
Merged

Fix CI: stop workflow when build fails, skip artifact upload#1620
SteveL-MSFT merged 3 commits into
mainfrom
copilot/fix-build-failure-coverage-upload

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

When rust-tests failed, the workflow continued to package and upload artifacts (coverage, bin.tar) that were never produced, causing misleading CI failures downstream.

Changes

  • Removed continue-on-error: true from the rust-tests step in linux-build, macos-build, and windows-build jobs — default is already false
  • Removed if: always() from post-build steps (upload coverage, prepare artifact, upload artifact) in all three jobs — these now only run on success
  • Removed the "Fail if rust tests failed" step — was only needed as a workaround for the continue-on-error pattern; failures now naturally short-circuit the job

Before:

- name: Build and test with code coverage
  id: rust-tests
  continue-on-error: true        # allowed failure to propagate
  run: ./build.ps1 -Clippy -Test -CodeCoverage -ExcludePesterTests -Verbose
- name: Upload coverage data
  if: always()                   # ran even on build failure
  uses: actions/upload-artifact@v4

After:

- name: Build and test with code coverage
  id: rust-tests
  run: ./build.ps1 -Clippy -Test -CodeCoverage -ExcludePesterTests -Verbose
- name: Upload coverage data
  uses: actions/upload-artifact@v4

Remove `continue-on-error: true` and `if: always()` guards from
post-build steps (coverage upload, prepare artifact, upload artifact)
in linux-build, macos-build, and windows-build jobs.

Also remove the now-redundant "Fail if rust tests failed" step.
When rust-tests fails, the job now stops naturally without
attempting to package or upload artifacts.
Copilot AI changed the title [WIP] Fix code according to review comment on coverage upload Fix CI: stop workflow when build fails, skip artifact upload Jul 10, 2026
Copilot AI requested a review from SteveL-MSFT July 10, 2026 16:58
@github-actions

Copy link
Copy Markdown

Code Coverage Report

No Rust files were changed in this PR.

🔵 Full Codebase Coverage

81% (good)

Metric Value
Total executable lines 18050
Lines covered by tests 14772
Coverage percentage 81%

Full codebase coverage measures all instrumented Rust lines across the project.

@SteveL-MSFT SteveL-MSFT marked this pull request as ready for review July 10, 2026 17:38
Copilot AI review requested due to automatic review settings July 10, 2026 17:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Rust GitHub Actions workflow to correctly short-circuit jobs when the build/test step fails, preventing downstream steps from attempting to package or upload artifacts that were never produced.

Changes:

  • Removed continue-on-error: true from the rust-tests steps so failures stop the job normally.
  • Removed if: always() from artifact/coverage upload and packaging steps so they only run on successful builds.
  • Removed the explicit “Fail if rust tests failed” workaround step, since it’s no longer needed.

Comment thread .github/workflows/rust.yml
Comment thread .github/workflows/rust.yml
Comment thread .github/workflows/rust.yml
@SteveL-MSFT SteveL-MSFT merged commit 2b782e5 into main Jul 10, 2026
24 checks passed
@SteveL-MSFT SteveL-MSFT deleted the copilot/fix-build-failure-coverage-upload branch July 10, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants