-
Notifications
You must be signed in to change notification settings - Fork 16
40 lines (33 loc) · 1003 Bytes
/
test.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
name: test
on: [pull_request]
jobs:
test:
strategy:
matrix:
go-version: [1.17.x, 1.18.x]
terraform-version: [0.12.x, 1.1.x]
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ matrix.terraform-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Cache modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Go Format
run: if [ "$(gofmt -l `find . -name '*.go' | grep -v vendor` | wc -l)" -gt 0 ]; then exit 1; fi
- name: Terraform Format
run: terraform fmt -recursive -check
- name: Test
run: go test ./...