-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (72 loc) · 2.36 KB
/
build-client.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
name: k8ssandra-client build and deploy
on:
push:
branches:
- main
pull_request:
branches: [ main ]
jobs:
build_and_test:
name: Unit testing and linting
runs-on: ubuntu-latest
env:
CGO_ENABLED: 0
steps:
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
# GHA requires longer timeout
args: --timeout=10m
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: ${{ github.event_name == 'pull_request' }}
skip-pkg-cache: true
skip-build-cache: true
- name: Unit Tests
run: |
make test
build_docker_image:
name: Build k8ssandra-client Docker Image
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set git parsed values
id: vars
run: |
echo ::set-output name=sha_short::$(git rev-parse --short=8 ${{ github.sha }})
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/}
mkdir -p build/
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
load: false
file: cmd/kubectl-k8ssandra/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: k8ssandra/k8ssandra-client:${{ steps.vars.outputs.sha_short }}
platforms: linux/amd64,linux/arm64
context: .
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache