mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
feat!: use .npmignore file to limit which files are published (#2921)
* feat!: use package.json files to limit which files are published Fixes: #2372 * Use npmignore instead of package.json#files * Add update-gyp.py to npmignore * Add install to pack test * Use output var for pack dir * Move existing .gitignore entries to .npmignore * Sort git and npm ignores * Update and cleanup workflows
This commit is contained in:
parent
4e493d4fb2
commit
864a979930
4 changed files with 76 additions and 29 deletions
78
.github/workflows/tests.yml
vendored
78
.github/workflows/tests.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
||||||
# TODO: Line 48, enable pytest --doctest-modules
|
# TODO: add `python -m pytest --doctest-modules`
|
||||||
|
|
||||||
name: Tests
|
name: Tests
|
||||||
on:
|
on:
|
||||||
|
@ -12,44 +12,82 @@ permissions:
|
||||||
contents: read # to fetch code (actions/checkout)
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Lint_Python:
|
lint-python:
|
||||||
|
name: Lint Python
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: pip install --user ruff
|
- run: pip install --user ruff
|
||||||
- run: ruff --output-format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="E721,PLC1901,S101,UP031" --target-version=py38 .
|
- run: ruff --output-format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="E721,PLC1901,S101,UP031" --target-version=py38 .
|
||||||
Lint_JS:
|
|
||||||
|
lint-js:
|
||||||
|
name: Lint JS
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 20.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install --no-progress
|
run: npm install
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
Engines:
|
|
||||||
|
check-engines:
|
||||||
|
name: Check Engines
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Use Node.js 20.x
|
- name: Use Node.js 20.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: npm install
|
||||||
npm install --no-progress
|
|
||||||
- name: Check Engines
|
- name: Check Engines
|
||||||
run: |
|
run: |
|
||||||
# TODO: move this to its own action
|
# TODO: move this to its own action
|
||||||
npm install @npmcli/arborist@7 semver@7 --no-save
|
npm install @npmcli/arborist@7 semver@7 --no-save
|
||||||
node .github/scripts/check-engines.js
|
node .github/scripts/check-engines.js
|
||||||
Tests:
|
|
||||||
needs: Lint_Python # Lint_Python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
|
test-pack:
|
||||||
|
name: Test Pack
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js 20.x
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20.x
|
||||||
|
- name: Update npm
|
||||||
|
run: npm install npm@latest -g
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm install
|
||||||
|
- name: Pack
|
||||||
|
id: pack
|
||||||
|
env:
|
||||||
|
NODE_GYP_TEMP_DIR: '${{ runner.temp }}/node-gyp'
|
||||||
|
run: |
|
||||||
|
mkdir -p $NODE_GYP_TEMP_DIR
|
||||||
|
npm pack
|
||||||
|
tar xzf *.tgz -C $NODE_GYP_TEMP_DIR --strip-components=1
|
||||||
|
cp -r test/ $NODE_GYP_TEMP_DIR/test/
|
||||||
|
echo "dir=$NODE_GYP_TEMP_DIR" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: Test
|
||||||
|
working-directory: ${{ steps.pack.outputs.dir }}
|
||||||
|
env:
|
||||||
|
FULL_TEST: '1'
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm test
|
||||||
|
|
||||||
|
tests:
|
||||||
|
# lint-python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
|
||||||
|
needs: [lint-python]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 15
|
max-parallel: 15
|
||||||
|
@ -63,7 +101,7 @@ jobs:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Use Node.js ${{ matrix.node }}
|
- name: Use Node.js ${{ matrix.node }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- name: Use Python ${{ matrix.python }}
|
- name: Use Python ${{ matrix.python }}
|
||||||
|
@ -74,26 +112,22 @@ jobs:
|
||||||
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
|
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install --no-progress
|
npm install
|
||||||
pip install pytest
|
pip install pytest
|
||||||
- name: Set Windows environment
|
- name: Set Windows Env
|
||||||
if: matrix.os == 'windows'
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
|
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
|
||||||
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
|
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
|
||||||
- name: Run Python tests
|
- name: Run Python Tests
|
||||||
run: python -m pytest
|
run: python -m pytest
|
||||||
# - name: Run doctests with pytest
|
- name: Run Tests (macOS or Linux)
|
||||||
# run: python -m pytest --doctest-modules
|
|
||||||
- name: Environment Information
|
|
||||||
run: npx envinfo
|
|
||||||
- name: Run Node tests (macOS or Linux)
|
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: npm test --python="${pythonLocation}/python"
|
run: npm test --python="${pythonLocation}/python"
|
||||||
env:
|
env:
|
||||||
FULL_TEST: ${{ (matrix.node == '20.x' && matrix.python == '3.12') && '1' || '0' }}
|
FULL_TEST: ${{ (matrix.node == '20.x' && matrix.python == '3.12') && '1' || '0' }}
|
||||||
- name: Run tests (Windows)
|
- name: Run Tests (Windows)
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: npm run test --python="${env:pythonLocation}\\python.exe"
|
run: npm run test --python="${env:pythonLocation}\\python.exe"
|
||||||
|
|
5
.github/workflows/visual-studio.yml
vendored
5
.github/workflows/visual-studio.yml
vendored
|
@ -26,10 +26,7 @@ jobs:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: npm install
|
||||||
npm install --no-progress
|
|
||||||
- name: Environment Information
|
|
||||||
run: npx envinfo
|
|
||||||
- name: Run Node tests
|
- name: Run Node tests
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,7 +1,8 @@
|
||||||
|
.ncu
|
||||||
|
.nyc_output
|
||||||
*.swp
|
*.swp
|
||||||
gyp/test
|
gyp/test
|
||||||
node_modules
|
node_modules
|
||||||
test/.node-gyp
|
node-gyp-*.tgz
|
||||||
.ncu
|
|
||||||
.nyc_output
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
test/.node-gyp
|
||||||
|
|
15
.npmignore
Normal file
15
.npmignore
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
.ncu
|
||||||
|
.nyc_output
|
||||||
|
*.swp
|
||||||
|
/.github/
|
||||||
|
/docs/
|
||||||
|
/gyp/.github/
|
||||||
|
/gyp/*.md
|
||||||
|
/gyp/AUTHORS
|
||||||
|
/gyp/test
|
||||||
|
/gyp/tools/
|
||||||
|
/node-gyp-*.tgz
|
||||||
|
/test/
|
||||||
|
/test/.node-gyp
|
||||||
|
/update-gyp.py
|
||||||
|
node-gyp-*.tgz
|
Loading…
Add table
Add a link
Reference in a new issue