Skip to content

SW-5331 Show loading page when determining module projects (#2607) #9649

SW-5331 Show loading page when determining module projects (#2607)

SW-5331 Show loading page when determining module projects (#2607) #9649

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Deployment
on:
push:
branches:
- main
- qa
tags:
# Semver (these are glob-like patterns, not regexes; the "." has no special meaning)
- v[0-9].[0-9]+.[0-9]+
# Date-based
- v2[0-9]+.[0-9]+
pull_request:
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
# Cancel in-progress builds on PRs, but not on staging deploys.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Environment
run: ./.github/scripts/set-environment.sh
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-yarn-2-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
# This is currently failing because the server hasn't been started yet.
# Additionally, it's not enough to just output the generated types file.
# We need to create a script that checks that our types file is up to date.
#- name: generate schemas
# run: yarn generate-types
- name: Check that code is formatted
run: yarn prettier --check .
- name: Generate strings
run: yarn generate-strings
- name: Run linter
run: yarn lint
- name: Do typescript check
run: yarn ts
- name: Run unit tests
run: yarn test --ci
- name: Download and start backend
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
run: yarn server:reset
env:
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KEYCLOAK_ISSUERURI: https://auth.staging.terraware.io/realms/terraware
SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_CLIENTSECRET: dummy
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI: https://auth.staging.terraware.io/realms/terraware
TERRAWARE_MAPBOX_API_TOKEN: ${{ secrets.REACT_APP_MAPBOX_TOKEN }}
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run end-to-end playwright tests
# Skip tests on main and releases because of Cypress hanging bug
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
run: yarn test:e2e
env:
REACT_APP_TERRAWARE_API: 'http://localhost:8080'
REACT_APP_SNACKBAR_TIMEOUT: 1000
REACT_APP_TERRAWARE_FE_BUILD_VERSION: ${{ env.APP_VERSION }}
- name: save screenshots of e2e test failures
if: failure()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: build
run: yarn build
env:
REACT_APP_TERRAWARE_API: ''
REACT_APP_TERRAWARE_FE_BUILD_VERSION: ${{ env.APP_VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker login
if: env.IS_CD == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker build/push
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha, mode=max
tags: ${{ env.DOCKER_TAGS }}
platforms: linux/amd64,linux/arm64
push: ${{ env.IS_CD == 'true' }}
- name: Configure AWS Credentials
if: env.IS_CD == 'true'
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: ${{ secrets[env.AWS_REGION_SECRET_NAME] }}
role-to-assume: ${{ secrets[env.AWS_ROLE_SECRET_NAME] }}
- name: Connect to Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TAILSCALE_OAUTH_CLIENT_SECRET }}
tags: tag:github
- name: Deploy
if: env.IS_CD == 'true'
env:
SSH_KEY: ${{ secrets[env.SSH_KEY_SECRET_NAME] }}
SSH_USER: ${{ secrets[env.SSH_USER_SECRET_NAME] }}
run: ./.github/scripts/deploy.sh
- name: Jira Login
if: env.TIER == 'PROD'
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Create Jira Transition List
if: env.TIER == 'PROD'
run: curl https://terraware.github.io/terraware-web/unreleased.log | grep -E 'SW-[0-9]+' -o | sort -u > ./docs/jiralist.txt
- name: Transition Jiras
if: env.TIER == 'PROD'
uses: terraware/gajira-transition-multiple@master
with:
issueList: ./docs/jiralist.txt
transition: 'Released to Production from Done'