SIMSBIOHUB-587 API: Marking Strategy #3622
Workflow file for this run
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: Linting and Formatting Checks | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
# Checkout the repo once and cache it for use in subsequent jobs | |
checkoutRepo: | |
name: Checkout and cache target branch | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
steps: | |
# Install Node - for `node` and `npm` commands | |
# Note: This already uses actions/cache internally, so repeat calls in subsequent jobs are not a performance hit | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Checkout Target Branch | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
# Cache the repo | |
- name: Cache repo | |
uses: actions/cache@v4 | |
id: cache-repo | |
env: | |
cache-name: cache-repo | |
with: | |
# Cache repo based on the commit sha that triggered the workflow | |
path: ${{ github.workspace }}/* | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
lintAndFormat: | |
name: Running Linter and Formatter | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: | |
- checkoutRepo | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# Load repo from cache | |
- name: Cache repo | |
uses: actions/cache@v4 | |
id: cache-repo | |
env: | |
cache-name: cache-repo | |
with: | |
path: ${{ github.workspace }}/* | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
# Checkout the branch if not restored via cache | |
- name: Checkout Target Branch | |
if: steps.cache-repo.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
# api | |
- name: Cache api node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-api-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('api/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Install api dependencies | |
working-directory: api | |
run: npm ci --include=dev | |
- name: Run api linter | |
working-directory: api | |
run: CI=true npm run lint | |
- name: Run api formater | |
working-directory: api | |
run: CI=true npm run format | |
# app | |
- name: Cache app node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-app-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Install app dependencies | |
working-directory: app | |
run: npm ci --include=dev | |
- name: Run app linter | |
working-directory: app | |
run: CI=true npm run lint | |
- name: Run app formater | |
working-directory: app | |
run: CI=true npm run format | |
# database | |
- name: Cache database node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-database-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('database/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Install database dependencies | |
working-directory: database | |
run: npm ci --include=dev | |
- name: Run database linter | |
working-directory: database | |
run: CI=true npm run lint | |
- name: Run database formatter | |
working-directory: database | |
run: CI=true npm run format |