Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3
feat: Handle disabled install scripts#41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| name: "CI: Build & Test" | ||
| on: | ||
| push: | ||
| @@ -9,7 +8,7 @@ on: | ||
| permissions: | ||
| contents: read | ||
| packages: read # Required for GHCR | ||
| packages: read # Required for GHCR | ||
| jobs: | ||
| job_lint: | ||
| @@ -408,9 +407,36 @@ jobs: | ||
| - name: Run tests | ||
| run: yarn test | ||
| job_test_bindings_recompile: | ||
| name: Test (recompile from source) (v${{ matrix.node }}) ${{ matrix.os }} | ||
| needs: [job_build] | ||
| runs-on: ${{ matrix.os }} | ||
| env: | ||
| DELETE_BINARIES: true | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
| node: [18, 26] | ||
| steps: | ||
| - name: Check out current commit | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
| - name: Set up Node | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| - name: Install dependencies | ||
| run: yarn install --ignore-engines --ignore-scripts --frozen-lockfile | ||
| - name: Download Tarball | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | ||
| with: | ||
| name: ${{ github.sha }} | ||
| - name: Run tests | ||
| run: yarn test | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| job_required_jobs_passed: | ||
| name: All required jobs passed | ||
| needs: [job_lint, job_test_bindings] | ||
| needs: [job_lint, job_test_bindings, job_test_bindings_recompile] | ||
| # Always run this, even if a dependent job failed | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -16,7 +16,7 @@ | ||
| "sentry" | ||
| ], | ||
| "scripts": { | ||
| "install": "node scripts/check-build.mjs", | ||
| "install": "node -p \"'@sentry/node-native-stacktrace@' + require('./package.json').version\"", | ||
| "lint": "yarn lint:eslint && yarn lint:clang", | ||
| "lint:eslint": "eslint . --format stylish", | ||
| "lint:clang": "node scripts/clang-format.mjs", | ||
| @@ -25,22 +25,23 @@ | ||
| "fix:clang": "node scripts/clang-format.mjs --fix", | ||
| "build": "yarn clean && yarn build:lib && yarn build:bindings:configure && yarn build:bindings", | ||
| "build:lib": "tsc", | ||
| "build:copy-binary": "node -e \"const { copyBinary } = require('./lib/copy-binary.js'); copyBinary();\"", | ||
| "build:bindings:configure": "node-gyp configure", | ||
| "build:bindings:configure:arm64": "node-gyp configure --arch=arm64 --target_arch=arm64", | ||
| "build:bindings": "node-gyp build && node scripts/copy-target.mjs", | ||
| "build:bindings:arm64": "node-gyp build --arch=arm64 && node scripts/copy-target.mjs", | ||
| "build:bindings": "yarn build:lib && node-gyp build && yarn build:copy-binary", | ||
| "build:bindings:arm64": "yarn build:lib && node-gyp build --arch=arm64 && yarn build:copy-binary", | ||
| "build:tarball": "npm pack", | ||
| "clean": "node-gyp clean && rm -rf lib && rm -rf build && rm -f *.tgz", | ||
| "test": "yarn test:install && yarn test:prepare && vitest run --poolOptions.forks.singleFork --silent=false --disable-console-intercept", | ||
| "test:prepare": "node ./test/prepare.mjs", | ||
| "test:install": "cross-env ALWAYS_THROW=true yarn install" | ||
| "test": "node ./test/prepare.mjs && vitest run --poolOptions.forks.singleFork --silent=false --disable-console-intercept" | ||
| }, | ||
| "gypfile": false, | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
sentry[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "dependencies": { | ||
| "detect-libc": "^2.0.4", | ||
| "node-abi": "^3.89.0" | ||
| "node-abi": "^3.92.0", | ||
| "node-gyp": "^11.5.0" | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. m/h: The node engines are | ||
| }, | ||
| "devDependencies": { | ||
| "@sentry-internal/eslint-config-sdk": "^9.22.0", | ||
| @@ -49,7 +50,6 @@ | ||
| "clang-format": "^1.8.0", | ||
| "cross-env": "^7.0.3", | ||
| "eslint": "^7.0.0", | ||
| "node-gyp": "^11.2.0", | ||
| "typescript": "^5.8.3", | ||
| "vitest": "^3.1.4" | ||
| }, | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||
| import * as os from 'node:os'; | ||||||
| import { versions } from 'node:process'; | ||||||
| import * as libc from 'detect-libc'; | ||||||
| import { getAbi } from 'node-abi'; | ||||||
| export const stdlib = libc.familySync(); | ||||||
| export const platform = process.env['BUILD_PLATFORM'] || os.platform(); | ||||||
| export const arch = process.env['BUILD_ARCH'] || os.arch(); | ||||||
| export const abi = getAbi(versions.node, 'node'); | ||||||
| export const identifier = [platform, arch, stdlib, abi].filter(c => c !== undefined && c !== null).join('-'); | ||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary byte saving suggestion
Suggested change
| ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* eslint-disable no-console */ | ||
| import * as fs from 'node:fs'; | ||
| import * as path from 'node:path'; | ||
| import { identifier } from './constants'; | ||
| const source = path.join(__dirname, '..', 'build', 'Release', 'stack-trace.node'); | ||
| const target = path.join(__dirname, '..', 'lib', `stack-trace-${identifier}.node`); | ||
| /** | ||
| * Copies the compiled binary from the build directory to the lib directory with the correct name based on the current platform and Node version. | ||
| * | ||
| * @hidden We only use this for copying the binary after building, it is not intended to be used by end users. | ||
| */ | ||
| export function copyBinary(): void { | ||
| const build = path.resolve(__dirname, '..', 'lib'); | ||
| if (!fs.existsSync(build)) { | ||
| fs.mkdirSync(build, { recursive: true }); | ||
| } | ||
| if (!fs.existsSync(source)) { | ||
| throw new Error(`Source file does not exist: ${ source}`); | ||
| } else { | ||
timfish marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (fs.existsSync(target)) { | ||
| console.log('Target file already exists, overwriting it'); | ||
| fs.unlinkSync(target); | ||
| } | ||
| console.log('Copying', source, 'to', target); | ||
| fs.copyFileSync(source, target); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q/l: Is it on purpose only testing for node 18 and 26?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, didn't want to add all of them and testing oldest and newest should be enough...