-
Notifications
You must be signed in to change notification settings - Fork 21
91 lines (85 loc) · 2.7 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.read-go-version.outputs.version }}
steps:
- uses: actions/checkout@v2
- id: read-go-version
name: Determine Go version from go.mod
run: echo "::set-output name=version::$(grep "go 1." go.mod | cut -d " " -f 2)"
golangci-lint:
runs-on: ubuntu-latest
needs:
- get-go-version
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- id: get-golangci-lint-version
name: Get golangci-lint version
run: echo "GOLANGCI_LINT_VERSION=$(grep '^GOLANGCI_LINT_VERSION' Makefile | cut -d' ' -f3)" >> "$GITHUB_OUTPUT"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
with:
version: ${{ steps.get-golangci-lint-version.outputs.GOLANGCI_LINT_VERSION }}
args: --timeout=5m
generate-lint:
runs-on: ubuntu-latest
needs:
- get-go-version
# NOTE(irvinlim): Need to operate in GOPATH in order for generate-groups.sh to succeed (see Makefile).
steps:
- uses: actions/checkout@v2
with:
path: "go/src/github.com/${{ github.repository }}"
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Generate code
run: make generate && make manifests
env:
GOPATH: /home/runner/work/furiko/go
working-directory: "go/src/github.com/${{ github.repository }}"
- name: Check for differences
run: git add . && git diff --exit-code --staged
working-directory: "go/src/github.com/${{ github.repository }}"
license-header-lint:
runs-on: ubuntu-latest
needs:
- get-go-version
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: make lint-license
go-test:
strategy:
matrix:
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
needs:
- get-go-version
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Run tests
run: make test
- name: Push code coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./combined.cov
# Push code coverage only for one of the environments
if: matrix.platform == 'ubuntu-latest'