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
1348env :
@@ -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
0 commit comments