88 - ' *'
99 workflow_call :
1010 workflow_dispatch :
11+ inputs :
12+ debug_enabled :
13+ type : boolean
14+ description : ' Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
15+ required : false
16+ default : false
17+ dump_cores :
18+ type : boolean
19+ description : ' Include core dumps in CI artifacts'
20+ required : false
21+ default : false
1122 pull_request :
1223
1324env :
@@ -31,13 +42,13 @@ jobs:
3142 python_version : [ '3.10' ]
3243 runs-on : ${{ matrix.os }}
3344 steps :
34- - uses : actions/checkout@v3
35- - uses : actions/setup-python@v4
45+ - uses : actions/checkout@v4
46+ - uses : actions/setup-python@v5
3647 with :
3748 python-version : ${{ matrix.python_version }}
3849 - name : Cache spidermonkey build
3950 id : cache-spidermonkey
40- uses : actions/cache@v3
51+ uses : actions/cache@v4
4152 with :
4253 path : |
4354 ./_spidermonkey_install/*
@@ -54,10 +65,10 @@ jobs:
5465 build-spidermonkey-win :
5566 runs-on : windows-2019
5667 steps :
57- - uses : actions/checkout@v3
68+ - uses : actions/checkout@v4
5869 - name : Cache spidermonkey build
5970 id : cache-spidermonkey
60- uses : actions/cache@v3
71+ uses : actions/cache@v4
6172 with :
6273 path : |
6374 ./_spidermonkey_install/*
@@ -104,12 +115,12 @@ jobs:
104115 python_version : ' 3.9'
105116 runs-on : ${{ matrix.os }}
106117 steps :
107- - uses : actions/checkout@v3
118+ - uses : actions/checkout@v4
108119 with :
109120 submodules : recursive
110121 fetch-depth : 0 # fetch all history for all branches and tags
111122 # poetry-dynamic-versioning needs git tags to produce the correct version number
112- - uses : actions/setup-python@v4
123+ - uses : actions/setup-python@v5
113124 with :
114125 python-version : ${{ matrix.python_version }}
115126 - name : Setup Poetry
@@ -138,7 +149,7 @@ jobs:
138149 poetry install --no-root --only=dev
139150 echo "Installed Dependencies"
140151 - name : Use cached spidermonkey build
141- uses : actions/cache@v3
152+ uses : actions/cache@v4
142153 with :
143154 path : |
144155 ./_spidermonkey_install/*
@@ -168,13 +179,16 @@ jobs:
168179 name : docs-${{ github.run_id }}-${{ github.sha }}
169180 path : ./build/docs/html/
170181 - name : Set cores to get stored in /cores
182+ if : ${{ matrix.os != 'windows-2019' && github.event_name == 'workflow_dispatch' && inputs.dump_cores }}
183+ # TODO (Caleb Aikens) figure out how to get Windows core dumps
171184 run : |
172- if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
173- # TODO (Caleb Aikens) figure out how to get Windows core dumps
174- sudo mkdir /cores
175- sudo chmod 777 /cores
176- # Core filenames will be of the form executable.pid.timestamp:
177- sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern'
185+ sudo mkdir -p /cores
186+ sudo chmod 777 /cores
187+ # Core filenames will be of the form osname.pythonversion.executable.pid.timestamp:
188+ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
189+ sudo bash -c 'echo "/cores/${OSTYPE}.$(poetry run python --version).%e.%p.%t" > /proc/sys/kernel/core_pattern'
190+ else
191+ sudo sysctl kern.corefile="/cores/${OSTYPE}.$(poetry run python --version).%e.%p.%y"
178192 fi
179193 - name : Run Python tests (pytest)
180194 run : |
@@ -185,25 +199,34 @@ jobs:
185199 poetry run python -m pip install --force-reinstall --verbose ./dist/*
186200 poetry run python -m pytest tests/python
187201 - name : Run JS tests (peter-jr)
202+ if : ${{ (success() || failure()) }}
188203 run : |
189204 if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
190205 # TODO (Caleb Aikens) figure out how to get Windows core dumps
191206 ulimit -c unlimited
192207 fi
193208 poetry run bash ./peter-jr ./tests/js/
194- - uses : actions/upload-artifact@v3
195- if : ${{ failure() && matrix.os != 'windows-2019' }} # Run only if something went wrong
209+ - name : Upload core dumps as CI artifacts
210+ uses : actions/upload-artifact@v3
211+ if : ${{ matrix.os != 'windows-2019' && github.event_name == 'workflow_dispatch' && inputs.dump_cores }}
196212 # TODO (Caleb Aikens) figure out how to get Windows core dumps
197213 with :
198- name : cores
214+ name : cores-${{ matrix.os }}-${{ matrix.python_version }}
199215 path : /cores
216+ # Enable tmate debugging of manually-triggered workflows if the input option was provided
217+ - name : SSH debug session
218+ if : ${{ (success() || failure()) && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
219+ uses : mxschmitt/action-tmate@v3
220+ with :
221+ detached : true
222+ limit-access-to-actor : true
200223 sdist :
201224 runs-on : ubuntu-20.04
202225 steps :
203- - uses : actions/checkout@v3
226+ - uses : actions/checkout@v4
204227 with :
205228 fetch-depth : 0
206- - uses : actions/setup-python@v4
229+ - uses : actions/setup-python@v5
207230 with :
208231 python-version : ' 3.9'
209232 - name : Setup Poetry
@@ -226,7 +249,7 @@ jobs:
226249 if : ${{ success() && github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
227250 steps :
228251 # no need to checkout
229- - uses : actions/setup-python@v4
252+ - uses : actions/setup-python@v5
230253 with :
231254 python-version : ' 3.9'
232255 - run : pip install twine
0 commit comments