-
Notifications
You must be signed in to change notification settings - Fork 18
85 lines (80 loc) · 2.17 KB
/
ci.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
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test-unit:
runs-on: ubuntu-latest
container:
image: golang:1.22.5-bookworm
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run unit tests
env:
TEST_GIT_CLIENT_WITH_AUTH: true
run: make test-unit
- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-latest
container:
image: golang:1.22.5-bookworm
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
env:
GOFLAGS: -buildvcs=false
with:
version: v1.57.2
build-image:
needs: [test-unit, lint]
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout code
uses: actions/checkout@v4
- name: Build base image
run: |
make build-base-image
docker tag kargo-render-base:latest-arm64 localhost:5000/kargo-render-base:latest-arm64
docker push localhost:5000/kargo-render-base:latest-arm64
docker tag kargo-render-base:latest-amd64 localhost:5000/kargo-render-base:latest-amd64
docker push localhost:5000/kargo-render-base:latest-amd64
- name: Build final image
uses: docker/build-push-action@v6
with:
build-args: |
BASE_IMAGE=localhost:5000/kargo-render-base
platforms: linux/amd64,linux/arm64
push: false
cache-from: type=gha
cache-to: type=gha,mode=max