-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (57 loc) · 1.74 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
name: CI Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: ./.github/actions/lint-terraform-svchost
copywrite:
name: Run Header Copyright
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Install Copywrite
id: install
uses: hashicorp/setup-copywrite@v1.1.2
- name: Output Installed Copywrite Version
run: echo "Installed Copywrite CLI ${{steps.install.outputs.version}}"
- name: Run Copywrite Header Compliance
run: copywrite headers --plan
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Set up Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: go.mod
cache: true
- name: Get dependences
run: go mod download
- name: Verify go.mod and go.sum are consistent
run: go mod tidy
- name: Ensure nothing changed
run: git diff --exit-code
- name: Check format
run: |
go fmt ./...
if [[ -z "$(git status --porcelain)" ]]; then
echo "Formatting is consistent with 'go fmt'."
else
echo "Run 'go fmt ./...' to automatically apply standard Go style to all packages."
git status --porcelain
exit 1
fi
- name: Run tests
run: go test -v -race ./...