forked from primaza/primaza
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (170 loc) · 5.28 KB
/
nightly-pr-checks.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Nightly PR checks
on: # yamllint disable-line rule:truthy
schedule:
- cron: '0 0 * * *' # run at midnight daily
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
GO111MODULE: "on"
GO_VERSION: "^1.20"
# quote this, since yaml will otherwise treat this as a float
PYTHON_VERSION: "3.10"
TEST_ACCEPTANCE_CLI: "kubectl"
TEST_RESULTS: "out/acceptance-tests"
jobs:
lint:
name: Code Quality
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: "x64"
- name: Checkout repo
uses: actions/checkout@v3
- name: Lint Go
if: success() || failure()
run: make lint-go
env:
GO_LINT_CONCURRENCY: 2
GO_LINT_OUTPUT: github-actions
- name: Lint YAML files
if: success() || failure()
run: make lint-yaml
- name: Lint Python
if: success() || failure()
run: make lint-python
- name: Lint Gherkin (feature) files
if: success() || failure()
run: make lint-feature-files
- name: Lint conflicts in source files
if: success() || failure()
run: make lint-conflicts
- name: Lint shell scripts
if: success() || failure()
run: make lint-shell
- name: Check manifests up to date
if: success() || failure()
run: |
set -e
make manifests
make primaza go-generate
git update-index -q --refresh
if ! git diff-index --quiet HEAD -- config/ ; then
echo "the following manifests are not up-to-date"
git diff config
exit 1
fi
unit:
name: Unit Tests
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout Git Repository
uses: actions/checkout@v3
- name: Unit Tests with Code Coverage
run: |
make test
features:
name: Acceptance Tests Features
runs-on: ubuntu-20.04
outputs:
features: ${{ steps.features.outputs.features }}
steps:
- name: Checkout Git Repository
uses: actions/checkout@v3
- id: features
run: |
cd test/acceptance/features
FEATURES=$(ls *.feature | jq -R -s -c 'split("\n")[:-1]')
echo "features=$FEATURES" >> $GITHUB_OUTPUT
build:
name: Build images
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- make: primaza
image-name: primaza-controller
- make: agentapp
image-name: agentapp
- make: agentsvc
image-name: agentsvc
steps:
- name: Checkout Git Repository
uses: actions/checkout@v3
- name: Build images
run: |
make ${{ matrix.make }} docker-build IMG=${{ matrix.image-name }}:testing
docker save ${{ matrix.image-name }}:testing -o ${{ matrix.image-name }}.tar
- name: Upload image artifacts
uses: actions/upload-artifact@v3
with:
name: images
path: ${{ matrix.image-name }}.tar
acceptance:
name: Acceptance Tests
runs-on: ubuntu-20.04
timeout-minutes: 90
needs: ["features", "build"]
strategy:
fail-fast: false
matrix:
feature: ${{ fromJSON(needs.features.outputs.features) }}
steps:
- name: Checkout Git Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: "x64"
- name: Download pre-built images
uses: actions/download-artifact@v3
with:
name: images
path: images/
- name: Acceptance tests
timeout-minutes: 60
run: |
docker load -i images/primaza-controller.tar
docker load -i images/agentapp.tar
docker load -i images/agentsvc.tar
make kustomize test-acceptance
env:
EXTRA_BEHAVE_ARGS: -i test/acceptance/features/${{ matrix.feature }} --tags=~@disable-github-actions
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRIMAZA_CONTROLLER_IMAGE_REF: primaza-controller:testing
PRIMAZA_AGENTAPP_IMAGE_REF: agentapp:testing
PRIMAZA_AGENTSVC_IMAGE_REF: agentsvc:testing
CLUSTER_PROVIDER: kind
- uses: actions/upload-artifact@v3
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
with:
name: acceptance-test-results
path: ${{ env.TEST_RESULTS }}
wait-acceptance:
needs: acceptance
name: Wait for Acceptance Tests
runs-on: ubuntu-20.04
steps:
- name: Trigger nightly release
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.MM_TOKEN }}
repository: mmulholla/primaza
event-type: primaza-release
client-payload: '{"version": "nightly"}'
- name: None
if: always()
run: exit 0