Add CI workflow to run tests and type checking #4
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| # Pin to specific version to avoid Bun segfault bugs on Linux | |
| # See: https://github.com/oven-sh/bun/issues/22452 | |
| bun-version: "1.3.3" | |
| - run: bun install | |
| - run: bun run typecheck | |
| - name: Run tests | |
| run: | | |
| bun run test 2>&1 | tee test-output.txt || true | |
| # Fail if there are actual test failures | |
| if grep -q " [1-9][0-9]* fail" test-output.txt; then | |
| echo "Tests failed" | |
| exit 1 | |
| fi | |
| # Fail if tests didn't run at all | |
| if ! grep -q " pass" test-output.txt; then | |
| echo "Tests did not run" | |
| exit 1 | |
| fi | |
| echo "Tests passed" |