-
Notifications
You must be signed in to change notification settings - Fork 1
223 lines (206 loc) · 7.32 KB
/
Copy pathmain.yml
File metadata and controls
223 lines (206 loc) · 7.32 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
name: "kitconcept.intranet: CI"
on:
push:
paths:
- "backend/**"
- "frontend/**"
- ".github/workflows/*.yml"
- "devops/**"
workflow_dispatch:
jobs:
config:
name: "Config: Compute values used in workflow"
uses: ./.github/workflows/config.yml
image-build:
name: "Image: ${{ needs.config.outputs.image-name-prefix }}-${{ matrix.suffix }}:${{ needs.config.outputs.base-tag }}"
uses: ./.github/workflows/image-build.yml
if: ${{ needs.config.outputs.acceptance == 'true' }}
strategy:
fail-fast: false
matrix:
include:
- suffix: "backend"
dockerfile: "Dockerfile"
working-directory: "backend"
build-args: |
IMAGE_TAG=${{ needs.config.outputs.base-tag }}
SEED=${{ github.run_id }}
KC_VERSION=${{ needs.config.outputs.kc-version }}
- suffix: "acceptance"
dockerfile: "Dockerfile.acceptance"
working-directory: "backend"
build-args: |
IMAGE_TAG=${{ needs.config.outputs.base-tag }}
SEED=${{ github.run_id }}
KC_VERSION=${{ needs.config.outputs.kc-version }}
- suffix: "frontend"
dockerfile: "Dockerfile"
working-directory: "frontend"
build-args: |
VOLTO_VERSION=${{ needs.config.outputs.volto-version }}
needs:
- config
with:
base-tag: ${{ needs.config.outputs.base-tag }}
image-name-prefix: ${{ needs.config.outputs.image-name-prefix }}
image-name-suffix: ${{ matrix.suffix }}
build-args: ${{ matrix.build-args }}
dockerfile: ${{ matrix.dockerfile }}
working-directory: ${{ matrix.working-directory }}
backend:
uses: ./.github/workflows/backend.yml
needs:
- config
with:
python-version: ${{ needs.config.outputs.python-version }}
kc-version: ${{ needs.config.outputs.kc-version }}
if: ${{ needs.config.outputs.backend == 'true' }}
permissions:
contents: read
packages: write
frontend:
uses: ./.github/workflows/frontend.yml
needs:
- config
with:
node-version: ${{ needs.config.outputs.node-version }}
volto-version: ${{ needs.config.outputs.volto-version }}
if: ${{ needs.config.outputs.frontend == 'true' }}
permissions:
contents: read
packages: write
acceptance:
name: "Acceptance: ${{ matrix.name }}"
uses: ./.github/workflows/acceptance.yml
if: ${{ needs.config.outputs.acceptance == 'true' }}
strategy:
fail-fast: false
matrix:
include:
- name: "Core Tests - Basic"
spec-pattern: 'core/basic/*.cy.{js,jsx,ts,tsx}'
- name: "Core Tests - Blocks"
spec-pattern: 'core/blocks/*.cy.{js,jsx,ts,tsx}'
- name: "Core Tests - Content"
spec-pattern: 'core/content/*.cy.{js,jsx,ts,tsx}'
- name: "Main Tests"
spec-pattern: 'main/**/*.cy.{js,jsx,ts,tsx}'
needs:
- config
- image-build
with:
base-tag: ${{ needs.config.outputs.base-tag }}
node-version: ${{ needs.config.outputs.node-version }}
name: ${{ matrix.name }}
spec-pattern: ${{ matrix.spec-pattern }}
a11y:
name: "A11y: ${{ matrix.name }}"
uses: ./.github/workflows/acceptance.yml
if: ${{ needs.config.outputs.acceptance == 'true' }}
strategy:
fail-fast: false
matrix:
include:
- name: "Tests"
api-url: 'localhost:8080/plone'
spec-pattern: 'a11y/**/*.cy.{js,jsx,ts,tsx}'
needs:
- config
- image-build
with:
base-tag: ${{ needs.config.outputs.base-tag }}
node-version: ${{ needs.config.outputs.node-version }}
name: ${{ matrix.name }}
api-url: ${{ matrix.api-url }}
spec-pattern: ${{ matrix.spec-pattern }}
test-profile: a11y
backend-release:
uses: ./.github/workflows/backend-release.yml
needs:
- config
- acceptance
- a11y
- backend
with:
base-tag: ${{ needs.config.outputs.base-tag }}
image-name-prefix: ${{ needs.config.outputs.image-name-prefix }}
image-name-suffix: "backend"
python-version: ${{ needs.config.outputs.python-version }}
kc-version: ${{ needs.config.outputs.kc-version }}
if: ${{ needs.config.outputs.deploy == 'true' && (always() && !contains(needs.*.result, 'failure')) }}
permissions:
contents: read
packages: write
frontend-release:
uses: ./.github/workflows/frontend-release.yml
needs:
- config
- acceptance
- a11y
- frontend
with:
base-tag: ${{ needs.config.outputs.base-tag }}
image-name-prefix: ${{ needs.config.outputs.image-name-prefix }}
image-name-suffix: "frontend"
node-version: ${{ needs.config.outputs.node-version }}
volto-version: ${{ needs.config.outputs.volto-version }}
if: ${{ needs.config.outputs.deploy == 'true' && (always() && !contains(needs.*.result, 'failure')) }}
permissions:
contents: read
packages: write
deploy:
name: "Deploy: plone-intranet.kitconcept.dev"
uses: kitconcept/meta/.github/workflows/deploy.yml@main
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && !contains(needs.*.result, 'failure') }}
needs:
- config
- backend-release
- frontend-release
with:
tag: ${{ needs.config.outputs.base-tag }}
environment: "plone-intranet.kitconcept.dev"
stack-name: "plone-intranet-kitconcept-dev"
stack-file: "devops/stacks/demo.yml"
registry: "ghcr.io"
username: ${{ github.actor }}
secrets:
password: ${{ secrets.DEPLOY_GHCR_READ_TOKEN }}
remote-host: ${{ secrets.DEPLOY_HOST }}
remote-port: ${{ secrets.DEPLOY_PORT }}
remote-user: ${{ secrets.DEPLOY_USER }}
remote-private-key: ${{ secrets.DEPLOY_SSH }}
env-file: |
IMAGE_NAME_PREFIX=${{ needs.config.outputs.image-name-prefix }}
IMAGE_TAG=${{ needs.config.outputs.base-tag }}
STACK_NAME=${{ vars.STACK_NAME }}
STACK_PREFIX=${{ vars.STACK_PREFIX }}
HOSTNAME=${{ vars.HOSTNAME }}
CERTRESOLVER=${{ vars.CERTRESOLVER }}
permissions:
contents: read
packages: write
report:
name: "Final report"
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- config
- image-build
- acceptance
- a11y
- backend
- frontend
- deploy
steps:
- name: Write report
run: |
echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY
echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
echo '| config | ${{ needs.config.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| image-build | ${{ needs.image-build.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| acceptance | ${{ needs.acceptance.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| a11y | ${{ needs.a11y.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| backend | ${{ needs.backend.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| frontend | ${{ needs.frontend.result }} |' >> $GITHUB_STEP_SUMMARY
echo '| deploy | ${{ needs.deploy.result }} |' >> $GITHUB_STEP_SUMMARY