-
-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (67 loc) · 2.03 KB
/
on-pr-open-update.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
name: On PR Open/Update
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
- beta
pull_request:
branches:
- main
- beta
jobs:
pr-checks:
name: Code Quality & Reliability Checks
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
pull-requests: read
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Clean Up SonarQube Comments
if: ${{ github.event.number }}
uses: izhangzhihao/delete-comment@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_user_name: sonarcloud[bot]
issue_number: ${{ github.event.number }}
- name: Install go
uses: actions/setup-go@v5
with:
go-version-file: "./go.mod"
- name: Linting check
uses: golangci/golangci-lint-action@v4
with:
install-mode: goinstall
version: latest
args: --out-format=checkstyle:lint-report.out
- name: Run Unit Tests and get Coverage
run: make coverage
- name: PR SonarQube Scan
if: ${{ github.event_name == 'pull_request' }}
uses: sonarsource/sonarqube-scan-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
with:
args: >
-Dsonar.qualitygate.wait=true
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.key=${{ github.event.number }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
- name: Branch SonarQube Scan
if: ${{ github.event_name != 'pull_request' }}
uses: sonarsource/sonarqube-scan-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
with:
args: >
-Dsonar.qualitygate.wait=true
-Dsonar.branch.name=${{ github.ref_name }}