-
Notifications
You must be signed in to change notification settings - Fork 33
238 lines (192 loc) · 7.4 KB
/
ci.yaml
File metadata and controls
238 lines (192 loc) · 7.4 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: CI
env:
# Version of Argo CD to use for the installer.
ARGO_CD_VERSION: "3.0.6"
# Version of helm to use for linting.
HELM_VERSION: "v3.19.2"
# Version of helm-docs to use for linting.
HELM_DOCS_VERSION: "1.14.2"
# Version of the Helm unittest plugin for Helm tests.
HELM_UNITTEST_VERSION: "v1.0.2"
# Version of Vault client to use for the installer.
VAULT_VERSION: "1.19.5"
"on":
merge_group: {}
pull_request: {}
push:
branches:
- "main"
workflow_dispatch: {}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '>=1.22'
- name: Install helm-docs
run: >
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v${{ env.HELM_DOCS_VERSION }}
env:
GOBIN: /usr/local/bin/
- uses: astral-sh/setup-uv@v7
- name: Run linters
run: uv run --only-group=tox tox run -e lint
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python:
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
- name: Run Python tests
run: uv run --only-group=tox tox run -e typing,py,coverage-report
helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: azure/setup-helm@v5
with:
version: ${{ env.HELM_VERSION }}
# Used to query GitHub for the latest Helm release.
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install helm-unittest plugin
run: helm plugin install https://github.com/helm-unittest/helm-unittest --version ${{ env.HELM_UNITTEST_VERSION }}
- name: Run helm unittest
run: helm unittest {applications,charts}/*/tests/..
- name: Run helm unittest for sub-charts
run: helm unittest applications/*/charts/*/tests/..
- uses: astral-sh/setup-uv@v7
- name: Run Phalanx Helm linter
run: uv run --only-group=tox tox run -e phalanx-lint-change
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
outputs:
docs: ${{ steps.filter.outputs.docs }}
docs-specific: ${{ steps.filter.outputs.docs-specific }}
minikube: ${{ steps.filter.outputs.minikube }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
docs:
- ".github/workflows/docs.yaml"
- ".python-version"
- "docs/**"
- "applications/*/Chart.yaml"
- "applications/*/values.yaml"
- "applications/argocd/values-*.yaml"
- "applications/gafaelfawr/values-*.yaml"
- "environments/values-*.yaml"
- "requirements/*.txt"
- "src/phalanx/**"
docs-specific:
- "docs/**"
minikube:
- ".github/workflows/ci.yaml"
- ".python-version"
- "applications/{argocd,cert-manager,gafaelfawr,ingress-nginx,mobu,postgres,repertoire,vault-secrets-operator,sasquatch,strimzi,strimzi-access-operator,strimzi-registry-operator}/Chart.yaml"
- "applications/{argocd,cert-manager,gafaelfawr,ingress-nginx,mobu,postgres,repertoire,vault-secrets-operator,sasquatch,strimzi,strimzi-access-operator,strimzi-registry-operator}/templates/**"
- "applications/{argocd,cert-manager,gafaelfawr,ingress-nginx,mobu,postgres,repertoire,vault-secrets-operator,sasquatch,strimzi,strimzi-access-operator,strimzi-registry-operator}/values.yaml"
- "applications/{argocd,cert-manager,gafaelfawr,ingress-nginx,mobu,postgres,repertoire,vault-secrets-operator,sasquatch,strimzi,strimzi-access-operator,strimzi-registry-operator}/values-minikube.yaml"
- "environments/templates/applications/infrastructure/*"
- "environments/values-minikube.yaml"
- "src/phalanx/**"
- "uv.lock"
minikube:
name: Test deploy
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [test, helm, changes]
if: >-
(github.event_name == 'workflow_dispatch')
|| (needs.changes.outputs.minikube == 'true'
&& github.event_name != 'push'
&& !startsWith(github.head_ref, 'dependabot/'))
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Download installer dependencies
run: |
curl -sSL -o /tmp/vault.zip https://releases.hashicorp.com/vault/${{ env.VAULT_VERSION }}/vault_${{ env.VAULT_VERSION }}_linux_amd64.zip
unzip /tmp/vault.zip
sudo mv vault /usr/local/bin/vault
sudo chmod +x /usr/local/bin/vault
sudo curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/v${{ env.ARGO_CD_VERSION }}/argocd-linux-amd64
sudo chmod +x /usr/local/bin/argocd
sudo apt-get install socat
- uses: medyagh/setup-minikube@latest
with:
cpus: max
memory: 5500m # Linux virtual machines have 7GB of RAM
- name: Test interaction with the cluster
run: kubectl get nodes
- name: Run Phalanx installer
run: >
uv run --only-group=tox tox run -e install --
--force-noninteractive
--vault-role-id=${{ secrets.MINIKUBE_VAULT_ROLE_ID }}
--vault-secret-id=${{ secrets.MINIKUBE_VAULT_SECRET_ID }}
minikube
- name: Get final list of resources
run: |
kubectl get all -A
kubectl get ingress -A
- name: Wait for all applications to be healthy
timeout-minutes: 15
run: |
argocd app wait -l "argocd.argoproj.io/instance=science-platform" \
--port-forward \
--port-forward-namespace argocd \
--timeout 300
docs:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: changes
if: >-
(needs.changes.outputs.docs == 'true')
|| (github.event_name == 'workflow_dispatch')
steps:
- uses: actions/checkout@v6
with:
# Ensure the documentation gets the right version.
fetch-depth: 0
- uses: astral-sh/setup-uv@v7
- name: Install graphviz
run: |
sudo apt-get update
sudo apt-get install -y graphviz
- name: Build documentation
run: uv run --only-group=tox tox run -e docs
# Upload docs:
# - on pushes to main if *any* documentation content might have changed
# - on workflow dispatches if any documentation content might have changed
# - on pushes to tickets/ branches if docs/ directory content changed
- name: Upload to LSST the Docs
uses: lsst-sqre/ltd-upload@v1
with:
project: "phalanx"
dir: "docs/_build/html"
username: ${{ secrets.LTD_USERNAME }}
password: ${{ secrets.LTD_PASSWORD }}
if: >-
(github.event_name == 'push' && github.ref_name == 'main')
|| (github.event_name == 'workflow_dispatch')
|| (github.event_name == 'pull_request'
&& (startsWith(github.head_ref, 'tickets/')
|| startsWith(github.head_ref, 't/'))
&& needs.changes.outputs.docs-specific == 'true')