Skip to content

Commit 312510e

Browse files
authored
ci: change deploy condition (#22)
1 parent 2bb9734 commit 312510e

File tree

2 files changed

+60
-10
lines changed

2 files changed

+60
-10
lines changed

.github/workflows/ci.yml

+57-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: CI
33
on: ['push', 'pull_request']
44

55
jobs:
6-
test:
6+
7+
golang-test:
8+
name: Golang Test
79
runs-on: ubuntu-22.04
810
strategy:
911
matrix:
@@ -29,8 +31,51 @@ jobs:
2931
name: Go-results-${{ matrix.go-version }}
3032
path: TestResults-${{ matrix.go-version }}.json
3133

32-
linting:
33-
name: Lint Code Base
34+
golang-lint:
35+
name: Golang Lint
36+
runs-on: ubuntu-22.04
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: actions/setup-go@v4
40+
with:
41+
go-version: '1.21'
42+
cache: false
43+
- name: golangci-lint
44+
uses: golangci/golangci-lint-action@v3
45+
with:
46+
# Require: The version of golangci-lint to use.
47+
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
48+
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
49+
version: v1.54
50+
51+
# Optional: working directory, useful for monorepos
52+
# working-directory: somedir
53+
54+
# Optional: golangci-lint command line arguments.
55+
#
56+
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
57+
# The location of the configuration file can be changed by using `--config=`
58+
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
59+
args: --timeout=30m
60+
61+
# Optional: show only new issues if it's a pull request. The default value is `false`.
62+
# only-new-issues: true
63+
64+
# Optional: if set to true, then all caching functionality will be completely disabled,
65+
# takes precedence over all other caching options.
66+
# skip-cache: true
67+
68+
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
69+
# skip-pkg-cache: true
70+
71+
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
72+
# skip-build-cache: true
73+
74+
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
75+
# install-mode: "goinstall"
76+
77+
markdown-lint:
78+
name: Markdown Lint
3479
runs-on: ubuntu-22.04
3580
steps:
3681
- name: Checkout Code
@@ -47,12 +92,14 @@ jobs:
4792
LINTER_RULES_PATH: /
4893
MARKDOWN_CONFIG_FILE: .markdownlint.yml
4994

50-
deploy-quay:
51-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'zncdata-labs/spark-k8s-operator'
95+
deploy-operator:
96+
name: Deploy operator
97+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'zncdata-labs'
5298
runs-on: ubuntu-22.04
5399
needs:
54-
- test
55-
- linting
100+
- golang-test
101+
- markdown-lint
102+
- golang-lint
56103
steps:
57104
- uses: actions/checkout@v3
58105
with:
@@ -61,6 +108,8 @@ jobs:
61108
uses: docker/setup-qemu-action@v3
62109
- name: Set up Docker Buildx
63110
uses: docker/setup-buildx-action@v3
111+
with:
112+
platforms: linux/amd64,linux/arm64
64113
- name: Login to quay.io
65114
uses: docker/login-action@v2
66115
with:
@@ -76,3 +125,4 @@ jobs:
76125
run: |
77126
make bundle
78127
make bundle-buildx
128+

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ bundle-build: ## Build the bundle image.
241241
bundle-buildx: ## Build the bundle image.
242242
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
243243
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' bundle.Dockerfile > bundle.Dockerfile.cross
244-
- docker buildx create --name project-v3-builder
244+
docker buildx create --name project-v3-builder
245245
docker buildx use project-v3-builder
246-
- docker buildx build --push --platform=$(PLATFORMS) --tag ${BUNDLE_IMG} -f bundle.Dockerfile.cross .
247-
- docker buildx rm project-v3-builder
246+
docker buildx build --push --platform=$(PLATFORMS) --tag ${BUNDLE_IMG} -f bundle.Dockerfile.cross .
247+
docker buildx rm project-v3-builder
248248
rm bundle.Dockerfile.cross
249249

250250
.PHONY: bundle-push

0 commit comments

Comments
 (0)