Skip to content

Commit 1c2d088

Browse files
authored
Merge branch 'main' into doml/subtitles
2 parents 3e64bc9 + 16b8706 commit 1c2d088

File tree

77 files changed

+2403
-1975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2403
-1975
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@
2727
/dotcom-rendering/src/lib/braze/ @guardian/value
2828
/dotcom-rendering/webpack/ @guardian/dotcom-platform
2929
/scripts/ @guardian/dotcom-platform
30+
/ab-testing/ @guardian/commercial-dev

.github/workflows/ab-testing-checks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
jobs:
2121
checks:
2222
runs-on: ubuntu-latest
23+
name: Checks
2324
defaults:
2425
run:
2526
working-directory: ab-testing

.github/workflows/ab-testing-deploy-code.yml renamed to .github/workflows/ab-testing-ci-code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 🧪 Deploy CODE AB Testing Config
1+
name: 🧪 AB testing CI (CODE)
22

33
permissions:
44
contents: read

.github/workflows/ab-testing-ci.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,31 @@ on:
77
pull_request:
88
paths:
99
- 'ab-testing/**'
10+
- '.github/workflows/ab-testing-*.yml'
11+
push:
12+
branches:
13+
- main
14+
paths:
15+
- 'ab-testing/**'
16+
- '.github/workflows/ab-testing-*.yml'
1017

1118
jobs:
12-
checks:
19+
ci:
20+
name: CI
1321
uses: ./.github/workflows/ab-testing-checks.yml
22+
with:
23+
save_build_artifact: true
24+
secrets:
25+
FASTLY_AB_TESTING_CONFIG: ${{ secrets.FASTLY_PROD_AB_TESTING_CONFIG }}
26+
FASTLY_API_TOKEN: ${{ secrets.FASTLY_PROD_API_TOKEN }}
27+
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
1435
secrets:
15-
FASTLY_AB_TESTING_CONFIG: ${{ secrets.FASTLY_CODE_AB_TESTING_CONFIG }}
16-
FASTLY_API_TOKEN: ${{ secrets.FASTLY_CODE_API_TOKEN }}
36+
FASTLY_AB_TESTING_CONFIG: ${{ secrets.FASTLY_PROD_AB_TESTING_CONFIG }}
37+
FASTLY_API_TOKEN: ${{ secrets.FASTLY_PROD_API_TOKEN }}

.github/workflows/ab-testing-deploy-prod.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/ab-testing-ui.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ on:
33
pull_request:
44
paths:
55
- 'ab-testing/**'
6+
- '.github/workflows/ab-testing-*.yml'
67
push:
78
branches:
89
- main
910
paths:
1011
- 'ab-testing/**'
12+
- '.github/workflows/ab-testing-*.yml'
1113

1214
jobs:
1315
build-ui:

ab-testing/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ To add a test where there is not enough space in the default audience space (`A`
6363

6464
For example if there are already 3 25% tests in space `A` totalling 75%, and you want to run a 50% test, you can set the `audienceSpace` to `B` to allow this test to overlap with the existing tests.
6565

66+
### Test Status
67+
68+
Tests can be set to `ON` or `OFF` using the `status` field. Only tests with status `ON` will be validated and deployed.
69+
6670
## How it works
6771

6872
The AB testing framework uses Deno to run scripts that validate and deploy the tests. The `deno.json` file contains the tasks that can be run, such as `validate`, `deploy`, and `build`.

ab-testing/abTest.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ import type { ABTest } from './types';
1919
* - 100% Test variant MVT 500-999
2020
*/
2121

22-
export const ABTests: ABTest[] = [];
22+
const ABTests: ABTest[] = [];
23+
24+
const activeABtests = ABTests.filter((test) => test.status === 'ON');
25+
26+
export { ABTests as allABTests, activeABtests };

ab-testing/frontend/src/routes/+page.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { ABTests } from '../../../abTest';
2+
import { allABTests, activeABtests } from '../../../abTest';
33
import Table from '$lib/components/TableFixed.svelte';
44
import AudienceBreakdown from '$lib/components/AudienceBreakdown.svelte';
55
</script>
@@ -31,8 +31,8 @@
3131
</p>
3232
</section>
3333
<section>
34-
<AudienceBreakdown tests={ABTests} />
35-
<Table tests={ABTests} />
34+
<AudienceBreakdown tests={activeABtests} />
35+
<Table tests={allABTests} />
3636
</section>
3737

3838
<style>

ab-testing/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-ignore - extension is required to import this as a package in DCR
2-
import { ABTests } from './abTest.ts';
1+
import { allABTests, activeABtests } from './abTest';
32

4-
export { ABTests };
3+
export { allABTests, activeABtests };

0 commit comments

Comments
 (0)