forked from kubeflow/training-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.47 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
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
82
83
84
85
86
name: Unit and Integration Test - Go
on:
- push
- pull_request
jobs:
generate:
name: Generate
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/go
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator/go.mod
- name: Check Go modules
run: |
go mod tidy
git diff --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1);
- name: Check auto-generated assets
run: |
make generate
git diff --exit-code || (echo 'Please run "make generate" to generate assets' && exit 1);
- name: Check go fmt
run: |
make fmt
git diff --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1);
- name: Check go fmt
run: |
make vet
git diff --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1);
- name: Check golangci lint
run: |
make golangci-lint
test:
name: Test
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/go
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
strategy:
fail-fast: false
matrix:
# Kubernetes versions for setup-envtest integration tests.
kubernetes-version: ["1.29.3", "1.30.0", "1.31.0"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator/go.mod
- name: Run Go unit tests
run: |
make test
- name: Run Go integration tests
run: |
make test-integration ENVTEST_K8S_VERSION=${{ matrix.kubernetes-version }}
- name: Coveralls report
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: cover.out
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/training-operator
parallel: true