forked from tinkerbell/smee
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (65 loc) · 2.31 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
name: For each commit and PR
on:
push:
pull_request:
jobs:
validation:
runs-on: [self-hosted, X64]
env:
CGO_ENABLED: 0
steps:
- name: Setup Dynamic Env
run: |
echo "MAKEFLAGS=-j$(nproc)" | tee $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- name: Install nix
uses: cachix/install-nix-action@018abf956a0a15673dae4932ae26f0f071ac0944
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Non Go formatters and linters
run: ./.github/workflows/ci-non-go.sh
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.16.3"
- name: Generate all files
run: nix-shell --run 'make gen'
- name: goimports
run: go get golang.org/x/tools/cmd/goimports && goimports -d . | (! grep .)
- name: go vet
run: go mod tidy && go vet ./...
- name: golangci-lint brought to you by Nix
run: nix-shell --run 'GOROOT= golangci-lint run -v'
- name: go test
run: go test -v ./... -gcflags=-l
- name: go test coverage
run: go test -coverprofile=coverage.txt ./... -gcflags=-l
- name: upload codecov
run: bash <(curl -s https://codecov.io/bash)
- name: compile binaries
run: nix-shell --run 'make crosscompile'
- name: Docker Image Tag for Sha
id: docker-image-tag
run: |
echo ::set-output name=tags::quay.io/tinkerbell/boots:latest,quay.io/tinkerbell/boots:sha-${GITHUB_SHA::8}
- name: Login to quay.io
uses: docker/login-action@v1
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: quay.io/tinkerbell/boots
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
cache-from: type=registry,ref=quay.io/tinkerbell/boots:latest
push: ${{ startsWith(github.ref, 'refs/heads/main') }}
tags: ${{ steps.docker-image-tag.outputs.tags }}
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64