generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (99 loc) · 2.99 KB
/
run-tests.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
check-generate:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check that generated artifacts are up-to-date
run: |
make generate
echo "Running 'git status' ..."
git status --porcelain | tee status.out
if [[ -s status.out ]]; then
echo "Generated artifacts are not up-to-date; probably 'make generate' was not run before committing"
exit 1
else
echo "Generated artifacts are up-to-date"
fi
test-scaffold:
runs-on: ubuntu-22.04
needs: check-generate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Build scaffold
run: |
go build -o bin/scaffold -ldflags "-X \"main.version=$(pwd)\"" ./scaffold
echo "Running 'scaffold --version' ..."
bin/scaffold --version
- name: Run scaffold (without admission webhooks)
run: |
rm -rf $RUNNER_TEMP/src
mkdir $RUNNER_TEMP/src
./bin/scaffold \
--group-name example.io \
--group-version v1alpha1 \
--kind MyComponent \
--operator-name mycomponent-operator.example.io \
--go-module example.io/mycomponent-operator \
--image mycomponent-operator:latest \
$RUNNER_TEMP/src
- name: Build generated operator (without admission webhooks)
run: |
cd $RUNNER_TEMP/src
make build
- name: Test generated operator (without admission webhooks)
run: |
cd $RUNNER_TEMP/src
make test
- name: Validate generation of typed client (without admission webhooks)
run: |
cd $RUNNER_TEMP/src
make generate-client
- name: Run scaffold (with admission webhooks)
run: |
rm -rf $RUNNER_TEMP/src
mkdir $RUNNER_TEMP/src
./bin/scaffold \
--group-name example.io \
--group-version v1alpha1 \
--kind MyComponent \
--with-validating-webhook \
--with-mutating-webhook \
--operator-name mycomponent-operator.example.io \
--go-module example.io/mycomponent-operator \
--image mycomponent-operator:latest \
$RUNNER_TEMP/src
- name: Build generated operator (with admission webhooks)
run: |
cd $RUNNER_TEMP/src
make build
- name: Test generated operator (with admission webhooks)
run: |
cd $RUNNER_TEMP/src
make test
- name: Validate generation of typed client (with admission webhooks)
run: |
cd $RUNNER_TEMP/src
make generate-client
# commented out until github runners have docker 23.0
# - name: Validate docker build
# run: |
# cd $RUNNER_TEMP/src
# make docker-build