Skip to content

Commit

Permalink
fix/lint-action: trying json lint artifact to make parsing file name …
Browse files Browse the repository at this point in the history
…and errors easier
  • Loading branch information
patrickhuie19 committed Nov 16, 2023
1 parent 12d9e48 commit 565492b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/golangci_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ jobs:
- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2

# go.work makes it necessary to run linter manually
- name: Run golangci-lint
run: find . -name "go.mod" -execdir $(go env GOPATH)/bin/golangci-lint run --enable=gofmt --tests=false --exclude-use-default --timeout=5m0s --out-format checkstyle:golangci-lint-report.xml \;
- name: Check golangci-lint report for errors
run: find . -name "golangci-lint-report.xml" -exec grep "error" {} + && exit 1 || true
run: find . -name "go.mod" -execdir $(go env GOPATH)/bin/golangci-lint run --enable=gofmt --tests=false --exclude-use-default --timeout=5m0s --out-format json > golangci-lint-results.json \;

- name: Check golangci-lint JSON report for errors
run: if jq -e '.Issues[]' golangci-lint-results.json > /dev/null; then exit 1; else echo "No issues found"; fi

- name: Upload golangci-lint report
- name: Upload golangci-lint JSON report
if: always()
uses: actions/upload-artifact@v3
with:
name: golangci-lint-report
path: |
./golangci-lint-report.xml
name: golangci-lint-json-report
path: ./golangci-lint-results.json
4 changes: 2 additions & 2 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
workflow: golangci_lint.yml
workflow_conclusion: ""
name_is_regexp: true
name: golangci-lint-report
name: golangci-lint-json-report
if_no_artifact_found: warn

- name: Download Go PKG test reports
Expand All @@ -61,7 +61,7 @@ jobs:
shell: bash
run: |
echo "sonarqube_coverage_report_paths=$(find -type f -name '*coverage.out' -printf "%p,")" >> $GITHUB_OUTPUT
echo "sonarqube_golangci_report_paths=$(find -type f -name 'golangci-lint-report.xml' -printf "%p,")" >> $GITHUB_OUTPUT
echo "sonarqube_golangci_report_paths=$(find -type f -name 'golangci-lint-results.json' -printf "%p,")" >> $GITHUB_OUTPUT
- name: SonarQube Scan
if: always()
Expand Down

0 comments on commit 565492b

Please sign in to comment.