Skip to content

CI

CI #2693

Workflow file for this run

name: CI
on: [push, pull_request]
env:
CI: true
API_DEPLOY_PATH: packages/api/dist
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
BEACON_KEY: ${{ secrets.BEACON_KEY }}
CONTACT_US_EMAIL: ${{ secrets.CONTACT_US_EMAIL }}
COPYRIGHT_HOLDER: ${{ secrets.COPYRIGHT_HOLDER }}
FIREBASE_API_KEY: ${{ secrets.WEBAPP_FIREBASE_API_KEY }}
FIREBASE_APP_ID: ${{ secrets.WEBAPP_FIREBASE_APP_ID }}
FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
FIREBASE_MEASUREMENT_ID: ${{ secrets.WEBAPP_FIREBASE_MEASUREMENT_ID }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.WEBAPP_FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
FIREBASE_VAPID_SERVER_KEY: ${{ secrets.WEBAPP_FIREBASE_VAPID_SERVER_KEY }}
PRIVACY_POLICY_URL: ${{ secrets.PRIVACY_POLICY_URL }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
services:
mongodb:
image: mongo
ports:
- 27017:27017
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn build:schema
- run: 'yarn lint:'
- run: 'yarn assets:'
- run: 'yarn test:'
- run: 'yarn build:'
- run: yarn install:playwright_deps
- run: yarn acceptance:test
- run: yarn git_is_clean
deploy-integ:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'
needs: ['build']
environment: integ
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Integ API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Integ Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}
deploy-staging:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging'
needs: ['build']
environment: staging
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Staging API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Staging Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}
deploy-demo:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: ['build']
environment: demo
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Demo API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Demo Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}
deploy-production:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: ['build']
environment: prod
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Production API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Production Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}