-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (81 loc) · 2.18 KB
/
main.yml
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
92
93
94
95
96
97
name: Go
on:
workflow_dispatch:
push:
branches: [ "*" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
generate:
runs-on: ubuntu-latest
name: Ensure manifests are commit
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate manifests
run: make manifests
- name: Run code generation
run: make generate
- name: Verify modified files
uses: tj-actions/[email protected]
id: verify-changed-files
with:
files: |
config/crd/bases/*.yaml
api
internal/putio/putio_generated.go
- name: Validate generated files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.verify-changed-files.outputs.changed_files }}"
echo "Run 'make manifests generate && go generate ./...' and commit again'
exit 1
unit-tests:
runs-on: ubuntu-latest
name: Go tests
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
check-latest: true
cache: true
- name: Run tests
run: make test
env:
PUTIO_TESTING_OAUTH_TOKEN: ${{ secrets.PUTIO_TESTING_OAUTH_TOKEN }}
ACK_GINKGO_DEPRECATIONS: "1.16.5"
lint:
runs-on: ubuntu-latest
name: Go lint
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
check-latest: true
cache: false # golangci/golangci-lint-action already do some caching
- name: Checkout code
uses: actions/checkout@v3
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.0
build:
runs-on: ubuntu-latest
name: Go build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
check-latest: true
cache: true
- name: Build
run: make build