feat: side by side (#977) #455
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: Deploy Explorer (Happy) | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
- prod | |
env: | |
DOCKER_BUILDKIT: 1 | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
DOCKER_REPO: ${{ secrets.ECR_REPO }}/ | |
DEPLOYMENT_STAGE: ${{ github.ref == 'refs/heads/prod' && 'prod' || github.ref == 'refs/heads/staging' && 'stage' || 'dev' }} | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
upgrade: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Configure AWS Prod Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
if: github.ref == 'refs/heads/prod' | |
with: | |
aws-region: us-west-2 | |
role-to-assume: ${{ secrets.AWS_PROD_ROLE_TO_ASSUME }} | |
role-duration-seconds: 900 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
if: github.ref != 'refs/heads/prod' | |
with: | |
aws-region: us-west-2 | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-duration-seconds: 900 | |
- name: Login to ECR | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ secrets.ECR_REPO }} | |
- uses: actions/checkout@v2 | |
- name: Setup envfile | |
run: | | |
mkdir /home/runner/work/custom | |
touch /home/runner/work/custom/envfile | |
echo "HAPPY_COMMIT=$(git rev-parse --verify HEAD)" > /home/runner/work/custom/envfile | |
- name: Update deployment | |
uses: chanzuckerberg/github-actions/.github/actions/deploy-happy-stack@deploy-happy-stack-v1.7.2 | |
with: | |
tfe-token: ${{ secrets.TFE_TOKEN }} | |
stack-name: explorer-${{ env.DEPLOYMENT_STAGE }}stack | |
create-tag: "true" | |
env: ${{ env.DEPLOYMENT_STAGE }} | |
env-file: /home/runner/work/custom/envfile | |
happy_version: "0.79.1" | |
smoke-test: | |
# (thuang): We now run the smoke tests against 2 datasets sequentially, so need longer timeout | |
timeout-minutes: 60 | |
runs-on: ubuntu-22.04 | |
needs: | |
- upgrade | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
working-directory: ./client | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: "client/.nvmrc" | |
cache: "npm" | |
cache-dependency-path: "client/package-lock.json" | |
- name: Install dependencies | |
run: | | |
npm ci | |
npx playwright install --with-deps | |
# Run e2e tests | |
- name: Run e2e tests | |
run: | | |
npm run e2e-${DEPLOYMENT_STAGE} | |
- name: Publish to Chromatic | |
uses: chromaui/action@latest | |
with: | |
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
workingDir: ./client | |
# This is `npm run build-archive-storybook` | |
buildScriptName: "build-archive-storybook" | |
- name: Upload FE test results as an artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report | |
path: ~/**/playwright-report/* | |
retention-days: 14 | |
- name: Upload blob report to GitHub Actions Artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: all-blob-reports | |
path: ~/**/blob-report/* | |
retention-days: 1 |