Skip to content

Bump the artifacts group across 1 directory with 2 updates #9959

Bump the artifacts group across 1 directory with 2 updates

Bump the artifacts group across 1 directory with 2 updates #9959

Workflow file for this run

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
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
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/cache@v4.0.2
if: ${{ !env.ACT }}
with:
path: .webpack
key: webpack-${{ github.head_ref || github.ref_name }}
restore-keys: webpack-
- name: 'Build assets'
run: npm run build:assets
- name: 'Upload assets'
uses: actions/upload-artifact@v4.3.3
with:
name: assets
path: dist/assets
- name: 'Upload manifest'
uses: actions/upload-artifact@v4.3.3
with:
name: manifest
path: src/manifest.json
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/checkout@v4.1.1
- name: 'Set up Docker Build'
uses: docker/setup-buildx-action@v3.3.0
- name: 'Build image'
id: build
uses: docker/build-push-action@v5.3.0
with:
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/upload-artifact@v4.3.3
with:
name: image
path: /tmp/image.tar
format:
name: 'Format'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
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:
name: 'Lint'
runs-on: ubuntu-22.04
timeout-minutes: 30
needs:
- build-assets
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
with:
node-version-file: package.json
cache: ${{ !env.ACT && 'npm' || '' }}
- name: 'Install dependencies'
run: npm ci --ignore-scripts
- name: 'Download assets manifest'
uses: actions/download-artifact@v4.1.7
with:
name: manifest
path: src
- name: 'Run the linters'
run: npm run lint
test:
name: 'Test (${{ matrix.shard }}/${{ strategy.job-total }})'
runs-on: ubuntu-22.04
timeout-minutes: 30
needs:
- build-assets
strategy:
fail-fast: false
matrix:
shard: [1, 2]
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
with:
node-version-file: package.json
cache: ${{ !env.ACT && 'npm' || '' }}
- name: 'Install dependencies'
run: npm ci --ignore-scripts
- name: 'Download assets manifest'
uses: actions/download-artifact@v4.1.7
with:
name: manifest
path: src
- 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
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- name: 'Checkout code'
uses: nschloe/action-cached-lfs-checkout@v1.2.2
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
with:
node-version-file: package.json
cache: ${{ !env.ACT && 'npm' || '' }}
- name: 'Install dependencies'
run: npm ci --ignore-scripts
- name: 'Download assets'
uses: actions/download-artifact@v4.1.7
with:
name: assets
path: dist/assets
- name: 'Download assets manifest'
uses: actions/download-artifact@v4.1.7
with:
name: manifest
path: src
- name: 'Run Playwright'
id: 'playwright'
uses: docker://mcr.microsoft.com/playwright:v1.42.1-jammy
with:
args: env HOME=/root npx playwright test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }} --retries 4
- name: 'Store results'
if: failure() && steps.playwright.outcome == 'failure'
uses: actions/upload-artifact@v4.3.3
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
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Download image'
uses: actions/download-artifact@v4.1.7
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-web:
name: 'Web Tests'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
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: 'Run the tests'
run: npx web-test-runner
typecheck:
name: 'Typecheck'
runs-on: ubuntu-22.04
timeout-minutes: 30
needs:
- build-assets
steps:
- name: 'Checkout code'
uses: actions/checkout@v4.1.1
- name: 'Set up Node.js'
uses: actions/setup-node@v4.0.2
with:
node-version-file: package.json
cache: ${{ !env.ACT && 'npm' || '' }}
- name: 'Install dependencies'
run: npm ci --ignore-scripts
- name: 'Download assets manifest'
uses: actions/download-artifact@v4.1.7
with:
name: manifest
path: src
- 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
- test
- test-integration
- test-smoke
- test-web
- typecheck
steps:
- name: 'Set up flyctl'
uses: superfly/flyctl-actions/setup-flyctl@1.5
- name: 'Log in to the registry'
run: flyctl auth docker
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
- name: 'Download image'
uses: actions/download-artifact@v4.1.7
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/checkout@v4.1.1
with:
sparse-checkout: fly.${{ matrix.instance }}.toml
sparse-checkout-cone-mode: false
- name: 'Set up flyctl'
uses: superfly/flyctl-actions/setup-flyctl@1.5
- name: 'Deploy app'
run: flyctl deploy --config fly.${{ matrix.instance }}.toml --image ${{ needs.push.outputs.image }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_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/github-action-slack-notify-build@v1.6.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
with:
channel_id: G015ZLXJA9W
status: FAILED
color: danger