revision for lesson 1 and landing page #64
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: Node CI (PR) | |
on: | |
pull_request: | |
# ready_for_review is useful for when a PR is converted from "draft" to "not | |
# draft". | |
types: [edited, opened, synchronize, ready_for_review, reopened] | |
# Our jobs run like this to minimize wasting resource cycles: | |
# 1. Prime caches for primary configuration (ubuntu on node 16). | |
# This way the next two jobs can run in parallel but rely on this primed | |
# cache. | |
# 2. Lint and Test | |
# a. Lint | |
# b. Test/Coverage | |
# 3. Verify that build sizes are reasonable | |
jobs: | |
prime_cache_primary: | |
name: Prime node_modules cache for primary configuration | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install & cache node_modules | |
uses: Khan/actions@shared-node-cache-v0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
lint: | |
name: Lint | |
needs: prime_cache_primary | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install & cache node_modules | |
uses: Khan/actions@shared-node-cache-v0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get All Changed Files | |
uses: Khan/actions@get-changed-files-v1 | |
id: changed | |
- id: js-ts-files | |
name: Find .js, .ts changed files | |
uses: Khan/actions@filter-files-v0 | |
with: | |
changed-files: ${{ steps.changed.outputs.files }} | |
extensions: '.js,.jsx,.ts,.tsx' | |
- id: eslint-reset | |
uses: Khan/actions@filter-files-v0 | |
name: Files that would trigger a full eslint run | |
with: | |
changed-files: ${{ steps.changed.outputs.files }} | |
files: '.eslintrc.js,yarn.lock,.eslintignore' | |
- id: typecheck-reset | |
uses: Khan/actions@filter-files-v0 | |
name: Files that would trigger a typecheck run | |
with: | |
changed-files: ${{ steps.changed.outputs.files }} | |
files: '.yarn.lock' | |
# Linting / type checking | |
- name: Eslint | |
uses: Khan/actions@full-or-limited-v0 | |
with: | |
full-trigger: ${{ steps.eslint-reset.outputs.filtered }} | |
full: yarn lint:ci . | |
limited-trigger: ${{ steps.js-ts-files.outputs.filtered }} | |
limited: yarn lint:ci {} | |
- name: Typecheck | |
if: always() # always run this check until we update the eslint config | |
# if: steps.js-ts-files.outputs.filtered != '[]' || steps.typecheck-reset.outputs.filtered != '[]' | |
run: yarn typecheck | |
- name: Build | |
run: yarn build |