Skip to content

Scriptoria CI

Scriptoria CI #717

Workflow file for this run

name: Scriptoria CI
on:
push:
pull_request:
workflow_dispatch:
inputs:
logLevel:
description: "Log Level"
required: true
default: "warning"
tags:
description: "Tags"
schedule:
- cron: "0 0 * * 0" # weekly
jobs:
build:
runs-on: ubuntu-20.04
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOY__AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOY__AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.DEPLOY__AWS_DEFAULT_REGION }}
AWS_ECR_ACCOUNT: ${{ secrets.DEPLOY__AWS_ECR_ACCOUNT }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Get environment info
run: |
echo Python version
python --version
pip --version
echo
echo Node version
node --version
yarn --version
npm --version
echo
echo Docker version
docker --version
docker-compose --version
echo
echo Env
env
- name: Frontend linting
run: ./run yarn && ./run yarn lint --quiet
- name: Frontend tests
run: |
COVERAGE=true ./run yarn && ./run yarn test:ci
- name: Backend tests
run: |
echo "building docker containers..."
time ( ./run ci:build > /dev/null 2>&1 )
echo "docker containers built!"
echo "Running the backend commands..."
time ( ./run ci:api )
- name: Configure AWS credentials (SIL)
id: aws_sil
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.DEPLOY__AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEPLOY__AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.DEPLOY__AWS_DEFAULT_REGION }}
- name: Login to AWS ECR (SIL)
id: ecr_sil
uses: aws-actions/amazon-ecr-login@v1
with:
registries: ${{ secrets.DEPLOY__AWS_ECR_ACCOUNT }}
- name: Build nginx
run: ./scripts/build-nginx.sh $GITHUB_SHA $GITHUB_REF $GITHUB_EVENT_NAME
- name: Build API
run: ./scripts/build-api.sh $GITHUB_SHA $GITHUB_REF $GITHUB_EVENT_NAME
- name: Deploy
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch') && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
run: ./scripts/deploy-to-ecs.sh $GITHUB_SHA $GITHUB_REF