-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (38 loc) · 1.06 KB
/
build_test.yaml
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
name: Build and Test
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Install dependencies
run: go mod download
- name: Build the project
run: go build -v ./...
- name: Run tests without coverage
if: matrix.os != 'ubuntu-latest'
run: go test ./...
- name: Run tests with coverage
if: matrix.os == 'ubuntu-latest'
run: go test -cover -coverprofile=coverage.out ./...
- name: SonarQube Scan
if: matrix.os == 'ubuntu-latest'
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}