ci.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. jobs:
  8. test:
  9. runs-on: macos-latest
  10. strategy:
  11. matrix:
  12. node-version: [20, 22]
  13. steps:
  14. - name: Checkout repository
  15. uses: actions/checkout@v4
  16. - name: Setup Node.js ${{ matrix.node-version }}
  17. uses: actions/setup-node@v4
  18. with:
  19. node-version: ${{ matrix.node-version }}
  20. cache: "npm"
  21. - name: Install dependencies
  22. run: npm ci
  23. - name: Run linter
  24. run: npm run lint
  25. - name: Type check
  26. run: npm run typecheck
  27. - name: Run tests with coverage
  28. run: npm run test:coverage
  29. - name: Upload coverage reports
  30. if: matrix.node-version == 22
  31. uses: codecov/codecov-action@v4
  32. with:
  33. files: ./coverage/lcov.info
  34. fail_ci_if_error: false
  35. continue-on-error: true
  36. - name: Build
  37. run: npm run build
  38. - name: Verify committed build/ matches source
  39. run: |
  40. if ! git diff --quiet build/; then
  41. echo "::error::build/ is out of date. Run 'npm run build' locally and commit the changes."
  42. git --no-pager diff --stat build/
  43. exit 1
  44. fi