-
Notifications
You must be signed in to change notification settings - Fork 83
54 lines (54 loc) · 1.65 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
name: CI
on: [pull_request]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ">=1.17.0"
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=3m
build:
name: Build
runs-on: ubuntu-latest
container: docker.io/library/golang:latest
strategy:
matrix:
platform: [amd64, ppc64le, s390x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Go Fmt
run: make fmt
- name: Go Tidy
run: go mod tidy
- name: Git Diff
run: git diff --exit-code
- name: Go Build
run: CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.platform }} GO111MODULE=on go build -mod vendor -o manager main.go
tests:
name: Tests
runs-on: ubuntu-latest
container: docker.io/library/golang:latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: OS Dependencies
run: apt-get update && apt-get install -y tar make gcc
- name: Install Kubebuilder
run: |
os=$(go env GOOS)
arch=$(go env GOARCH)
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_${os}_${arch}.tar.gz | tar -xz -C /tmp/
mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Tests
run: go test -v ./...