-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c9d4f5
commit 84fca2a
Showing
4 changed files
with
111 additions
and
87 deletions.
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
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,33 @@ | ||
name: Golangci-lint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
golangci-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
|
||
- 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.55.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: Print artifact | ||
run: cat golangci-lint-report.xml | ||
|
||
- name: Upload golangci-lint report | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: golangci-lint-report | ||
path: | | ||
./golangci-lint-report.xml |
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,75 @@ | ||
name: SonarQube Scan | ||
|
||
on: [push] | ||
|
||
jobs: | ||
wait_for_workflows: | ||
name: Wait for workflows | ||
runs-on: ubuntu-latest | ||
if: always() | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | ||
|
||
- name: Wait for workflows | ||
uses: smartcontractkit/chainlink-github-actions/utils/wait-for-workflows@main | ||
with: | ||
max-timeout: "900" | ||
polling-interval: "30" | ||
exclude-workflow-names: "" | ||
exclude-workflow-ids: "" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
DEBUG: "true" | ||
|
||
sonarqube: | ||
name: SonarQube Scan | ||
needs: [wait_for_workflows] | ||
runs-on: ubuntu-latest | ||
if: always() | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports | ||
|
||
- name: Download Golangci-lint report | ||
if: always() | ||
uses: dawidd6/action-download-artifact@v2.27.0 | ||
with: | ||
workflow: golangci_lint.yml | ||
workflow_conclusion: "" | ||
name_is_regexp: true | ||
name: golangci-lint-report | ||
if_no_artifact_found: warn | ||
|
||
- name: Download Go PKG test reports | ||
if: always() | ||
uses: dawidd6/action-download-artifact@v2.27.0 | ||
with: | ||
workflow: pkg.yml | ||
workflow_conclusion: "" | ||
name_is_regexp: true | ||
name: go-test-results | ||
if_no_artifact_found: warn | ||
|
||
- name: Set SonarQube Report Paths | ||
if: always() | ||
id: sonarqube_report_paths | ||
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 | ||
- name: SonarQube Scan | ||
if: always() | ||
uses: sonarsource/sonarqube-scan-action@a6ba0aafc293e03de5437af7edbc97f7d3ebc91a # v1.2.0 | ||
with: | ||
args: > | ||
-Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }} | ||
-Dsonar.go.golangci-lint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_golangci_report_paths }} | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
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