Increase android onboarding study to 50% for release channel #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Test Seed | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/generate-test-seed.yml' | |
- 'studies/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ACTION_RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' | |
BASE_SHA: '${{ github.event.pull_request.base.sha }}' | |
HEAD_SHA: '${{ github.event.pull_request.head.sha }}' | |
REMOTE_SEED_PATH: 'pull/${{ github.event.pull_request.number }}/seed' | |
SEED_VERSION: 'pull/${{ github.event.pull_request.number }}@${{ github.sha }}' | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Fetch base commit | |
run: git fetch --depth=1 origin "$BASE_SHA" | |
- name: Comment "Generation In Progress" | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const actionRunURL = `${process.env.ACTION_RUN_URL}`; | |
const commentBody = | |
`## 🔄 Generating Test Seed | |
A new test seed file is currently being generated for this pull request. | |
### What's Next? | |
- The generation process typically takes a few minutes. | |
- Once the generation is complete, this comment will provide further instructions. | |
- If the generation takes longer than 5 minutes, please review the [workflow logs](${actionRunURL}). | |
` | |
const comment = require('.github/workflows/scripts/comment.js') | |
await comment(github, context, commentBody) | |
- name: Install | |
run: npm ci | |
- name: Generate seed | |
run: | | |
npm run seed_tools create -- --version "$SEED_VERSION" | |
- 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 }} | |
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" | |
- name: Comment "Generation Successful" | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const fs = require('fs'); | |
const variationsServerURL = `https://griffin.brave.com/${process.env.REMOTE_SEED_PATH}`; | |
const serialNumberContent = fs.readFileSync('serialnumber', 'utf8'); | |
const commentBody = | |
`## ✅ Test Seed Generated Successfully | |
To apply the test seed: | |
1. **Desktop**: Launch the browser with \`--variations-pr=${{ github.event.pull_request.number }}\`. | |
**Android**: Set the command line to \`--variations-pr=${{ github.event.pull_request.number }}\` in debug menu, restart the browser. | |
**iOS**: Set \`Variations PR\` to \`${{ github.event.pull_request.number }}\` in \`Brave Core Switches\` debug menu, restart the browser. | |
2. Wait 5-10 seconds to fetch the seed. | |
3. Restart the browser to apply the seed. | |
4. Ensure **Active Variations** section at \`brave://version\` starts with the expected seed version (see below). | |
### Seed Details | |
|Parameter|Value| | |
|--------|--------| | |
|Version|\`${process.env.SEED_VERSION}\`| | |
|Uploaded|${new Date().toUTCString()}| | |
|PR commit|${process.env.HEAD_SHA}| | |
|Base commit|${process.env.BASE_SHA}| | |
|Merge commit|${process.env.GITHUB_SHA}| | |
|Serial number|\`${serialNumberContent}\`| | |
` | |
const comment = require('.github/workflows/scripts/comment.js') | |
await comment(github, context, commentBody) | |
- name: Comment "Generation Failed" | |
if: failure() | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const actionRunURL = `${process.env.ACTION_RUN_URL}`; | |
const commentBody = | |
`## ❌ Test Seed Generation Failed | |
[Workflow logs for more information.](${actionRunURL}) | |
` | |
const comment = require('.github/workflows/scripts/comment.js') | |
await comment(github, context, commentBody) |