-
Notifications
You must be signed in to change notification settings - Fork 3
45 lines (36 loc) · 1.15 KB
/
unit-tests.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
name: Unit Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
test:
name: Run Unit Tests
runs-on: ${{ vars.RUNNER_RUNS_ON }} # settings > secrets and variables > variables > RUNNER_RUNS_ON
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #v5.3.0
with:
go-version: ${{ vars.GO_VERSION }} # settings > secrets and variables > variables > GO_VERSION
cache: true
cache-dependency-path: |
**/go.mod
**/go.sum
- name: Install dependencies
run: go mod download
- name: Run Unit Tests
run: |
go test -v -race -coverprofile=coverage.out ./...
- name: Upload Coverage Report to SonarCloud
uses: sonarsource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 #v4.2.1
with:
args: >
-Dsonar.token=${{ secrets.MAGALUBOT_SONAR_TOKEN }}