Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧪 testing and linting scripts and action #1

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI setup
runs:
using: composite
steps:
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false

- uses: actions/setup-node@v4
with:
node-version: 21
cache: pnpm

- name: Install dependencies
run: pnpm install
shell: bash
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test & lint
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: "🧪 Run unit tests"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup

- name: Run tests
run: pnpm test

typecheck:
name: "📐 Typecheck"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup
- name: Typecheck
run: pnpm typecheck

lint:
name: "🧹 Run eslint"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup
- name: Lint
run: pnpm lint

prettier:
name: "💅 Run prettier"
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci-setup
- name: Prettier
run: pnpm prettier
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
"main": "lib/index",
"types": "lib/index",
"scripts": {
"lint": "eslint --ignore-path .gitignore src",
"prettier": "prettier -c src",
"typecheck": "tsc",
"test": "vitest"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.3.1",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"vitest": "^1.1.1",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vitest": "^1.1.1"
},
"author": "Russell Dunphy",
"license": "ISC"
Expand Down
Loading