-
Notifications
You must be signed in to change notification settings - Fork 34
215 lines (180 loc) · 5.41 KB
/
Copy pathab-testing-ci.yml
File metadata and controls
215 lines (180 loc) · 5.41 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
name: 🧪 AB testing
permissions:
contents: read
on:
merge_group:
types: [checks_requested]
push:
paths:
- 'ab-testing/**'
- '.github/workflows/ab-testing-ci.yml'
- 'pnpm-workspace.yaml'
jobs:
ab-testing-checks:
runs-on: ubuntu-latest
name: AB testing checks
defaults:
run:
working-directory: ab-testing
steps:
- uses: actions/checkout@v7
- name: Set up Node environment
uses: ./.github/actions/setup-node-env
- name: Test
run: pnpm test
- name: Lint
run: pnpm lint
config-ci:
runs-on: ubuntu-latest
name: Config CI
defaults:
run:
working-directory: ab-testing/config
env:
FASTLY_AB_TESTING_CONFIG: ${{ secrets.FASTLY_PROD_AB_TESTING_CONFIG }}
FASTLY_API_TOKEN: ${{ secrets.FASTLY_PROD_API_TOKEN }}
needs: [ab-testing-checks]
steps:
- uses: actions/checkout@v7
- name: Set up Node environment
uses: ./.github/actions/setup-node-env
- name: Validate
run: pnpm validate
- name: Build
run: pnpm build
- uses: actions/upload-artifact@v7
with:
name: ab-testing-build
path: ab-testing/config/dist
ui-ci:
name: UI CI
runs-on: ubuntu-latest
defaults:
run:
working-directory: ab-testing/frontend
permissions:
contents: read
needs: [ab-testing-checks]
steps:
- uses: actions/checkout@v7
- name: Set up Node environment
uses: ./.github/actions/setup-node-env
- name: Build UI
run: pnpm build
- name: Save build
uses: actions/upload-artifact@v7
with:
name: ui-build
path: ab-testing/frontend/output/ab-tests.html
if-no-files-found: error
deploy-lambda-ci:
name: Lambda CI
runs-on: ubuntu-latest
defaults:
run:
working-directory: ab-testing/deploy-lambda
permissions:
contents: read
needs: [ab-testing-checks]
steps:
- uses: actions/checkout@v7
- name: Set up Node environment
uses: ./.github/actions/setup-node-env
- name: Build Lambda
run: pnpm build
- name: Zip app artifact
run: |
cd dist
zip -r lambda.zip .
zip -j lambda.zip ../package.json
- name: Save build
uses: actions/upload-artifact@v7
with:
name: ab-testing-deploy-lambda-build
path: ab-testing/deploy-lambda/dist/lambda.zip
notification-lambda-ci:
name: Notification Lambda CI
runs-on: ubuntu-latest
defaults:
run:
working-directory: ab-testing/notification-lambda
permissions:
contents: read
needs: [ab-testing-checks]
steps:
- uses: actions/checkout@v7
- name: Set up Node environment
uses: ./.github/actions/setup-node-env
- name: Build Lambda
run: pnpm build
- name: Zip app artifact
run: |
cd dist
zip -r lambda.zip .
zip -j lambda.zip ../package.json
- name: Save build
uses: actions/upload-artifact@v7
with:
name: ab-testing-notification-lambda-build
path: ab-testing/notification-lambda/dist/lambda.zip
riff-raff:
name: Riff-Raff Artifacts
runs-on: ubuntu-latest
needs: [config-ci, ui-ci, deploy-lambda-ci, notification-lambda-ci]
permissions:
id-token: write
contents: read
pull-requests: write
defaults:
run:
working-directory: ab-testing
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Node
uses: ./.github/actions/setup-node-env
- name: Fetch config build
uses: actions/download-artifact@v8.0.1
with:
name: ab-testing-build
path: ab-testing/config/dist
- name: Fetch UI build
uses: actions/download-artifact@v8.0.1
with:
name: ui-build
path: ab-testing/frontend/output/ab-tests.html
- name: Fetch Deploy Lambda build
uses: actions/download-artifact@v8.0.1
with:
name: ab-testing-deploy-lambda-build
path: ab-testing/deploy-lambda/dist/lambda.zip
- name: Fetch Notification Lambda build
uses: actions/download-artifact@v8.0.1
with:
name: ab-testing-notification-lambda-build
path: ab-testing/notification-lambda/dist/lambda.zip
- name: CDK Test
run: pnpm --filter @guardian/ab-testing-cdk test
- name: CDK synth
run: pnpm --filter @guardian/ab-testing-cdk synth
- name: Riff-Raff Upload
uses: guardian/actions-riff-raff@v4.3.6
with:
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: dotcom:ab-testing
configPath: ab-testing/cdk/cdk.out/dotcom:ab-testing/riff-raff.yaml
contentDirectories: |
ab-testing-config-artifacts:
- ab-testing/config/dist
ab-testing-deployment-lambda:
- ab-testing/deploy-lambda/dist/lambda.zip
ab-testing-notification-lambda:
- ab-testing/notification-lambda/dist/lambda.zip
ab-testing-ui-artifact:
- ab-testing/frontend/output/ab-tests.html
cdk.out:
- ab-testing/cdk/cdk.out