-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (57 loc) · 1.64 KB
/
build.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
name: Build, Test and Verify
on:
push:
branches:
- '**'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.20.0'
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get version number
id: get_version
run: echo ::set-output name=VERSION::$(git describe --tags --match "v*" --always --dirty)
- name: Run build
run: go build .
- name: golangci-lint
uses: gessnerfl/golangci-lint-action@master
continue-on-error: true
with:
skip-cache: true
output-file: checkstyle:golangci-lint-report.xml
- name: Run testing
run: |
set -euo pipefail
go test -json -v ./... -cover -coverprofile=coverage.out 2>&1 | tee unit-test-report.json | gotestfmt
set +euo pipefail
- name: Upload test log
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-report
path: unit-test-report.json
if-no-files-found: error
# - name: Run sonar
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# with:
# args: >
# -Dsonar.projectVersion=${{ steps.get_version.outputs.VERSION }}