Skip to content

Merge pull request #348 from concord-consortium/186921649-report-item… #854

Merge pull request #348 from concord-consortium/186921649-report-item…

Merge pull request #348 from concord-consortium/186921649-report-item… #854

Workflow file for this run

name: Continuous Integration
on: push
jobs:
build_test:
name: Build and Run Jest Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run Tests
run: npm run test
cypress:
runs-on: ubuntu-latest
timeout-minutes: 12
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run 3 copies of the current job in parallel
containers: [1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Start server in the background
run: npm start &
- uses: cypress-io/github-action@v4
with:
# we have already installed all dependencies above
install: false
working-directory: ./packages/tecrock-simulation
browser: chrome
spec: cypress/e2e/basic/**/*
# only record the results to dashboard.cypress.io if CYPRESS_RECORD_KEY is set
record: ${{ !!secrets.CYPRESS_RECORD_KEY }}
# only do parallel if we have a record key
parallel: ${{ !!secrets.CYPRESS_RECORD_KEY }}
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# turn on code coverage when running npm start
# so far we've been using a webpack istanbul-instrumenter-loader for this
# but there has been work on building code coverage into node itself, which
# should be much faster
CODE_COVERAGE: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
flags: cypress
s3-deploy:
name: S3 Deploy
needs:
- build_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Depndencies
run: npm ci
env:
# skip installing cypress since it isn't needed for just building
# This decreases the deploy time quite a bit
CYPRESS_INSTALL_BINARY: 0
- uses: concord-consortium/s3-deploy-action@v1
with:
bucket: models-resources
prefix: tectonic-explorer
awsAccessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }}
awsSecretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Parameters to GHActions have to be strings, so a regular yaml array cannot
# be used. Instead the `|` turns the following lines into a string
topBranches: |
["master"]