-
Notifications
You must be signed in to change notification settings - Fork 79
81 lines (68 loc) · 2.38 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
name: For each commit and PR
on:
push:
branches:
- "*"
tags-ignore:
- "v*"
pull_request:
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
- name: Install nix
uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- 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
nix-shell --run 'go get -t ./... && go mod tidy'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate all files
run: nix-shell --run 'make -j1 gen'
- name: Run all the tests
run: nix-shell --run 'make ci'
- name: upload codecov
run: bash <(curl -s https://codecov.io/bash)
- name: compile binaries
run: nix-shell --run 'make crosscompile'
- name: Figure out Docker Tags
id: docker-image-tag
run: |
echo ::set-output name=tags::quay.io/tinkerbell/smee:latest,quay.io/tinkerbell/smee:sha-${GITHUB_SHA::8}
- name: Login to quay.io
uses: docker/login-action@v3
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build Docker Images
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=quay.io/tinkerbell/smee: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@v5
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=quay.io/tinkerbell/smee:latest
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker-image-tag.outputs.tags }}