-
Notifications
You must be signed in to change notification settings - Fork 972
116 lines (109 loc) · 3.11 KB
/
ci.yaml
File metadata and controls
116 lines (109 loc) · 3.11 KB
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
name: CI
on:
push:
branches:
- main
- release-v*
pull_request:
branches:
- main
- release-v*
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
ci:
name: Continuous Integration
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set-up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
- run: make build -o lintcheck # Stop running `make lintcheck` before build. Linting is handled separately
- run: make test
lint-new:
name: Strict linting of new code
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
permissions:
contents: read
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set-up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- run: make .golangci.new.yml
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
only-new-issues: true
args: --config=.golangci.new.yml
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set-up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- name: Set-up Terraform
uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1
with:
terraform_version: latest
terraform_wrapper: false
- run: make checkdocs
- run: make validatedocs
- uses: rvben/rumdl@73f3a8c02f7b513546ca67df3a1e1c9702062b5d # v0.1.96
with:
path: ./docs
report-type: annotations
check:
name: Check
needs:
- ci
- docs
- lint-new
if: always()
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check
run: |
set -euo pipefail
results=( ${{ join(needs.*.result, ' ') }} )
for result in "${results[@]}"; do
if [[ "${result}" == "failure" ]] || [[ "${result}" == "cancelled" ]]; then
echo "::error::Workflow failed!"
exit 1
fi
done