Merge pull request #248 from ral-facilities/DSEGOG-251-improvements-t… #1495
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Build | |
on: | |
pull_request: | |
# By default, the pull_request event type is not triggered when a PR is merged into main | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3 | |
with: | |
node-version: '16.x' | |
# Cache yarn dependencies / restore the cached dependencies during future workflows | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn dependencies | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
# Ubuntu 16+ does not install libgconf-2-4 by default, so we need to install it ourselves (for Cypress) | |
run: | | |
npm config set scripts-prepend-node-path true | |
sudo apt-get install libgconf-2-4 | |
yarn --frozen-lockfile | |
- name: Run linting | |
run: yarn lint:js | |
- name: Run unit tests | |
run: yarn test | |
- name: Upload unit test coverage | |
if: success() | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3 | |
- name: Run e2e tests | |
run: yarn e2e | |
- name: Upload Cypress screenshots | |
if: failure() | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 | |
with: | |
name: OperationsGateway Screenshots | |
path: cypress/screenshots |