-
Notifications
You must be signed in to change notification settings - Fork 448
77 lines (67 loc) · 2.21 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
name: Go Test
on:
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
jobs:
generatetests:
name: Generate And Format Test
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/go
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/katib
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/github.com/kubeflow/katib
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: ${{ env.GOPATH }}/src/github.com/kubeflow/katib/go.mod
# Verify that go.mod and go.sum is synchronized
- 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: Run Generate And Go Format Test
run: |
go mod download &&
make check &&
git add pkg/apis hack/gen-python-sdk &&
git diff --cached --exit-code || (echo 'Please run "make check" to generate codes and to format Go codes' && exit 1)
unittests:
name: Unit Test
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/go
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/katib
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/github.com/kubeflow/katib
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: ${{ env.GOPATH }}/src/github.com/kubeflow/katib/go.mod
- name: Run Go test
run: go mod download && make test ENVTEST_K8S_VERSION=${{ matrix.kubernetes-version }}
- name: Coveralls report
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/katib
strategy:
fail-fast: false
matrix:
# Detail: `setup-envtest list --arch amd64`
kubernetes-version: ["1.23.5", "1.24.2", "1.25.0"]