Return results in a structured format #16
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 - App | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- app/** | |
- .github/workflows/ci-app.yml | |
defaults: | |
run: | |
working-directory: ./app | |
env: | |
NODE_VERSION: 20 | |
LOCKFILE_PATH: ./app/package-lock.json # or yarn.lock | |
PACKAGE_MANAGER: npm # or yarn | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache-dependency-path: ${{ env.LOCKFILE_PATH }} | |
cache: ${{ env.PACKAGE_MANAGER }} | |
- run: npm ci | |
- run: npm run test | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache-dependency-path: ${{ env.LOCKFILE_PATH }} | |
cache: ${{ env.PACKAGE_MANAGER }} | |
- run: npm ci | |
- run: npm run lint | |
types: | |
name: Type check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache-dependency-path: ${{ env.LOCKFILE_PATH }} | |
cache: ${{ env.PACKAGE_MANAGER }} | |
- run: npm ci | |
- run: npm run ts:check | |
formatting: | |
name: Format check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache-dependency-path: ${{ env.LOCKFILE_PATH }} | |
cache: ${{ env.PACKAGE_MANAGER }} | |
- run: npm ci | |
- run: npm run format-check | |
# Confirms the app still builds successfully | |
check-app-builds: | |
name: Build check - App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache-dependency-path: ${{ env.LOCKFILE_PATH }} | |
cache: ${{ env.PACKAGE_MANAGER }} | |
# https://nextjs.org/docs/advanced-features/ci-build-caching | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
${{ github.workspace }}/app/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
- run: npm ci | |
- run: npm run build -- --no-lint |