Skip to content

Instantly share code, notes, and snippets.

@morajabi
Created December 7, 2024 08:26
Show Gist options
  • Save morajabi/2cf441fca6b7c1a8cce1b5b262c04d1e to your computer and use it in GitHub Desktop.
Save morajabi/2cf441fca6b7c1a8cce1b5b262c04d1e to your computer and use it in GitHub Desktop.
Bun test, lint, and typecheck your Bun project in GitHub actions with caching
# .github/workflows/test.yml
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Typecheck, Lint, and Tests
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Run tests
run: bun test
- name: Run linter
run: bun eslint . --cache
- name: Type check
run: bun tsc --noEmit
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
.eslintcache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment