-
Notifications
You must be signed in to change notification settings - Fork 6
63 lines (51 loc) · 1.55 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
name: CI Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
copywrite:
name: Run Header Copyright
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- 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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- 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 ./...