From e98bb16e941613b920a7f863c4ebe4986ceda3cc Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Sat, 29 Aug 2020 18:58:52 -0400 Subject: [PATCH 1/5] doc: drop the --production flag for installing windows-build-tools This isn't needed, and was probably copy-pasted from windows-build-tools' README.md, which has since been changed to drop the `--production` flag from the install instructions. Reviewed-By: Richard Lau Reviewed-By: Christian Clauss Reviewed-By: Rod Vagg --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd7e6a117c..cea8015810 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Install the current version of Python from the [Microsoft Store package](https:/ #### Option 1 -Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). +Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). #### Option 2 From d1176d7c49818d77759d0c0a2fb40b9f297d59b3 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 13 May 2020 13:19:16 -0700 Subject: [PATCH 2/5] ci: switch to GitHub Actions Co-authored-by: Christian Clauss Co-authored-by: Matias Lopez PR-URL: https://github.com/nodejs/node-gyp/pull/2210 Closes: #2127 Closes: #2209 --- .github/workflows/Python_tests.yml | 40 ------------- .github/workflows/tests.yml | 51 ++++++++++++++++ .travis.yml | 93 ------------------------------ test/test-options.js | 16 +++-- 4 files changed, 62 insertions(+), 138 deletions(-) delete mode 100644 .github/workflows/Python_tests.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/Python_tests.yml b/.github/workflows/Python_tests.yml deleted file mode 100644 index 067294515d..0000000000 --- a/.github/workflows/Python_tests.yml +++ /dev/null @@ -1,40 +0,0 @@ -# TODO: Line 15, enable python-version: 3.5 -# TODO: Line 36, enable pytest --doctest-modules - -name: Python_tests -on: [push, pull_request] -jobs: - Python_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 15 - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - python-version: [2.7, 3.6, 3.7, 3.8] # 3.5, - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest # -r requirements.txt - - name: Lint with flake8 - if: matrix.os == 'ubuntu-latest' - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest (Linux and macOS) - if: matrix.os != 'windows-latest' - run: pytest - - name: Test with pytest (Windows) - if: matrix.os == 'windows-latest' - shell: bash - run: GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" pytest - # - name: Run doctests with pytest - # run: pytest --doctest-modules diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..729a8f05e9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +# TODO: Line 47, enable pytest --doctest-modules + +name: Tests +on: [push, pull_request] +jobs: + Tests: + strategy: + fail-fast: false + max-parallel: 15 + matrix: + node: [10.x, 12.x, 14.x] + python: [3.6, 3.7, 3.8] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - name: Use Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + env: + PYTHON_VERSION: ${{ matrix.python }} + - name: Install Dependencies + run: | + npm install --no-progress + pip install flake8 pytest + - name: Set Windows environment + if: matrix.os == 'windows-latest' + run: + echo '::set-env name=GYP_MSVS_VERSION::2015' + echo '::set-env name=GYP_MSVS_OVERRIDE_PATH::C:\\Dummy' + - name: Lint Python + if: matrix.os == 'ubuntu-latest' + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Run Python tests + run: | + python -m pytest + # - name: Run doctests with pytest + # run: python -m pytest --doctest-modules + - name: Run Node tests + run: | + npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ae691bed48..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,93 +0,0 @@ -dist: xenial -language: python -cache: pip -addons: - homebrew: - update: true - packages: - - npm - - pyenv -jobs: - include: - - name: "Python 2.7 on Linux" - env: NODE_GYP_FORCE_PYTHON=python2 - python: 2.7 - - - name: "Node.js 10 & Python 3.8 on Linux" - python: 3.8 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 10 - - - name: "Node.js 12 & Python 3.5 on Linux" - python: 3.5 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - name: "Node.js 12 & Python 3.6 on Linux" - python: 3.6 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - name: "Node.js 12 & Python 3.7 on Linux" - python: 3.7 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - name: "Node.js 12 & Python 3.8 on Linux" - python: 3.8 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - - name: "Python 2.7 on macOS" - os: osx - osx_image: xcode11.2 - language: shell # 'language: python' is not yet supported on macOS - env: NODE_GYP_FORCE_PYTHON=python2 PATH=$HOME/.pyenv/shims:$PATH PYENV_VERSION=2.7.17 - before_install: pyenv install $PYENV_VERSION - - name: "Python 3.8 on macOS" - os: osx - osx_image: xcode11.2 - language: shell # 'language: python' is not yet supported on macOS - env: NODE_GYP_FORCE_PYTHON=python3 PATH=$HOME/.pyenv/shims:$PATH PYENV_VERSION=3.8.0 - before_install: pyenv install $PYENV_VERSION - - - name: "Node.js 12 & Python 2.7 on Windows" - os: windows - language: node_js - node_js: 12 # node - env: >- - PATH=/c/Python27:/c/Python27/Scripts:$PATH - NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe - before_install: choco install python2 - - - name: "Node.js 12 & Python 3.7 on Windows" - os: windows - language: node_js - node_js: 12 # node - env: >- - PATH=/c/Python37:/c/Python37/Scripts:$PATH - NODE_GYP_FORCE_PYTHON=/c/Python37/python.exe - before_install: choco install python --version=3.7.4 - - name: "Node.js 12 & Python 3.8 on Windows" - os: windows - language: node_js - node_js: 12 # node - env: >- - PATH=/c/Python38:/c/Python38/Scripts:$PATH - NODE_GYP_FORCE_PYTHON=/c/Python38/python.exe - before_install: choco install python - -install: - - python -m pip install --upgrade flake8 pytest==4.6.6 # pytest 5 no longer supports legacy Python -before_script: - - python -m flake8 --version - # stop the build if there are Python syntax errors or undefined names - - python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. Two space indentation is OK. The GitHub editor is 127 chars wide - - python -m flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics - - npm install - - npm list -script: - - node -e 'require("npmlog").level="verbose"; require("./lib/find-python")(null,()=>{})' - - npm test - - GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" python -m pytest -notifications: - on_success: change - on_failure: change # `always` will be the setting once code changes slow down diff --git a/test/test-options.js b/test/test-options.js index 252baa2035..b2ac62c874 100644 --- a/test/test-options.js +++ b/test/test-options.js @@ -3,13 +3,19 @@ const test = require('tap').test const gyp = require('../lib/node-gyp') -test('options in environment', function (t) { +test('options in environment', (t) => { t.plan(1) // `npm test` dumps a ton of npm_config_* variables in the environment. Object.keys(process.env) - .filter(function (key) { return /^npm_config_/.test(key) }) - .forEach(function (key) { delete process.env[key] }) + .filter((key) => /^npm_config_/.test(key)) + .forEach((key) => { delete process.env[key] }) + + // in some platforms, certain keys are stubborn and cannot be removed + const keys = Object.keys(process.env) + .filter((key) => /^npm_config_/.test(key)) + .map((key) => key.substring('npm_config_'.length)) + .concat('argv', 'x') // Zero-length keys should get filtered out. process.env.npm_config_ = '42' @@ -18,8 +24,8 @@ test('options in environment', function (t) { // Except loglevel. process.env.npm_config_loglevel = 'debug' - var g = gyp() + const g = gyp() g.parseArgv(['rebuild']) // Also sets opts.argv. - t.deepEqual(Object.keys(g.opts).sort(), ['argv', 'x']) + t.deepEqual(Object.keys(g.opts).sort(), keys.sort()) }) From 9bf112b44c98be39bf8770a1341fa4ddf23556d4 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 9 Sep 2020 13:48:09 +1000 Subject: [PATCH 3/5] doc: replace status badges with new Actions badge PR-URL: https://github.com/nodejs/node-gyp/pull/2218 Reviewed-By: Christian Clauss Reviewed-By: Matias Lopez Reviewed-By: Richard Lau --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index cea8015810..e06b01a739 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # `node-gyp` - Node.js native addon build tool -[![Travis CI](https://travis-ci.com/nodejs/node-gyp.svg?branch=master)](https://travis-ci.com/nodejs/node-gyp) -[![Build Status](https://github.com/nodejs/node-gyp/workflows/Python_tests/badge.svg)](https://github.com/nodejs/node-gyp/actions?workflow=Python_tests) +[![Build Status](https://github.com/nodejs/node-gyp/workflows/Tests/badge.svg?branch=master)](https://github.com/nodejs/node-gyp/actions?query=workflow%3ATests+branch%3Amaster) `node-gyp` is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. It contains a vendored copy of the From 8ee5d3eddb93c598cd09784918c0a95a187404c7 Mon Sep 17 00:00:00 2001 From: Martin Midtgaard Date: Tue, 29 Sep 2020 11:33:49 +0200 Subject: [PATCH 4/5] lib: better log message when ps fails --- lib/find-visualstudio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/find-visualstudio.js b/lib/find-visualstudio.js index c5d26f9a20..89e9b4f59b 100644 --- a/lib/find-visualstudio.js +++ b/lib/find-visualstudio.js @@ -151,7 +151,7 @@ VisualStudioFinder.prototype = { const failPowershell = () => { this.addLog( - 'could not use PowerShell to find Visual Studio 2017 or newer') + 'could not use PowerShell to find Visual Studio 2017 or newer, run command with \'--loglevel silly\' to figure out why') cb(null) } From 9b9b948e87a1802fcf652c682376eb30a0d3276e Mon Sep 17 00:00:00 2001 From: Martin Midtgaard Date: Wed, 30 Sep 2020 09:21:20 +0200 Subject: [PATCH 5/5] lib: made the log message for ps errors less definate --- lib/find-visualstudio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/find-visualstudio.js b/lib/find-visualstudio.js index 89e9b4f59b..9c6dad90f8 100644 --- a/lib/find-visualstudio.js +++ b/lib/find-visualstudio.js @@ -151,7 +151,7 @@ VisualStudioFinder.prototype = { const failPowershell = () => { this.addLog( - 'could not use PowerShell to find Visual Studio 2017 or newer, run command with \'--loglevel silly\' to figure out why') + 'could not use PowerShell to find Visual Studio 2017 or newer, try re-running with \'--loglevel silly\' for more details') cb(null) }