Skip to content

Commit

Permalink
Use node-gyp compatible version of Python in runner for test workflow
Browse files Browse the repository at this point in the history
The node-gyp dependency of this project uses a Python script.

Previously, the test GitHub Actions workflow was not configured to install a specific version of Python, so whichever
version of Python 3.x that was pre-installed on the GitHub Actions runner machine was used.

The documentation for the [email protected] version used by this project indicates the newest supported Python version is
3.8. Clearly newer versions did work because the workflow has been running with Python 3.10. However, the macos-latest
runner was updated to using Python 3.11 and the script now fails when `npm install` is ran in the project:

ValueError: invalid mode: 'rU' while trying to load binding.

The solution is to install a specific version of Python. It seems safest to use the newest version explicitly stated as
supported by the [email protected] documentation, so Python 3.8 is installed.
  • Loading branch information
per1234 authored Nov 10, 2022
1 parent f0d8241 commit dcec573
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test-typescript-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Test TypeScript
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 10.x
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python
# Using newest version documented as supported by node-gyp dependency:
# https://github.com/nodejs/node-gyp/tree/v7.1.2#installation
PYTHON_VERSION: 3.8

on:
push:
Expand Down Expand Up @@ -60,6 +64,11 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: npm install

Expand Down

0 comments on commit dcec573

Please sign in to comment.