1
- # 定义工作流的名称
2
1
name : CI
3
2
4
- on :
5
- workflow_dispatch : # 允许手动触发工作流
6
- push : # 当有代码推送事件发生时
7
- branches :
8
- - main # 只有推送到 main 分支时才触发
9
- tags :
10
- - ' *'
11
- pull_request :
3
+ on : ['push', 'pull_request']
12
4
13
-
14
- # 定义工作流的任务
15
5
jobs :
16
- build :
17
- # 定义运行此任务的环境:最新版本的 ubuntu
18
- runs-on : ubuntu-latest
19
-
20
- # 定义任务中的步骤
6
+ test :
7
+ runs-on : ubuntu-22.04
8
+ strategy :
9
+ matrix :
10
+ go-version : ['1.20', '1.21.x']
21
11
steps :
22
- # 检出代码。只检出最新的1次提交
23
- - uses : actions/checkout@v3
24
- with :
25
- fetch-depth : 1
26
-
27
- # 设置 QEMU 模拟器,这通常用于多平台的 Docker 构建
28
- - name : Set up QEMU
29
- uses : docker/setup-qemu-action@v2
12
+ - uses : actions/checkout@v3
13
+ with :
14
+ fetch-depth : 1
15
+ - uses : actions/checkout@v4
16
+ - name : Setup Go ${{ matrix.go-version }}
17
+ uses : actions/setup-go@v4
18
+ with :
19
+ go-version : ${{ matrix.go-version }}
20
+ - name : Display Go version
21
+ run : go version
22
+ - name : Install dependencies
23
+ run : go get ./...
24
+ - name : Test with Go
25
+ run : go test ./... -json > TestResults-${{ matrix.go-version }}.json
26
+ - name : Upload Go test results
27
+ uses : actions/upload-artifact@v4
28
+ with :
29
+ name : Go-results-${{ matrix.go-version }}
30
+ path : TestResults-${{ matrix.go-version }}.json
30
31
31
- # 设置 Docker Buildx,用于构建多平台的 Docker 镜像
32
- - name : Set up Build
33
- uses : docker/setup-buildx-action@v2
34
- - run : |
35
- make build
36
-
37
32
linting :
38
33
name : Lint Code Base
39
- runs-on : ubuntu-latest
34
+ runs-on : ubuntu-22.04
40
35
steps :
41
- - name : Checkout Code
42
- uses : actions/checkout@v3
43
- with :
44
- # Full git history is needed to get a proper list of changed files within `super-linter`
45
- fetch-depth : 0
46
- - name : Lint Code Base
47
- uses : github/super-linter@v4
48
- env :
49
- VALIDATE_MARKDOWN : true
50
- VALIDATE_ALL_CODEBASE : false
51
- DEFAULT_BRANCH : main
52
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36
+ - name : Checkout Code
37
+ uses : actions/checkout@v3
38
+ with :
39
+ fetch-depth : 0
40
+ - name : Lint Code Base
41
+ uses : github/super-linter@v4
42
+ env :
43
+ VALIDATE_MARKDOWN : true
44
+ VALIDATE_ALL_CODEBASE : false
45
+ DEFAULT_BRANCH : main
46
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47
+ LINTER_RULES_PATH : /
48
+ MARKDOWN_CONFIG_FILE : .markdownlint.yml
53
49
54
- LINTER_RULES_PATH : /
55
- MARKDOWN_CONFIG_FILE : .markdownlint.yml
56
-
57
- main :
58
- if : github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'zncdata-labs/hive-metastore-operator'
59
- runs-on : ubuntu-latest
50
+ deploy-quay :
51
+ if : github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'zncdata-labs/spark-k8s-operator'
52
+ runs-on : ubuntu-22.04
60
53
needs :
61
- - build
62
- - linting
63
-
64
- steps :
65
- # 检出代码。只检出最新的1次提交
66
- - uses : actions/checkout@v3
67
- with :
68
- fetch-depth : 1
69
-
70
- # 登录到 QUAY Hub
71
- - name : Login to quay.io
72
- uses : docker/login-action@v2
73
- with :
74
- registry : quay.io
75
- username : ${{ secrets.QUAY_USERNAME }} # 使用存储在 GitHub Secrets 中的 QUAY 用户名
76
- password : ${{ secrets.QUAY_PASSWORD }} # 使用存储在 GitHub Secrets 中的 QUAY 密码
77
-
78
- - name : Build and push Docker image
79
- run : |
80
- make docker-buildx
81
- make bundle
82
- make bundle-buildx
83
-
84
- tags :
85
- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'zncdata-labs/hive-metastore-operator'
86
- runs-on : ubuntu-latest
87
- needs :
88
- - build
89
- - linting
90
-
54
+ - test
55
+ - linting
91
56
steps :
92
- # 检出代码。只检出最新的1次提交
93
- - uses : actions/checkout@v3
94
- with :
95
- fetch-depth : 1
57
+ - uses : actions/checkout@v3
58
+ with :
59
+ fetch-depth : 1
60
+ - name : Set up QEMU
61
+ uses : docker/setup-qemu-action@v3
62
+ - name : Set up Docker Buildx
63
+ uses : docker/setup-buildx-action@v3
64
+ - name : Login to quay.io
65
+ uses : docker/login-action@v2
66
+ with :
67
+ registry : quay.io
68
+ username : ${{ secrets.QUAY_USERNAME }}
69
+ password : ${{ secrets.QUAY_PASSWORD }}
96
70
97
- # 登录到 QUAY Hub
98
- - name : Login to quay.io
99
- uses : docker/login-action@v2
100
- with :
101
- registry : quay.io
102
- username : ${{ secrets.QUAY_USERNAME }} # 使用存储在 GitHub Secrets 中的 QUAY 用户名
103
- password : ${{ secrets.QUAY_PASSWORD }} # 使用存储在 GitHub Secrets 中的 QUAY 密码
71
+ - name : Build and push operator
72
+ run : |
73
+ make docker-buildx
104
74
105
- - name : Build and push Docker image
106
- run : |
107
- export VERSION=$GITHUB_REF_NAME
108
- make docker-buildx
109
- make bundle
110
- make bundle-buildx
75
+ - name : Build and push operator bundle
76
+ run : |
77
+ make bundle
78
+ make bundle-buildx
0 commit comments