-
Notifications
You must be signed in to change notification settings - Fork 698
50 lines (45 loc) · 1.62 KB
/
test-go.yaml
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
name: Go generate Test
on:
- push
- pull_request
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/go
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator/go.mod
- name: Check Go modules
run: |
go mod tidy && git add go.* &&
git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1);
- name: Check manifests
run: |
make manifests && git add manifests &&
git diff --cached --exit-code || (echo 'Please run "make manifests" to generate manifests' && exit 1);
- name: Check auto-generated codes
run: |
make generate && git add pkg sdk &&
git diff --cached --exit-code || (echo 'Please run "make generate" to generate Go codes' && exit 1);
- name: Verify gofmt
run: |
make fmt && git add pkg cmd &&
git diff --cached --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1);
- name: Verify govet
run: |
make vet && git add pkg cmd &&
git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1);
- name: Verify golint
run: |
make golangci-lint