Bump cookie from 0.7.2 to 1.0.1 #12678
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: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
jobs: | |
build-assets: | |
name: 'Build assets' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-locales | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Set up assets cache' | |
uses: actions/[email protected] | |
if: ${{ !env.ACT }} | |
with: | |
path: .cache/webpack | |
key: webpack-${{ github.head_ref || github.ref_name }} | |
restore-keys: webpack- | |
- name: 'Download assets locales' | |
uses: actions/[email protected] | |
with: | |
name: locales-assets | |
path: assets/locales | |
- name: 'Build assets' | |
run: npm run build:assets | |
- name: 'Upload assets' | |
uses: actions/[email protected] | |
with: | |
name: assets | |
path: dist/assets | |
- name: 'Upload manifest' | |
uses: actions/[email protected] | |
with: | |
name: manifest | |
path: src/manifest.json | |
build-locales: | |
name: 'Build locales' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up intlc' | |
uses: unsplash/[email protected] | |
with: | |
version: 0.8.3 | |
- name: 'Set up mo' | |
uses: shrink/[email protected] | |
with: | |
image: ghcr.io/tests-always-included/mo:3.0.5 | |
path: /usr/local/bin/mo | |
destination: /usr/local/bin | |
- name: 'Build locales' | |
run: scripts/intlc.sh | |
- name: 'Upload locales' | |
uses: actions/[email protected] | |
with: | |
name: locales | |
path: src/locales | |
- name: 'Upload assets locales' | |
uses: actions/[email protected] | |
with: | |
name: locales-assets | |
path: assets/locales | |
build-image: | |
name: 'Build image' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
outputs: | |
image: ${{ steps.build.outputs.imageid }} | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Docker Build' | |
uses: docker/[email protected] | |
- name: 'Build image' | |
id: build | |
uses: docker/[email protected] | |
with: | |
context: . | |
outputs: type=docker,dest=/tmp/image.tar | |
cache-from: type=gha,ignore-error=true | |
cache-to: type=gha,mode=max,ignore-error=true | |
- name: 'Upload build' | |
uses: actions/[email protected] | |
with: | |
name: image | |
path: /tmp/image.tar | |
format: | |
name: 'Format' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Run formatter' | |
run: npm run format | |
lint-css: | |
name: 'Lint CSS' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Run the linter' | |
run: npm run lint:css | |
lint-ts: | |
name: 'Lint TypeScript' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-assets | |
- build-locales | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Download assets manifest' | |
uses: actions/[email protected] | |
with: | |
name: manifest | |
path: src | |
- name: 'Download locales' | |
uses: actions/[email protected] | |
with: | |
name: locales | |
path: src/locales | |
- name: 'Download assets locales' | |
uses: actions/[email protected] | |
with: | |
name: locales-assets | |
path: assets/locales | |
- name: 'Run the linter' | |
run: npm run lint:ts | |
test: | |
name: 'Test (${{ matrix.shard }}/${{ strategy.job-total }})' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-assets | |
- build-locales | |
strategy: | |
fail-fast: false | |
matrix: | |
shard: [1, 2] | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Download assets manifest' | |
uses: actions/[email protected] | |
with: | |
name: manifest | |
path: src | |
- name: 'Download locales' | |
uses: actions/[email protected] | |
with: | |
name: locales | |
path: src/locales | |
- name: 'Run the tests' | |
run: npm run test -- --shard=${{ matrix.shard }}/${{ strategy.job-total }} | |
test-integration: | |
name: 'Integration test (${{ matrix.shard }}/${{ strategy.job-total }})' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-assets | |
- build-locales | |
strategy: | |
fail-fast: false | |
matrix: | |
shard: [1, 2, 3, 4, 5] | |
steps: | |
- name: 'Checkout code' | |
uses: nschloe/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Download assets' | |
uses: actions/[email protected] | |
with: | |
name: assets | |
path: dist/assets | |
- name: 'Download assets manifest' | |
uses: actions/[email protected] | |
with: | |
name: manifest | |
path: src | |
- name: 'Download locales' | |
uses: actions/[email protected] | |
with: | |
name: locales | |
path: src/locales | |
- name: 'Run Playwright' | |
id: 'playwright' | |
uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy | |
with: | |
args: env HOME=/root npx playwright test integration --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }} --retries 4 | |
- name: 'Store results' | |
if: failure() && steps.playwright.outcome == 'failure' | |
uses: actions/[email protected] | |
with: | |
name: integration-tests-results-${{ matrix.shard }} | |
path: integration-results | |
test-smoke: | |
name: 'Smoke test' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-image | |
services: | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Download image' | |
uses: actions/[email protected] | |
with: | |
name: image | |
path: /tmp | |
- name: 'Load image' | |
run: docker load --input /tmp/image.tar | |
- name: 'Run smoke test' | |
run: scripts/smoke-test.sh ${{ needs.build-image.outputs.image }} | |
test-visual-regression: | |
name: 'Visual regression test (${{ matrix.shard }}/${{ strategy.job-total }})' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-assets | |
- build-locales | |
strategy: | |
fail-fast: false | |
matrix: | |
shard: [1, 2, 3, 4, 5] | |
steps: | |
- name: 'Checkout code' | |
uses: nschloe/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Download assets' | |
uses: actions/[email protected] | |
with: | |
name: assets | |
path: dist/assets | |
- name: 'Download assets manifest' | |
uses: actions/[email protected] | |
with: | |
name: manifest | |
path: src | |
- name: 'Download locales' | |
uses: actions/[email protected] | |
with: | |
name: locales | |
path: src/locales | |
- name: 'Run Playwright' | |
id: 'playwright' | |
uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy | |
with: | |
args: env HOME=/root npx playwright test visual-regression --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }} --retries 4 | |
- name: 'Store results' | |
if: failure() && steps.playwright.outcome == 'failure' | |
uses: actions/[email protected] | |
with: | |
name: visual-regression-tests-results-${{ matrix.shard }} | |
path: integration-results | |
test-web: | |
name: 'Web Tests' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-locales | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Install browser dependencies' | |
run: npx playwright install-deps | |
- name: 'Install browsers' | |
run: npx playwright install | |
- name: 'Download assets locales' | |
uses: actions/[email protected] | |
with: | |
name: locales-assets | |
path: assets/locales | |
- name: 'Run the tests' | |
run: npx web-test-runner | |
typecheck: | |
name: 'Typecheck' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- build-assets | |
- build-locales | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
- name: 'Set up Node.js' | |
uses: actions/[email protected] | |
with: | |
node-version-file: package.json | |
cache: ${{ !env.ACT && 'npm' || '' }} | |
- name: 'Install dependencies' | |
run: npm ci --ignore-scripts | |
- name: 'Download assets manifest' | |
uses: actions/[email protected] | |
with: | |
name: manifest | |
path: src | |
- name: 'Download locales' | |
uses: actions/[email protected] | |
with: | |
name: locales | |
path: src/locales | |
- name: 'Download assets locales' | |
uses: actions/[email protected] | |
with: | |
name: locales-assets | |
path: assets/locales | |
- name: 'Run typechecker' | |
run: npm run typecheck | |
push: | |
name: 'Push image' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
image: ${{ steps.image.outputs.image }} | |
needs: | |
- build-image | |
- format | |
- lint-css | |
- lint-ts | |
- test | |
- test-integration | |
- test-smoke | |
- test-visual-regression | |
- test-web | |
- typecheck | |
steps: | |
- name: 'Set up flyctl' | |
uses: superfly/flyctl-actions/[email protected] | |
- name: 'Log in to the registry' | |
run: flyctl auth docker | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: 'Download image' | |
uses: actions/[email protected] | |
with: | |
name: image | |
path: /tmp | |
- name: 'Load image' | |
run: docker load --input /tmp/image.tar | |
- name: 'Generate image name' | |
id: image | |
run: echo "image=registry.fly.io/prereview:${{ github.sha }}" >> $GITHUB_OUTPUT | |
- name: 'Tag image' | |
run: docker tag ${{ needs.build-image.outputs.image }} ${{ steps.image.outputs.image }} | |
- name: 'Push image' | |
run: docker push ${{ steps.image.outputs.image }} | |
deploy: | |
name: 'Deploy (${{ matrix.instance }})' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- push | |
strategy: | |
fail-fast: false | |
matrix: | |
instance: ['prod', 'sandbox'] | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
with: | |
sparse-checkout: fly.${{ matrix.instance }}.toml | |
sparse-checkout-cone-mode: false | |
- name: 'Set up flyctl' | |
uses: superfly/flyctl-actions/[email protected] | |
- name: 'Deploy app' | |
run: flyctl deploy --config fly.${{ matrix.instance }}.toml --image ${{ needs.push.outputs.image }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
crowdin: | |
name: 'Update Crowdin' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- deploy | |
steps: | |
- name: 'Checkout code' | |
uses: actions/[email protected] | |
with: | |
sparse-checkout: | | |
locales/en-US/ | |
crowdin.yml | |
sparse-checkout-cone-mode: false | |
- name: 'Upload sources to Crowdin' | |
uses: crowdin/[email protected] | |
with: | |
upload_sources: true | |
upload_translations: false | |
download_sources: false | |
download_translations: false | |
env: | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | |
notify: | |
name: 'Notify of failure' | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
needs: | |
- deploy | |
if: failure() && github.ref == 'refs/heads/main' | |
steps: | |
- uses: voxmedia/[email protected] | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} | |
with: | |
channel_id: G015ZLXJA9W | |
status: FAILED | |
color: danger |