@@ -4,34 +4,163 @@ permissions:
44 contents : read
55
66on :
7- pull_request :
8- paths :
9- - ' ab-testing/**'
10- - ' .github/workflows/ab-testing-*.yml'
117 push :
12- branches :
13- - main
148 paths :
159 - ' ab-testing/**'
16- - ' .github/workflows/ab-testing-* .yml'
10+ - ' .github/workflows/ab-testing-ci .yml'
1711
1812jobs :
19- ci :
20- name : CI
21- uses : ./.github/workflows/ab-testing-checks.yml
22- with :
23- save_build_artifact : true
24- secrets :
13+ config-ci :
14+ runs-on : ubuntu-latest
15+ name : Config CI
16+ defaults :
17+ run :
18+ working-directory : ab-testing/config
19+ env :
2520 FASTLY_AB_TESTING_CONFIG : ${{ secrets.FASTLY_PROD_AB_TESTING_CONFIG }}
2621 FASTLY_API_TOKEN : ${{ secrets.FASTLY_PROD_API_TOKEN }}
2722
28- deploy :
29- name : Deploy
30- needs : ci
31- if : github.ref == 'refs/heads/main'
32- uses : ./.github/workflows/ab-testing-deploy.yml
33- with :
34- stage : prod
35- secrets :
36- FASTLY_AB_TESTING_CONFIG : ${{ secrets.FASTLY_PROD_AB_TESTING_CONFIG }}
37- FASTLY_API_TOKEN : ${{ secrets.FASTLY_PROD_API_TOKEN }}
23+ steps :
24+ - uses : actions/checkout@v5
25+
26+ - name : Set up Node environment
27+ uses : ./.github/actions/setup-node-env
28+
29+ - name : Test
30+ run : pnpm test
31+
32+ - name : Lint
33+ run : pnpm lint
34+
35+ - name : Prettier Check
36+ run : pnpm prettier:check
37+
38+ - name : Typecheck
39+ run : pnpm tsc
40+
41+ - name : Validate
42+ run : pnpm validate
43+
44+ - name : Build
45+ run : pnpm build
46+
47+ - uses : actions/upload-artifact@v5
48+ with :
49+ name : ab-testing-build
50+ path : ab-testing/config/dist
51+
52+ ui-ci :
53+ name : UI CI
54+ runs-on : ubuntu-latest
55+ defaults :
56+ run :
57+ working-directory : ab-testing/frontend
58+ permissions :
59+ contents : read
60+ steps :
61+ - uses : actions/checkout@v5
62+
63+ - name : Set up Node environment
64+ uses : ./.github/actions/setup-node-env
65+
66+ - name : Build UI
67+ run : pnpm build
68+
69+ - name : Save build
70+ uses : actions/upload-artifact@v5
71+ with :
72+ name : ui-build
73+ path : ab-testing/frontend/output/ab-tests.html
74+ if-no-files-found : error
75+
76+ lambda-ci :
77+ name : Lambda CI
78+ runs-on : ubuntu-latest
79+ defaults :
80+ run :
81+ working-directory : ab-testing/deploy-lambda
82+ permissions :
83+ contents : read
84+ steps :
85+ - uses : actions/checkout@v5
86+
87+ - name : Set up Node environment
88+ uses : ./.github/actions/setup-node-env
89+
90+ - name : Build Lambda
91+ run : pnpm build
92+
93+ - name : Zip app artifact
94+ run : |
95+ cd dist
96+ zip -r lambda.zip .
97+ zip -j lambda.zip ../package.json
98+
99+ - name : Save build
100+ uses : actions/upload-artifact@v5
101+ with :
102+ name : ab-testing-lambda-build
103+ path : ab-testing/deploy-lambda/dist/lambda.zip
104+
105+ riff-raff :
106+ name : Riff-Raff Artifacts
107+ runs-on : ubuntu-latest
108+ needs : [config-ci, ui-ci, lambda-ci]
109+ permissions :
110+ id-token : write
111+ contents : read
112+ pull-requests : write
113+ defaults :
114+ run :
115+ working-directory : ab-testing
116+
117+ steps :
118+ - name : Checkout
119+ uses : actions/checkout@v5
120+ with :
121+ fetch-depth : 0
122+ persist-credentials : false
123+
124+ - name : Set up Node
125+ uses : ./.github/actions/setup-node-env
126+
127+ - name : Fetch config build
128+ 129+ with :
130+ name : ab-testing-build
131+ path : ab-testing/config/dist
132+
133+ - name : Fetch UI build
134+ 135+ with :
136+ name : ui-build
137+ path : ab-testing/frontend/output/ab-tests.html
138+
139+ - name : Fetch Lambda build
140+ 141+ with :
142+ name : ab-testing-lambda-build
143+ path : ab-testing/deploy-lambda/dist/lambda.zip
144+
145+ - name : CDK Test
146+ run : pnpm --filter @guardian/ab-testing-cdk test
147+
148+ - name : CDK synth
149+ run : pnpm --filter @guardian/ab-testing-cdk synth
150+
151+ - name : Riff-Raff Upload
152+ 153+ with :
154+ roleArn : ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
155+ githubToken : ${{ secrets.GITHUB_TOKEN }}
156+ projectName : dotcom:ab-testing
157+ configPath : ab-testing/cdk/cdk.out/riff-raff.yaml
158+ contentDirectories : |
159+ ab-testing-config-artifacts:
160+ - ab-testing/config/dist
161+ ab-testing-deployment-lambda:
162+ - ab-testing/deploy-lambda/dist/lambda.zip
163+ ab-testing-ui-artifact:
164+ - ab-testing/frontend/output/ab-tests.html
165+ cdk.out:
166+ - ab-testing/cdk/cdk.out
0 commit comments