-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (76 loc) · 2.54 KB
/
code-health.yml
File metadata and controls
81 lines (76 loc) · 2.54 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
name: 'Code Health'
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
with:
go-version-file: 'go.mod'
- name: Build
run: make build
- name: Unit Test
run: make test
e2e:
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
with:
go-version-file: 'go.mod'
- name: setup Atlas CLI
uses: mongodb/atlas-github-action@e3c9e0204659bafbb3b65e1eb1ee745cca0e9f3b
- name: E2E Test
run: make test-e2e
lint:
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
with:
go-version-file: 'go.mod'
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20
with:
version: v2.10.0 # Also update GOLANGCI_VERSION variable in Makefile when updating this version
- name: actionlint
run: |
make tools
echo "::add-matcher::.github/actionlint-matcher.json"
actionlint -color
shell: bash
- name: shellcheck
uses: bewuethr/shellcheck-action@80bac2daa9fcf95d648200a793d00060857e6dc4
check-go-files:
runs-on: ubuntu-latest
permissions: {}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
with:
go-version-file: 'go.mod'
- run: go mod tidy
- run: go fix ./...
- name: Find mutations
id: self_mutation
run: |-
git add .
git diff --staged --patch --exit-code > doc.repo.patch || echo "self_mutation_happened=true" >> "${GITHUB_OUTPUT}"
- name: Fail build on mutation
if: steps.self_mutation.outputs.self_mutation_happened
run: |-
echo "::error::Files were changed. Make sure to run 'go mod tidy' and 'go fix ./...'"
cat doc.repo.patch
exit 1