-
Notifications
You must be signed in to change notification settings - Fork 80
92 lines (78 loc) · 2.49 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
86
87
88
89
90
91
92
name: For each commit and PR
on:
push:
branches:
- "*"
tags-ignore:
- "v*"
pull_request:
env:
REGISTRY: quay.io
IMAGE: quay.io/${{ github.repository }}
CGO_ENABLED: 0
GO_VERSION: "1.23"
jobs:
validation:
runs-on: ubuntu-latest
env:
CGO_ENABLED: 0
steps:
- name: Setup Dynamic Env
run: |
echo "MAKEFLAGS=-j$(nproc)" | tee $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Fetch Deps
run: |
# fixes "write /run/user/1001/355792648: no space left on device" error
sudo mount -o remount,size=3G /run/user/1001 || true
go get -t ./... && go mod tidy
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate all files
run: make -j1 gen
- name: Run all the tests
run: make ci
- name: upload codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: compile binaries
run: make crosscompile
- name: Figure out Docker Tags
id: docker-image-tag
run: |
echo ::set-output name=tags::${{ env.IMAGE }}:latest,${{ env.IMAGE }}:sha-${GITHUB_SHA::8}
- name: Login to quay.io
uses: docker/login-action@v3
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build Docker Images
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=${{ env.IMAGE }}:latest
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker-image-tag.outputs.tags }}
# looks just like Build Docker Images except with push:true and this will only run for builds for main
- name: Push Docker Images
uses: docker/build-push-action@v6
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=${{ env.IMAGE }}:latest
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker-image-tag.outputs.tags }}