Skip to content

Commit

Permalink
Add PR seed upload workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
goodov committed Jul 9, 2024
1 parent f48f335 commit 7802f64
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/pr-seed-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PR Seed Upload

on:
pull_request:
paths:
- 'studies/**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Generate seed
run: |
npm install
npm run typecheck:scripts
npm run build:proto
npm run typecheck
npm run test
npm run seed_tools -- create_seed studies seed.bin
- name: Upload seed
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PRODUCTION_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PRODUCTION_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
REMOTE_SEED_PATH: 'pull/${{github.event.pull_request.number}}/seed'
run: |
gzip -c seed.bin | aws s3 cp - "s3://brave-production-griffin-origin/$REMOTE_SEED_PATH" \
--content-type application/octet-stream \
--content-encoding gzip
INVALIDATION_ID=$(aws cloudfront create-invalidation --distribution-id "$CLOUDFRONT_DISTRIBUTION_ID" --paths "/$REMOTE_SEED_PATH" --query 'Invalidation.Id' --output text)
aws cloudfront wait invalidation-completed --distribution-id "$CLOUDFRONT_DISTRIBUTION_ID" --id "$INVALIDATION_ID"
1 change: 1 addition & 0 deletions src/seed_tools/commands/create_seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default new Command('create_seed')
.option(
'--serial_number_path <path>',
'file path to write the serial number to',
'./serialnumber',
)
.option('--mock_serial_number <value>', 'mock serial number')
.action(main);
Expand Down
35 changes: 35 additions & 0 deletions studies/AdBlockComponentUpdateIntervalStudy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"name": "AdBlockComponentUpdateIntervalStudy",
"experiment": [
{
"name": "Enabled",
"probability_weight": 100,
"feature_association": {
"enable_feature": [
"AdBlockDefaultResourceUpdateInterval"
]
},
"param": [
{
"name": "update_interval_mins",
"value": "1"
}
]
}
],
"filter": {
"channel": [
"NIGHTLY",
"BETA",
"RELEASE"
],
"platform": [
"PLATFORM_WINDOWS",
"PLATFORM_MAC",
"PLATFORM_LINUX",
"PLATFORM_ANDROID"
]
}
}
]

0 comments on commit 7802f64

Please sign in to comment.