Skip to content

Commit dcec573

Browse files
authored
Use node-gyp compatible version of Python in runner for test workflow
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.
1 parent f0d8241 commit dcec573

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: .github/workflows/test-typescript-npm.yml

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Test TypeScript
33
env:
44
# See: https://github.com/actions/setup-node/#readme
55
NODE_VERSION: 10.x
6+
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python
7+
# Using newest version documented as supported by node-gyp dependency:
8+
# https://github.com/nodejs/node-gyp/tree/v7.1.2#installation
9+
PYTHON_VERSION: 3.8
610

711
on:
812
push:
@@ -60,6 +64,11 @@ jobs:
6064
with:
6165
node-version: ${{ env.NODE_VERSION }}
6266

67+
- name: Install Python
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: ${{ env.PYTHON_VERSION }}
71+
6372
- name: Install dependencies
6473
run: npm install
6574

0 commit comments

Comments
 (0)