node-addon-system.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # CI for the node-addon-system packages under native/system. A separate
  2. # workflow from ci.yml keeps the native OS/architecture matrix independent of
  3. # the harness Node matrix. Release assembly and publication use the companion
  4. # Node Addon System Release workflow.
  5. name: Node Addon System
  6. on:
  7. pull_request:
  8. paths:
  9. - '.github/workflows/node-addon-system.yml'
  10. - '.github/workflows/node-addon-system-release.yml'
  11. - 'native/system/**'
  12. - 'package.json'
  13. - 'pnpm-lock.yaml'
  14. - 'pnpm-workspace.yaml'
  15. push:
  16. branches: [master]
  17. paths:
  18. - '.github/workflows/node-addon-system.yml'
  19. - '.github/workflows/node-addon-system-release.yml'
  20. - 'native/system/**'
  21. - 'package.json'
  22. - 'pnpm-lock.yaml'
  23. - 'pnpm-workspace.yaml'
  24. workflow_dispatch:
  25. concurrency:
  26. group: ${{ github.workflow }}-${{ github.ref }}
  27. cancel-in-progress: true
  28. permissions:
  29. contents: read
  30. env:
  31. # CI runs must never report to the production telemetry endpoint baked
  32. # into apps/cli/cordis.yml (AppCLIEntry disables the row when set).
  33. DSH_TELEMETRY_DISABLED: '1'
  34. defaults:
  35. run:
  36. working-directory: native/system
  37. jobs:
  38. matrix:
  39. name: Matrix
  40. runs-on: ubuntu-24.04
  41. outputs:
  42. ci: ${{ steps.matrix.outputs.ci }}
  43. compatibility: ${{ steps.matrix.outputs.compatibility }}
  44. steps:
  45. - uses: actions/checkout@v4
  46. - id: matrix
  47. run: |
  48. echo "ci=$(node ./scripts/github-matrix.mjs ci)" >> "$GITHUB_OUTPUT"
  49. echo "compatibility=$(node ./scripts/github-matrix.mjs compatibility)" >> "$GITHUB_OUTPUT"
  50. native:
  51. name: ${{ matrix.platform }}
  52. needs: matrix
  53. runs-on: ${{ matrix.runner }}
  54. strategy:
  55. fail-fast: false
  56. matrix: ${{ fromJson(needs.matrix.outputs.ci) }}
  57. steps:
  58. - uses: actions/checkout@v4
  59. - uses: pnpm/action-setup@v4
  60. with:
  61. package_json_file: package.json
  62. - uses: actions/setup-node@v4
  63. with:
  64. node-version: 24
  65. cache: pnpm
  66. cache-dependency-path: pnpm-lock.yaml
  67. - name: Install dependencies
  68. run: pnpm install --filter @deepseek-ai/node-addon-system-workspace... --frozen-lockfile
  69. - name: Install musl toolchain
  70. if: runner.os == 'Linux'
  71. run: |
  72. sudo apt-get update -q
  73. sudo apt-get install -yq musl-tools
  74. - name: Build TypeScript
  75. run: pnpm build:ts
  76. - name: Typecheck
  77. run: pnpm typecheck
  78. - name: Build native binaries (this architecture is the builder of record)
  79. run: pnpm build:native
  80. - name: Entry tests (keyless)
  81. run: node ./test/entry.test.js
  82. # NALR_REQUIRE_LANDLOCK: a self-skip on the very platform that exists to
  83. # prove enforcement would be a false green, so an unenforcing kernel
  84. # fails the leg instead of skipping.
  85. - name: Launcher tests (real kernel enforcement)
  86. if: runner.os == 'Linux'
  87. run: node ./test/launcher.test.js
  88. env:
  89. NALR_REQUIRE_LANDLOCK: 1
  90. - name: Pack rehearsal (pack → install → confine, this platform only)
  91. run: |
  92. node ./scripts/pack-release.mjs .release/npm --current-platform-only
  93. node ./scripts/verify-packed-install.mjs .release/npm --current-platform-only
  94. env:
  95. NALR_REQUIRE_LANDLOCK: ${{ runner.os == 'Linux' && '1' || '0' }}
  96. - name: Verify platform payload rules
  97. run: pnpm test:packaging
  98. - name: Flock behavior (built addon)
  99. run: |
  100. pnpm build:test-oracle
  101. pnpm test:flock
  102. - name: Upload this platform's built addon and entry
  103. uses: actions/upload-artifact@v4
  104. with:
  105. name: system-compat-${{ matrix.platform }}
  106. path: |
  107. native/system/packages/*/bin/**
  108. native/system/packages/entry/lib/**
  109. if-no-files-found: error
  110. - name: Upload independent syscall test oracle
  111. uses: actions/upload-artifact@v4
  112. with:
  113. name: system-oracle-${{ matrix.platform }}
  114. path: native/system/test/bin/**
  115. if-no-files-found: error
  116. compatibility:
  117. name: ${{ matrix.platform }} / Node ${{ matrix.node }} (same binary)
  118. needs: [matrix, native]
  119. strategy:
  120. fail-fast: false
  121. matrix:
  122. include: ${{ fromJson(needs.matrix.outputs.compatibility) }}
  123. runs-on: ${{ matrix.runner }}
  124. steps:
  125. - uses: actions/checkout@v4
  126. - uses: actions/setup-node@v4
  127. with:
  128. node-version: ${{ matrix.node }}
  129. - name: Download the original platform build
  130. uses: actions/download-artifact@v4
  131. with:
  132. name: system-compat-${{ matrix.platform }}
  133. path: native/system/packages
  134. - name: Download independent syscall test oracle
  135. uses: actions/download-artifact@v4
  136. with:
  137. name: system-oracle-${{ matrix.platform }}
  138. path: native/system/test/bin
  139. - name: Restore oracle executable permissions
  140. run: find ./test/bin -type f -name flock-oracle -exec chmod +x {} +
  141. - name: Test without rebuilding or installing dependencies
  142. run: |
  143. node ./test/link-platform.mjs
  144. node --test ./test/flock.test.js ./test/package-matrix.test.js
  145. - name: Test the same musl addon without a compiler
  146. if: runner.os == 'Linux'
  147. run: >-
  148. docker run --rm -v "$PWD:$PWD" -w "$PWD"
  149. node:${{ matrix.node }}-alpine
  150. node --test ./test/flock.test.js ./test/package-matrix.test.js