forked from triggermesh/triggermesh
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (66 loc) · 1.89 KB
/
generated.yaml
File metadata and controls
83 lines (66 loc) · 1.89 KB
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
name: Generated Files
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
gomod:
name: Go Modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'
- name: Go caches
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ github.job }}-${{ runner.os }}-go-
- name: Check modules requirements
run: |
go mod tidy
git_status="$(git status --porcelain)"
if [[ ${git_status} ]]; then
echo -e 'Go modules are out-of-date. Please run `go mod tidy`\n'
echo "${git_status}"
exit 1
fi
codegen:
name: Generated Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'
- name: Go caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ github.job }}-${{ runner.os }}-go-
- name: Kubernetes code generation
run: |
mod_path="$(go mod edit -json | jq -r '.Module.Path')"
tmp_gopath="$(mktemp -d)"
export GOPATH="$tmp_gopath"
tmp_repo_path="${tmp_gopath}/src/${mod_path}"
mkdir -p "${tmp_repo_path%/*}"
ln -s "$GITHUB_WORKSPACE" "$tmp_repo_path"
make codegen
git_status="$(git status --porcelain)"
if [[ ${git_status} ]]; then
echo -e 'Generated Kubernetes code is out-of-date. Please run `make codegen`\n'
echo "${git_status}"
exit 1
fi