Skip to content

v9.54.5

v9.54.5 #153

Workflow file for this run

name: Continuous deployment
on:
release:
types: [published, edited]
env:
NX_SKIP_NX_CACHE: ${{ vars.NX_SKIP_NX_CACHE_VALUE }}
jobs:
buildDevFrontEnds:
env:
NODE_OPTIONS: --max_old_space_size=6144
name: Build development front end apps
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app:
- account
- platform
- simulators
- dispatch
- projex
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Install dependencies
run: |
sudo apt-get update \
&& sudo apt-get -y install \
build-essential \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev
- name: Install npm dependencies
uses: bahmutov/npm-install@v1
with:
useRollingCache: true
- name: Build dev app
run: |
mv libs/shared/environments/src/lib/environment.stage.ts libs/shared/environments/src/lib/environment.prod.ts \
&& npx nx build ${{matrix.app}} --prod
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: ${{matrix.app}}-dev
path: dist/apps/${{matrix.app}}
retention-days: 5
if-no-files-found: error
buildProdFrontEnds:
env:
NODE_OPTIONS: --max_old_space_size=6144
name: Build production front end apps
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app:
- account
- platform
- simulators
- dispatch
- projex
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Install dependencies
run: |
sudo apt-get update \
&& sudo apt-get -y install \
build-essential \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev
- name: Install npm dependencies
uses: bahmutov/npm-install@v1
with:
useRollingCache: true
- name: Build prod app
run: npx nx build ${{matrix.app}} --prod
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: ${{matrix.app}}-prod
path: dist/apps/${{matrix.app}}
retention-days: 5
if-no-files-found: error
buildPushDockerImages:
name: Build and push backend Docker images
uses: ./.github/workflows/docker.yml
secrets:
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
deployDevFrontend:
name: Publish the development frontend
runs-on: ubuntu-latest
needs:
- buildDevFrontEnds
- buildPushDockerImages
environment: dev_environment
strategy:
matrix:
app:
- account
- platform
- simulators
- dispatch
- projex
steps:
- name: Install Node.js
uses: actions/setup-node@v3.3.0
with:
node-version: '18'
- name: Install Netlify CLI
run: npm install -g netlify-cli
- name: Download build for app
uses: actions/download-artifact@v2
with:
name: ${{matrix.app}}-dev
- name: Push app
env:
idKey: ${{matrix.app}}_site_id
NETLIFY_AUTH_TOKEN: ${{secrets.NETLIFY_AUTH_TOKEN}}
run: |
export NETLIFY_SITE_ID=${{secrets[env.idKey]}}
export NETLIFY_AUTH_TOKEN=${{secrets.NETLIFY_AUTH_TOKEN}}
netlify deploy --prod
triggerDevDeployment:
name: Trigger a new deployment of the dev backend
runs-on: ubuntu-latest
needs:
- buildPushDockerImages
- buildDevFrontEnds
environment: dev_environment
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Call webhook
env:
GHCR_USERNAME: "${{ secrets.GHCR_USERNAME }}"
GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}"
BRANCH: ${{ secrets.OVERLAY }}
run: |
git_sha=$(git rev-parse --short "$GITHUB_SHA")
echo '{"ref": "main","inputs":{"overlay": "'$BRANCH'","tag":"'${{github.ref_name}}'"}}' >body
curl -X POST 'https://api.github.com/repos/biosimulations/deployment/actions/workflows/deploy.yml/dispatches' \
-H 'Authorization: Bearer ${{ secrets.GHCR_TOKEN }}' \
-H 'Content-Type: application/json' \
--data "@body"
testDevDeployment:
name: Test the development deployment
runs-on: ubuntu-latest
needs:
- triggerDevDeployment
environment: dev_test_environment
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
architecture: "x64"
- name: Install requirements
run: python -m pip install -r tools/submit-example-simulation-runs.requirements.txt
- name: Run test against API
run: |
./tools/submit-example-simulation-runs \
--runbiosimulations-deployment dev \
--biosimulators-deployment dev \
--test true \
--stress 1
reviewDevDeploymentTests:
name: Review the tests of the development deployment
runs-on: ubuntu-latest
needs:
- buildPushDockerImages
- buildProdFrontEnds
- deployDevFrontend
- testDevDeployment
if: ${{ always() }}
# environment: review_dev_deployment_tests_environment
steps:
- name: Print status message
run: |
echo "The tests of the development deployment were reviewed."
deployProdFrontend:
name: Publish the production frontend
runs-on: ubuntu-latest
needs:
- reviewDevDeploymentTests
# if: jobs.reviewDevDeploymentTests.result == 'success'
environment: prod_environment
strategy:
matrix:
app:
- account
- platform
- simulators
- dispatch
- projex
steps:
- name: Install Node.js
uses: actions/setup-node@v3.3.0
with:
node-version: '18'
- name: Download build for app
uses: actions/download-artifact@v2
with:
name: ${{matrix.app}}-prod
- name: Push app
env:
idKey: ${{matrix.app}}_site_id
NETLIFY_AUTH_TOKEN: ${{secrets.NETLIFY_AUTH_TOKEN}}
run: |
export NETLIFY_SITE_ID=${{secrets[env.idKey]}}
export NETLIFY_AUTH_TOKEN=${{secrets.NETLIFY_AUTH_TOKEN}}
netlify deploy --prod
triggerProdDeployment:
name: Trigger a new deployment of the production backend
runs-on: ubuntu-latest
needs:
- reviewDevDeploymentTests
# if: jobs.reviewDevDeploymentTests.result == 'success'
environment: prod_environment
steps:
- name: Checkout repository
uses: actions/checkout@v2.4.2
- name: Call webhook
env:
GHCR_USERNAME: "${{ secrets.GHCR_USERNAME }}"
GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}"
BRANCH: ${{ secrets.OVERLAY }}
run: |
git_sha=$(git rev-parse --short "$GITHUB_SHA")
echo '{"ref": "main","inputs":{"overlay": "'$BRANCH'","tag":"'${{github.ref_name}}'"}}' >body
curl -X POST 'https://api.github.com/repos/biosimulations/deployment/actions/workflows/deploy.yml/dispatches' \
-H 'Authorization: Bearer ${{ secrets.GHCR_TOKEN }}' \
-H 'Content-Type: application/json' \
--data "@body"