-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (75 loc) · 2.35 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
69
70
71
72
73
74
75
76
77
78
name: Build
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
defaults:
run:
shell: bash
jobs:
build:
name: Test with ${{ matrix.go-version }} on ${{ matrix.vm-os }}
runs-on: ${{ matrix.vm-os }}
env:
CI_REPORT: ${{ matrix.vm-os == 'ubuntu-20.04' && matrix.go-version == '1.18.10' }}
strategy:
max-parallel: 10
fail-fast: false
matrix:
vm-os: [
ubuntu-20.04,
macos-13,
windows-2022
]
go-version: [
1.18.10,
1.19.13,
1.20.12,
1.21.5,
]
# Steps to execute
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Go Build
run: |
export
git status
go version
go mod download
make --version
- name: Test
run: |
make ci
make build
- name: Upload Coverage Reports to Codecov
if: ${{ fromJSON(env.CI_REPORT) }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt
- name: Upload Coverage Reports to Codacy
if: ${{ fromJSON(env.CI_REPORT) }}
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run:
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --force-coverage-parser go -r coverage.txt
- name: Analyze
if: ${{ runner.os == 'Linux' }}
run: |
# tokei -- count
wget -cqL https://github.com/XAMPPRocky/tokei/releases/download/v12.1.2/tokei-i686-unknown-linux-musl.tar.gz -O tokei.tgz
tar zxf tokei.tgz tokei && chmod +x tokei && $SUDO mv tokei /usr/local/bin && rm tokei.tgz
echo "=== Tokei Result ==="
tokei
# revive -- lint
wget -cqL https://github.com/mgechev/revive/releases/download/v1.2.4/revive_1.2.4_Linux_x86_64.tar.gz -O revive.tgz
tar zxf revive.tgz revive && chmod +x revive && $SUDO mv revive /usr/local/bin && rm revive.tgz
wget -cqL https://bitbucket.org/ai69/common/raw/master/revive.toml -O revive.toml
echo "=== Revive Result ==="
revive -config revive.toml -formatter friendly ./...