-
Notifications
You must be signed in to change notification settings - Fork 298
the ability to automatically run unit tests after creating a pull request. #764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
the ability to automatically run unit tests after creating a pull request. #764
Conversation
看下 CI 问题 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
There was a problem hiding this comment.
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 adds a dedicated unit-test workflow and cleans up the existing build workflow to separate unit tests and coverage reporting.
- Introduces a new
.github/workflows/unit-test.yml
to run unit tests with coverage and archive results. - Updates
.github/workflows/build.yml
to focus on build-only, removing prior test and codecov steps. - Aligns CI jobs with PR events and push-to-master triggers.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
.github/workflows/unit-test.yml | New workflow for Go unit tests, coverage profile generation, and artifact upload. |
.github/workflows/build.yml | Renames workflow and removes test/coverage steps to preserve integration tests elsewhere. |
Comments suppressed due to low confidence (3)
.github/workflows/build.yml:60
- Removing the test and Codecov steps from the build workflow means no tests run on push. Ensure integration tests are moved to a separate workflow or re-add necessary test steps.
- - name: "run go test and out codecov"
.github/workflows/unit-test.yml:76
- [nitpick] The artifact is actually a coverage profile; consider renaming
test-results
to something likecoverage-profile
for clarity.
name: test-results
.github/workflows/unit-test.yml:18
- [nitpick] The workflow name is singular; consider using
Unit Tests
to match plural naming and reflect multiple tests being run.
name: "Unit Test"
fi | ||
echo "✅ Unit tests completed successfully" | ||
|
||
- name: "Archive test results" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions uploading coverage to Codecov, but there’s no codecov/codecov-action
step in this workflow. Add a step after archiving to upload coverage.txt
to Codecov.
Copilot uses AI. Check for mistakes.
go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m | ||
if [ $? -ne 0 ]; then | ||
echo "❌ Unit tests failed" | ||
exit 1 | ||
fi | ||
echo "✅ Unit tests completed successfully" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This explicit exit check is redundant—GitHub Actions will fail on a non-zero exit by default. Consider simplifying by running go test ...
directly.
go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m | |
if [ $? -ne 0 ]; then | |
echo "❌ Unit tests failed" | |
exit 1 | |
fi | |
echo "✅ Unit tests completed successfully" | |
go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m && echo "✅ Unit tests completed successfully" |
Copilot uses AI. Check for mistakes.
What this PR does:
Which issue(s) this PR fixes:
Fixes #762
Special notes for your reviewer:
.github/workflows/unit-test.yml