Skip to content

Commit de2e7f6

Browse files
authored
Merge branch 'main' into Xmader/feat/npm-py
2 parents 1a0ff57 + c8b0f61 commit de2e7f6

File tree

169 files changed

+11749
-7310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+11749
-7310
lines changed

.git-blame-ignore-revs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# chore(linting): lint all python files
2+
aae30e864449442cf0b04e94f8a242b1b667de9a
3+
4+
# chore(linting): lint all JavaScript files
5+
16dc3153b3cb684ca72445ed058babc8f5d97f42
6+
7+
# chore(linting): lint all C++ files
8+
58cd4b45777b046f03a63255c1d93e289e1cab5e

.github/workflows/test-and-publish.yaml

+100-31
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,41 @@ on:
88
- '*'
99
workflow_call:
1010
workflow_dispatch:
11+
inputs:
12+
debug_enabled_os:
13+
type: choice
14+
description: Optionally, choose an OS to run the build with SSH debugging on (https://github.com/fawazahmed0/action-debug)
15+
required: false
16+
options:
17+
- ''
18+
- 'ubuntu-20.04'
19+
- 'macos-12'
20+
- 'macos-13'
21+
- 'macos-14'
22+
- 'windows-2019'
23+
debug_enabled_python:
24+
type: choice
25+
description: Choose a Python version to run the build with SSH debugging on
26+
required: false
27+
options:
28+
- ''
29+
- '3.8'
30+
- '3.9'
31+
- '3.10'
32+
- '3.11'
33+
- '3.12'
34+
build_type:
35+
type: choice
36+
description: 'Choose the build type to use'
37+
required: false
38+
default: 'Debug'
39+
options:
40+
- 'Debug'
41+
- 'Profile'
42+
- 'Sanitize'
43+
- 'DRelease'
44+
- 'Release'
45+
- 'None'
1146
pull_request:
1247

1348
env:
@@ -31,17 +66,17 @@ jobs:
3166
python_version: [ '3.10' ]
3267
runs-on: ${{ matrix.os }}
3368
steps:
34-
- uses: actions/checkout@v3
35-
- uses: actions/setup-python@v4
69+
- uses: actions/checkout@v4
70+
- uses: actions/setup-python@v5
3671
with:
3772
python-version: ${{ matrix.python_version }}
3873
- name: Cache spidermonkey build
3974
id: cache-spidermonkey
40-
uses: actions/cache@v3
75+
uses: actions/cache@v4
4176
with:
4277
path: |
4378
./_spidermonkey_install/*
44-
key: spidermonkey115.7.0-${{ runner.os }}-${{ runner.arch }}
79+
key: spidermonkey115.8.0-${{ runner.os }}-${{ runner.arch }}
4580
lookup-only: true # skip download
4681
- name: Setup XCode
4782
if: ${{ (matrix.os == 'macos-13' || matrix.os == 'macos-14') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
@@ -54,14 +89,14 @@ jobs:
5489
build-spidermonkey-win:
5590
runs-on: windows-2019
5691
steps:
57-
- uses: actions/checkout@v3
92+
- uses: actions/checkout@v4
5893
- name: Cache spidermonkey build
5994
id: cache-spidermonkey
60-
uses: actions/cache@v3
95+
uses: actions/cache@v4
6196
with:
6297
path: |
6398
./_spidermonkey_install/*
64-
key: spidermonkey115.7.0-${{ runner.os }}-${{ runner.arch }}
99+
key: spidermonkey115.8.0-${{ runner.os }}-${{ runner.arch }}
65100
lookup-only: true # skip download
66101
- name: Install dependencies
67102
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
@@ -89,11 +124,10 @@ jobs:
89124
fail-fast: false
90125
matrix:
91126
# The lowest supported version is Ubuntu 20.04 + Python 3.8 or macOS 12 + Python 3.9
92-
os: [ 'ubuntu-20.04', 'macos-12', 'windows-2019', 'macos-14' ]
127+
os: [ 'ubuntu-20.04', 'macos-12', 'macos-13', 'macos-14', 'windows-2019' ]
93128
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
94129
exclude:
95130
# macOS 12 comes with Python 3.9 by default, so we drop ci support for Python 3.8 on macOS
96-
# FIXME: We can't build on macOS 11 for now because our prebuilt `uncrustify` binary requires macOS 12
97131
- os: 'macos-12'
98132
python_version: '3.8'
99133
# actions/setup-python: The version '3.8'/'3.9' with architecture 'arm64' was not found for macOS.
@@ -104,12 +138,12 @@ jobs:
104138
python_version: '3.9'
105139
runs-on: ${{ matrix.os }}
106140
steps:
107-
- uses: actions/checkout@v3
141+
- uses: actions/checkout@v4
108142
with:
109143
submodules: recursive
110144
fetch-depth: 0 # fetch all history for all branches and tags
111145
# poetry-dynamic-versioning needs git tags to produce the correct version number
112-
- uses: actions/setup-python@v4
146+
- uses: actions/setup-python@v5
113147
with:
114148
python-version: ${{ matrix.python_version }}
115149
- name: Setup Poetry
@@ -122,27 +156,21 @@ jobs:
122156
if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
123157
sudo apt-get update -y
124158
sudo apt-get install -y cmake graphviz llvm
125-
# Install Doxygen
126-
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
127-
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
128-
tar xf doxygen-1.9.7.linux.bin.tar.gz
129-
cd doxygen-1.9.7 && sudo make install && cd -
130-
rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz
131159
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
132160
brew update || true # allow failure
133-
brew install cmake doxygen graphviz pkg-config wget coreutils # `coreutils` installs the `realpath` command
161+
brew install cmake pkg-config wget coreutils # `coreutils` installs the `realpath` command
134162
fi
135163
echo "Installing python deps"
136164
poetry self add "poetry-dynamic-versioning[plugin]"
137165
poetry env use python3 # use the correct Python version we've set up
138166
poetry install --no-root --only=dev
139167
echo "Installed Dependencies"
140168
- name: Use cached spidermonkey build
141-
uses: actions/cache@v3
169+
uses: actions/cache@v4
142170
with:
143171
path: |
144172
./_spidermonkey_install/*
145-
key: spidermonkey115.7.0-${{ runner.os }}-${{ runner.arch }}
173+
key: spidermonkey115.8.0-${{ runner.os }}-${{ runner.arch }}
146174
fail-on-cache-miss: true # SpiderMonkey is expected to be cached in its dedicated job
147175
- name: Build pminit
148176
run: |
@@ -154,33 +182,62 @@ jobs:
154182
- name: Build wheel
155183
run: |
156184
echo $(poetry run python --version)
157-
poetry build --format=wheel
185+
WORKFLOW_BUILD_TYPE=${{ inputs.build_type }}
186+
BUILD_TYPE=${WORKFLOW_BUILD_TYPE:-"Debug"} poetry build --format=wheel
158187
ls -lah ./dist/
159188
- name: Upload wheel as CI artifacts
160189
uses: actions/upload-artifact@v3
161190
with:
162191
name: wheel-${{ github.run_id }}-${{ github.sha }}
163192
path: ./dist/
164-
- name: Upload Doxygen-generated docs as CI artifacts
165-
uses: actions/upload-artifact@v3
166-
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.11' }} # making sure we only upload once
167-
with:
168-
name: docs-${{ github.run_id }}-${{ github.sha }}
169-
path: ./build/docs/html/
193+
- name: Set cores to get stored in /cores
194+
if: ${{ matrix.os != 'windows-2019' }}
195+
# TODO (Caleb Aikens) figure out how to get Windows core dumps
196+
run: |
197+
sudo mkdir -p /cores
198+
sudo chmod 777 /cores
199+
# Core filenames will be of the form osname.pythonversion.executable.pid.timestamp:
200+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
201+
sudo bash -c 'echo "/cores/${OSTYPE}.$(poetry run python --version).%e.%p.%t" > /proc/sys/kernel/core_pattern'
202+
else
203+
sudo sysctl kern.corefile="/cores/${OSTYPE}.$(poetry run python --version).%e.%p.%y"
204+
fi
170205
- name: Run Python tests (pytest)
171206
run: |
172-
poetry run python -m pip install --force-reinstall --verbose ./dist/*
207+
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
208+
# TODO (Caleb Aikens) figure out how to get Windows core dumps
209+
ulimit -c unlimited
210+
fi
211+
WORKFLOW_BUILD_TYPE=${{ inputs.build_type }}
212+
BUILD_TYPE=${WORKFLOW_BUILD_TYPE:-"Debug"} poetry run python -m pip install --force-reinstall --verbose ./dist/*
173213
poetry run python -m pytest tests/python
174214
- name: Run JS tests (peter-jr)
215+
if: ${{ (success() || failure()) }}
175216
run: |
217+
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
218+
# TODO (Caleb Aikens) figure out how to get Windows core dumps
219+
ulimit -c unlimited
220+
fi
176221
poetry run bash ./peter-jr ./tests/js/
222+
- name: SSH debug session
223+
if: ${{ (success() || failure()) && github.event_name == 'workflow_dispatch' && inputs.debug_enabled_os == matrix.os && inputs.debug_enabled_python == matrix.python_version}}
224+
uses: fawazahmed0/action-debug@main
225+
with:
226+
credentials: "admin:admin"
227+
- name: Upload core dumps as CI artifacts
228+
uses: actions/upload-artifact@v3
229+
if: ${{ matrix.os != 'windows-2019' && failure() }}
230+
# TODO (Caleb Aikens) figure out how to get Windows core dumps
231+
with:
232+
name: cores-${{ matrix.os }}-${{ matrix.python_version }}
233+
path: /cores
177234
sdist:
178235
runs-on: ubuntu-20.04
179236
steps:
180-
- uses: actions/checkout@v3
237+
- uses: actions/checkout@v4
181238
with:
182239
fetch-depth: 0
183-
- uses: actions/setup-python@v4
240+
- uses: actions/setup-python@v5
184241
with:
185242
python-version: '3.9'
186243
- name: Setup Poetry
@@ -189,21 +246,33 @@ jobs:
189246
version: 1.5.1
190247
- name: Build source distribution (sdist) file
191248
run: |
249+
# Install Doxygen
250+
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
251+
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
252+
tar xf doxygen-1.9.7.linux.bin.tar.gz
253+
cd doxygen-1.9.7 && sudo make install && cd -
254+
rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz
192255
poetry self add "poetry-dynamic-versioning[plugin]"
256+
BUILD_DOCS=1 BUILD_TYPE=None poetry install
193257
poetry build --format=sdist
194258
ls -lah ./dist/
195259
- name: Upload sdist as CI artifacts
196260
uses: actions/upload-artifact@v3
197261
with:
198262
name: wheel-${{ github.run_id }}-${{ github.sha }}
199263
path: ./dist/
264+
- name: Upload Doxygen-generated docs as CI artifacts
265+
uses: actions/upload-artifact@v3
266+
with:
267+
name: docs-${{ github.run_id }}-${{ github.sha }}
268+
path: ./build/docs/html/
200269
publish:
201270
needs: [build-and-test, sdist]
202271
runs-on: ubuntu-20.04
203272
if: ${{ success() && github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
204273
steps:
205274
# no need to checkout
206-
- uses: actions/setup-python@v4
275+
- uses: actions/setup-python@v5
207276
with:
208277
python-version: '3.9'
209278
- run: pip install twine

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ firefox-*/
1111
__pycache__
1212
Testing/Temporary
1313
_spidermonkey_install
14+
uncrustify-*.tar.gz
15+
uncrustify-*/
16+
uncrustify
17+
*.uncrustify
1418
__pycache__/*
1519
dist
1620
*.so

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"run"
1818
],
1919
},
20-
"preLaunchTask": "Build",
20+
"preLaunchTask": "Fast build",
2121
"cwd": "${fileDirname}",
2222
"environment": [],
2323
"externalConsole": false,

.vscode/tasks.json

+16
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@
2626
"isDefault": true
2727
}
2828
},
29+
{
30+
"label": "Fast build",
31+
"type": "process",
32+
"command": "poetry",
33+
"args": [
34+
"run",
35+
"python",
36+
"./build.py",
37+
],
38+
"problemMatcher": [
39+
"$gcc"
40+
],
41+
"group": {
42+
"kind": "build",
43+
}
44+
},
2945
//
3046
// Test
3147
//

0 commit comments

Comments
 (0)