generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 41
45 lines (42 loc) · 1.22 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
name: ci
on:
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.0
- name: Set up Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
- name: Check go.mod
run: go mod tidy && git diff --exit-code
- name: Build
run: go build ./cmd/... ./pkg/...
- name: Test
run: go test ./...
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.0
- name: Check code format
run: |
diff=$(gofmt -s -d cmd pkg *.go)
if [[ -n "${diff}" ]]; then echo "${diff}"; exit 1; fi
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
required:
needs: [build, golangci-lint]
runs-on: ubuntu-latest
steps:
- run: echo "Required jobs success!"