-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI workflow for linting, formatting, type checking, and testing
- Loading branch information
1 parent
36b7ee9
commit 57e4d0b
Showing
1 changed file
with
142 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: CI | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
concurrency: | ||
group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-lint-and-formatting: | ||
name: Check lint and formatting with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
node-version: [22] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} and Install dependencies on ${{ matrix.os }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
cache-dependency-path: ./package-lock.json | ||
check-latest: true | ||
|
||
- name: Install dependencies on ${{ matrix.node-version }} | ||
run: npm install | ||
|
||
- name: Check for duplicate packages | ||
run: npm find-dupes | ||
|
||
- name: Check formatting | ||
run: npm run format-check | ||
|
||
- name: Lint files | ||
run: npm run lint | ||
|
||
check-types: | ||
name: Test types with TypeScript ${{ matrix.ts }} on ${{ matrix.os }} and Node.js ${{ matrix.node-version }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
node-version: [22] | ||
os: [ubuntu-latest] | ||
ts: [5.3, 5.4, 5.5, 5.6, 5.7] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} and Install dependencies on ${{ matrix.os }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
cache-dependency-path: ./package-lock.json | ||
check-latest: true | ||
|
||
- name: Install dependencies on ${{ matrix.node-version }} | ||
run: npm install | ||
|
||
- name: Install TypeScript ${{ matrix.ts }} | ||
run: npm install -D typescript@${{ matrix.ts }} | ||
|
||
- name: Run type tests | ||
run: npm run type-check | ||
|
||
build: | ||
name: Build with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
node-version: [18, 20, 22, latest] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} and Install dependencies on ${{ matrix.os }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
cache-dependency-path: ./package-lock.json | ||
check-latest: true | ||
|
||
- name: Install dependencies on ${{ matrix.node-version }} | ||
run: npm install | ||
|
||
- name: Build with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
run: npm run build | ||
|
||
- name: Did we fail? | ||
if: failure() | ||
run: ls -R . | ||
|
||
test: | ||
name: Run tests with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
node-version: [18, 20, 22, latest] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} and Install dependencies on ${{ matrix.os }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "npm" | ||
cache-dependency-path: ./package-lock.json | ||
check-latest: true | ||
|
||
- name: Install dependencies on ${{ matrix.node-version }} | ||
run: npm install | ||
|
||
- name: Run tests with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
run: npm run test | ||
|
||
- name: Did we fail? | ||
if: failure() | ||
run: ls -R |