Skip to content

CI

CI #2687

Workflow file for this run

name: CI
on: [push, pull_request]
env:
CI: true
API_DEPLOY_PATH: packages/api/dist
API_INTEG_APP_NAME: ops-suite-api-integration
API_PROD_APP_NAME: ops-suite-api-prod
API_DEMO_APP_NAME: ops-suite-api-demo
WEBAPP_INTEG_STORAGE_ACCOUNT: 'opssuitewebappinteg'
WEBAPP_PROD_STORAGE_ACCOUNT: 'opssuitewebappprod'
WEBAPP_DEMO_STORAGE_ACCOUNT: 'opssuitewebappdemo'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 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 }}
- 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']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING_INTEG }}
- name: 'Deploy Integ API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.API_INTEG_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_INTEG_PUBLISH_PROFILE }}
- name: Deploy Integ Webapp
run: yarn build:webapp:integ && yarn deploy:webapp
env:
WEBAPP_STORAGE_ACCOUNT: ${{ env.WEBAPP_INTEG_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_INTEG_STORAGE_KEY }}
APPLICATION_INSIGHTS_INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_INTEG_APPINSIGHTS_KEY }}
FIREBASE_API_KEY: ${{ secrets.WEBAPP_FIREBASE_API_KEY }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.WEBAPP_FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_APP_ID: ${{ secrets.WEBAPP_FIREBASE_APP_ID }}
FIREBASE_MEASUREMENT_ID: ${{ secrets.WEBAPP_FIREBASE_MEASUREMENT_ID }}
FIREBASE_VAPID_SERVER_KEY: ${{ secrets.WEBAPP_FIREBASE_VAPID_SERVER_KEY }}
deploy-demo:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: ['build']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING_DEMO }}
- name: 'Deploy Demo API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.API_DEMO_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_DEMO_PUBLISH_PROFILE }}
- name: Deploy Demo Webapp
run: yarn build:webapp:demo && yarn deploy:webapp
env:
WEBAPP_STORAGE_ACCOUNT: ${{ env.WEBAPP_DEMO_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_DEMO_STORAGE_KEY }}
APPLICATION_INSIGHTS_INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_DEMO_APPINSIGHTS_KEY }}
FIREBASE_API_KEY: ${{ secrets.WEBAPP_FIREBASE_API_KEY }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.WEBAPP_FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_APP_ID: ${{ secrets.WEBAPP_FIREBASE_APP_ID }}
FIREBASE_MEASUREMENT_ID: ${{ secrets.WEBAPP_FIREBASE_MEASUREMENT_ID }}
FIREBASE_VAPID_SERVER_KEY: ${{ secrets.WEBAPP_FIREBASE_VAPID_SERVER_KEY }}
deploy-production:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: ['build']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING_PROD }}
- name: 'Deploy Production API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.API_PROD_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PROD_PUBLISH_PROFILE }}
- name: Deploy Production Webapp
run: yarn build:webapp:prod && yarn deploy:webapp
env:
WEBAPP_STORAGE_ACCOUNT: ${{ env.WEBAPP_PROD_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_PROD_STORAGE_KEY }}
APPLICATION_INSIGHTS_INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_PROD_APPINSIGHTS_KEY }}
FIREBASE_API_KEY: ${{ secrets.WEBAPP_FIREBASE_API_KEY }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.WEBAPP_FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_APP_ID: ${{ secrets.WEBAPP_FIREBASE_APP_ID }}
FIREBASE_MEASUREMENT_ID: ${{ secrets.WEBAPP_FIREBASE_MEASUREMENT_ID }}
FIREBASE_VAPID_SERVER_KEY: ${{ secrets.WEBAPP_FIREBASE_VAPID_SERVER_KEY }}