Skip to content

Commit

Permalink
set up separate lint workflow and test with pr workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
beaesguerra committed Oct 17, 2024
1 parent eb0ecc4 commit c4dea85
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 64 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/node-ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This reusable workflow is executed to run linting checks for the project
name: Run lint for the project

on:
workflow_call:

jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install & cache node_modules
uses: Khan/actions@shared-node-cache-v2
with:
node-version: ${{ matrix.node-version }}

- name: Get All Changed Files
uses: Khan/actions@get-changed-files-v2
id: changed

- id: js-ts-files
name: Find .js, .ts changed files
uses: Khan/actions@filter-files-v1
with:
changed-files: ${{ steps.changed.outputs.files }}
extensions: '.js,.jsx,.ts,.tsx'

- id: eslint-reset
uses: Khan/actions@filter-files-v1
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-v1
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 .js bundles
run: yarn build

- name: Build .d.ts types
run: yarn build:types

- name: Check package.json files
run: node utils/publish/pre-publish-check-ci.js
65 changes: 1 addition & 64 deletions .github/workflows/node-ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,70 +65,7 @@ jobs:
lint:
name: Lint
needs: prime_cache_primary
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install & cache node_modules
uses: Khan/actions@shared-node-cache-v2
with:
node-version: ${{ matrix.node-version }}

- name: Get All Changed Files
uses: Khan/actions@get-changed-files-v2
id: changed

- id: js-ts-files
name: Find .js, .ts changed files
uses: Khan/actions@filter-files-v1
with:
changed-files: ${{ steps.changed.outputs.files }}
extensions: '.js,.jsx,.ts,.tsx'

- id: eslint-reset
uses: Khan/actions@filter-files-v1
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-v1
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 .js bundles
run: yarn build

- name: Build .d.ts types
run: yarn build:types

- name: Check package.json files
run: node utils/publish/pre-publish-check-ci.js
uses: ./.github/workflow/node-ci-lint.yml

test:
name: Test
Expand Down

0 comments on commit c4dea85

Please sign in to comment.