-
Notifications
You must be signed in to change notification settings - Fork 9
146 lines (120 loc) · 4.26 KB
/
ci.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
name: CI
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
test:
if: github.event_name == 'pull_request'
name: Test
timeout-minutes: 15
continue-on-error: false
runs-on: ubuntu-20.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go release
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: "**/go.sum"
- name: Download Go modules
run: |
pushd tools && go mod download -x
popd && go mod download -x
- name: Install development tools
run: make init
- name: Build binaries
run: make build
- name: Run tests
run: |
go clean -testcache
PMM_DUMP_MAX_PARALLEL_TESTS=3 make run-tests
# TODO: Add codecoverage
# - name: Upload coverage results
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: crosscover.out
# flags: crosscover
# fail_ci_if_error: false
- name: Check that there are no source code changes
run: |
# Break job if any files were changed during its run (code generation, etc), except go.sum.
# `go mod tidy` could remove old checksums from that file, and that's okay on CI,
# and actually expected for PRs made by @dependabot.
# Checksums of actually used modules are checked by previous `go` subcommands.
pushd tools && go mod tidy -v && git checkout go.sum
popd && go mod tidy -v && git checkout go.sum
git diff --exit-code
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status
check:
name: Check
timeout-minutes: 10
if: github.event_name == 'pull_request'
continue-on-error: false
runs-on: ubuntu-20.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go release
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: "**/go.sum"
- name: Download Go modules
run: |
pushd tools && go mod download -x
popd && go mod download -x
- name: Install tools
run: make init
- name: Build binaries
run: make build
- name: Format sources
run: make format
- name: Run check-license
run: |
# run license checker on configured files
bin/license-eye -c .licenserc.yaml header check
- name: Run checks/linters
run: |
# use GITHUB_TOKEN because only it has access to GitHub Checks API
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=nofilter -fail-on-error=true
# run it like that until some of those issues/PRs are resolved:
# * https://github.com/quasilyte/go-consistent/issues/33
# * https://github.com/golangci/golangci-lint/issues/288
# * https://github.com/reviewdog/errorformat/pull/47 (once it is actually used by reviewdog)
bin/go-consistent -exclude=tools -pedantic ./...
- name: Check that there are no source code changes
run: |
# Break job if any files were changed during its run (tools installation, etc), except go.sum.
# `go mod tidy` could remove old checksums from that file, and that's okay on CI,
# and actually expected for PRs made by @dependabot.
# Checksums of actually used modules are checked by previous `go` subcommands.
pushd tools && go mod tidy -v && git checkout go.sum
popd && go mod tidy -v && git checkout go.sum
git diff --exit-code
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status