-
Notifications
You must be signed in to change notification settings - Fork 45
119 lines (105 loc) · 4.59 KB
/
sonar-scan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Static analysis
on:
push:
branches:
- develop
pull_request:
jobs:
wait_for_workflows:
name: Wait for workflows
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout Repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Wait for Workflows
id: wait
uses: smartcontractkit/chainlink-github-actions/utils/wait-for-workflows@b49a9d04744b0237908831730f8553f26d73a94b # v2.3.17
with:
max-timeout: "1200"
polling-interval: "30"
exclude-workflow-names: "Lint GH Workflows,e2e_tests_custom_cl"
exclude-workflow-ids: ""
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
DEBUG: "true"
tools:
name: Get tool-versions
runs-on: ubuntu-latest
steps:
- name: Check out Code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Parse tool-versions file
uses: smartcontractkit/[email protected]
id: tool-versions
outputs:
go-version: ${{ steps.tool-versions.outputs.golang_version }}
golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }}
sonarqube:
name: SonarQube Scan
needs: [wait_for_workflows]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Fetch blame information
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports
- name: Download Golangci integration tests reports
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
workflow: golangci-lint.yml
workflow_conclusion: ""
name_is_regexp: true
name: golangci-lint-integration-tests-report
if_no_artifact_found: warn
- name: Download Golangci relay reports
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
workflow: golangci-lint.yml
workflow_conclusion: ""
name_is_regexp: true
name: golangci-lint-relay-report
if_no_artifact_found: warn
- name: Download Relayer unit tests report
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
workflow: relay.yml
workflow_conclusion: ""
name_is_regexp: true
name: go-relay-test-results
if_no_artifact_found: warn
- name: Download gauntlet eslint reports
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
workflow: gauntlet.yml
workflow_conclusion: ""
name_is_regexp: true
name: gauntlet-eslint-report
if_no_artifact_found: warn
- name: Set SonarQube Report Paths
id: sonarqube_report_paths
shell: bash
run: |
{
echo "sonarqube_tests_report_paths=$(find . -type f -name output.txt | paste -sd "," -)"
echo "sonarqube_coverage_report_paths=$(find . -type f -name '*coverage.txt' | paste -sd "," -)"
echo "sonarqube_golangci_report_paths=$(find . -type f -name 'golangci-*-report.xml' -printf "%p,")"
echo "sonarqube_eslint_report_paths=$(find -type f -name 'eslint-report.json' -printf "%p")" >> $GITHUB_OUTPUT
} >> "$GITHUB_OUTPUT"
- name: Update ESLint report symlinks
continue-on-error: true
run: sed -i 's+/home/runner/work/feeds-manager/feeds-manager/+/github/workspace/+g' ${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }}
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@53c3e3207fe4b8d52e2f1ac9d6eb1d2506f626c0 # v2.0.2
with:
args: >
-Dsonar.go.tests.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_tests_report_paths }}
-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 }}
-Dsonar.eslint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}