Skip to content

Improving jest performance locally & in CI #44

Improving jest performance locally & in CI

Improving jest performance locally & in CI #44

Workflow file for this run

name: gap-web-ui CI
on:
pull_request:
branches:
- develop
paths:
- "packages/gap-web-ui/**"
- ".github/workflows/gap-web-ui-ci.yml"
- "package.json"
- "yarn.lock"
jobs:
test:
name: Test app
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Generate gap-web-ui hash
id: gap-web-ui-hash
run: |
NAME=${{ hashFiles('**/packages/gap-web-ui/**/*.js', '**/packages/gap-web-ui/**/*.jsx', '**/packages/gap-web-ui/**/*.ts', '**/packages/gap-web-ui/**/*.tsx') }}
echo "name=$NAME" >> $GITHUB_OUTPUT
- name: Read .nvmrc
id: nvm
run: echo "name=NVMRC::$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Restore gap-web-ui cache
id: gap-web-ui-cache
uses: actions/cache/restore@v3
with:
path: ${{ github.workspace }}/packages/gap-web-ui/dist
key: gap-web-ui-${{ steps.gap-web-ui-hash.outputs.name }}
- name: Build gap-web-ui
if: steps.gap-web-ui-cache.outputs.cache-hit != 'true'
run: yarn workspace gap-web-ui build
- name: Save gap-web-ui cache
if: steps.gap-web-ui-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}/packages/gap-web-ui/dist
key: gap-web-ui-${{ steps.gap-web-ui-hash.outputs.name }}
- name: Units Tests
run: yarn jest --selectProjects gap-web-ui --runInBand --ci