ci.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. jobs:
  8. test-node:
  9. name: Node ${{ matrix.node-version }} (${{ matrix.os }})
  10. runs-on: ${{ matrix.os }}
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. os: [ubuntu-latest, macos-latest]
  15. node-version: ["22", "23"]
  16. steps:
  17. - uses: actions/checkout@v4
  18. - uses: actions/setup-node@v4
  19. with:
  20. node-version: ${{ matrix.node-version }}
  21. - name: Install SQLite (Ubuntu)
  22. if: runner.os == 'Linux'
  23. run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
  24. - name: Install SQLite (macOS)
  25. if: runner.os == 'macOS'
  26. run: brew install sqlite
  27. - run: npm install
  28. - name: Tests
  29. run: npx vitest run --reporter=verbose --testTimeout 60000 test/
  30. env:
  31. CI: true
  32. test-bun:
  33. name: Bun (${{ matrix.os }})
  34. runs-on: ${{ matrix.os }}
  35. strategy:
  36. fail-fast: false
  37. matrix:
  38. os: [ubuntu-latest, macos-latest]
  39. steps:
  40. - uses: actions/checkout@v4
  41. - uses: oven-sh/setup-bun@v2
  42. with:
  43. bun-version: latest
  44. - name: Install SQLite (Ubuntu)
  45. if: runner.os == 'Linux'
  46. run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
  47. - name: Install SQLite (macOS)
  48. if: runner.os == 'macOS'
  49. run: brew install sqlite
  50. - name: Verify lockfile is up-to-date
  51. run: bun install --frozen-lockfile
  52. - name: Tests
  53. run: bun test --timeout 60000 --preload ./src/test-preload.ts test/
  54. env:
  55. CI: true
  56. DYLD_LIBRARY_PATH: /opt/homebrew/opt/sqlite/lib
  57. LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu
  58. dist-sync:
  59. # Verify that committed dist/ matches what `npm run build` produces from
  60. # the committed src/. Drift here would crash consumers that import from
  61. # @oivo/qmd's pre-built dist/ (e.g. fleet oc.tgz bundles ship dist/
  62. # AS-IS without rebuilding). See i-9l2ueyyz / i-qkarfffa retrospective.
  63. name: dist/ in sync with src/
  64. runs-on: ubuntu-latest
  65. steps:
  66. - uses: actions/checkout@v4
  67. - uses: actions/setup-node@v4
  68. with:
  69. node-version: "22"
  70. - name: Install SQLite
  71. run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
  72. - run: npm install
  73. - name: Build dist/
  74. run: npm run build
  75. - name: Verify dist/ is committed and in sync
  76. run: |
  77. if ! git diff --exit-code -- dist/; then
  78. echo ""
  79. echo "::error::dist/ drifted after npm run build -- commit the rebuilt dist/ alongside src/."
  80. echo "::error::Reproduce locally: cd vendor/qmd && npm install && npm run build && git diff dist/"
  81. echo "::error::Then: git add dist/ && git commit --amend --no-edit (or new commit) and push."
  82. exit 1
  83. fi
  84. echo "dist/ is in sync with src/ ✓"