-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test workflow and update README.md
- Loading branch information
Showing
2 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Test gocyclo Analysis Reports | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "**/*.go" | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
test_gocyclo_analysis: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4.0.0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4.0.1 | ||
with: | ||
go-version-file: ./go.mod | ||
|
||
- name: Run Go tests | ||
run: | | ||
cd tests | ||
go test -v ./... | ||
- name: Run gocyclo Analysis Reports | ||
uses: ./ | ||
with: | ||
ignore_pattern: '_test|_mock|mock_|.pb.go|proto' | ||
over: '20' | ||
top: '10' | ||
id: gocyclo_analysis | ||
continue-on-error: true | ||
|
||
- name: Verify gocyclo report | ||
run: | | ||
# Example of a verification step | ||
# You can add checks here to verify that the report has been generated correctly | ||
if [ -f raw_gocyclo_output.txt ]; then | ||
echo "raw_gocyclo_output.txt exists." | ||
cat raw_gocyclo_output.txt | ||
else | ||
echo "raw_gocyclo_output.txt does not exist." | ||
exit 1 | ||
fi | ||
- name: Create a comment with the results | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
recreate: true | ||
header: gocyclo Report | ||
message: | | ||
${{ env.gocyclo_report }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters