17
17
- ' '
18
18
- ' ubuntu-20.04'
19
19
- ' macos-12'
20
- - ' macos-13'
21
20
- ' macos-14'
22
- - ' windows-2019 '
21
+ - ' windows-2022 '
23
22
debug_enabled_python :
24
23
type : choice
25
24
description : Choose a Python version to run the build with SSH debugging on
@@ -61,42 +60,47 @@ jobs:
61
60
fail-fast : false
62
61
matrix :
63
62
# Use Ubuntu 20.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
64
- os : [ 'ubuntu-20.04', 'macos-13', 'macos-14' ] # macOS 14 runner exclusively runs on M1 hardwares
65
- # see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
63
+ os : [ 'ubuntu-20.04', 'macos-13', 'macos-14', 'pi' ] # macOS 14 runner exclusively runs on M1 hardwares
64
+ # see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
66
65
python_version : [ '3.10' ]
67
66
runs-on : ${{ matrix.os }}
68
67
steps :
69
68
- uses : actions/checkout@v4
70
69
- uses : actions/setup-python@v5
71
70
with :
72
71
python-version : ${{ matrix.python_version }}
72
+ - name : Read the mozilla-central commit hash to be used
73
+ run : echo "MOZCENTRAL_VERSION=$(cat mozcentral.version)" >> $GITHUB_ENV
73
74
- name : Cache spidermonkey build
74
75
id : cache-spidermonkey
75
76
uses : actions/cache@v4
76
77
with :
77
78
path : |
78
79
./_spidermonkey_install/*
79
- key : spidermonkey115.8.0 -${{ runner.os }}-${{ runner.arch }}
80
+ key : spidermonkey-${{ env.MOZCENTRAL_VERSION }} -${{ runner.os }}-${{ runner.arch }}
80
81
lookup-only : true # skip download
81
82
- name : Setup XCode
82
83
if : ${{ (matrix.os == 'macos-13' || matrix.os == 'macos-14') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
83
- # SpiderMonkey 115 ESR requires XCode SDK version at least 13.3
84
- # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-sdks
84
+ # SpiderMonkey requires XCode SDK version at least 13.3
85
85
run : sudo xcode-select -switch /Applications/Xcode_14.3.app
86
86
- name : Build spidermonkey
87
87
if : ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
88
88
run : ./setup.sh
89
89
build-spidermonkey-win :
90
- runs-on : windows-2019
90
+ runs-on : windows-2022
91
+ # SpiderMonkey requires Visual Studio 2022 or newer.
92
+ # The Windows 2019 runner only has Visual Studio Enterprise 2019 installed.
91
93
steps :
92
94
- uses : actions/checkout@v4
95
+ - name : Read the mozilla-central commit hash to be used
96
+ run : echo "MOZCENTRAL_VERSION=$(cat mozcentral.version)" >> $GITHUB_ENV
93
97
- name : Cache spidermonkey build
94
98
id : cache-spidermonkey
95
99
uses : actions/cache@v4
96
100
with :
97
101
path : |
98
102
./_spidermonkey_install/*
99
- key : spidermonkey115.8.0 -${{ runner.os }}-${{ runner.arch }}
103
+ key : spidermonkey-${{ env.MOZCENTRAL_VERSION }} -${{ runner.os }}-${{ runner.arch }}
100
104
lookup-only : true # skip download
101
105
- name : Install dependencies
102
106
if : ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
@@ -105,7 +109,7 @@ jobs:
105
109
# Already installed in Github Actions runner
106
110
# choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' # add CMake to system PATH
107
111
# choco install -y llvm gnuwin32-m4
108
- choco install -y wget make
112
+ choco install -y wget make unzip
109
113
- name : Install MozillaBuild
110
114
if : ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
111
115
run : |
@@ -123,19 +127,8 @@ jobs:
123
127
strategy :
124
128
fail-fast : false
125
129
matrix :
126
- # The lowest supported version is Ubuntu 20.04 + Python 3.8 or macOS 12 + Python 3.9
127
- os : [ 'ubuntu-20.04', 'macos-12', 'macos-13', 'macos-14', 'windows-2019' ]
130
+ os : [ 'ubuntu-20.04', 'macos-12', 'macos-14', 'windows-2022', 'pi' ]
128
131
python_version : [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
129
- exclude :
130
- # macOS 12 comes with Python 3.9 by default, so we drop ci support for Python 3.8 on macOS
131
- - os : ' macos-12'
132
- python_version : ' 3.8'
133
- # actions/setup-python: The version '3.8'/'3.9' with architecture 'arm64' was not found for macOS.
134
- # see https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
135
- - os : ' macos-14'
136
- python_version : ' 3.8'
137
- - os : ' macos-14'
138
- python_version : ' 3.9'
139
132
runs-on : ${{ matrix.os }}
140
133
steps :
141
134
- uses : actions/checkout@v4
@@ -146,6 +139,9 @@ jobs:
146
139
- uses : actions/setup-python@v5
147
140
with :
148
141
python-version : ${{ matrix.python_version }}
142
+ - name : Remove old poetry cache
143
+ run : rm -rf ~/.cache/pypoetry
144
+ if : ${{ matrix.os == 'pi' }}
149
145
- name : Setup Poetry
150
146
uses : snok/install-poetry@v1
151
147
with :
@@ -155,22 +151,42 @@ jobs:
155
151
echo "Installing Dependencies"
156
152
if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
157
153
sudo apt-get update -y
158
- sudo apt-get install -y cmake graphviz llvm
154
+ sudo apt-get install -y cmake llvm
159
155
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
160
156
brew update || true # allow failure
161
- brew install cmake pkg-config wget coreutils # `coreutils` installs the `realpath` command
157
+ brew install cmake pkg-config wget unzip coreutils # `coreutils` installs the `realpath` command
162
158
fi
163
159
echo "Installing python deps"
164
160
poetry self add "poetry-dynamic-versioning[plugin]"
165
- poetry env use python3 # use the correct Python version we've set up
161
+ poetry env use python$PYTHON_VERSION || poetry env use python3 # use the correct Python version we've set up
166
162
poetry install --no-root --only=dev
167
163
echo "Installed Dependencies"
164
+ env :
165
+ PYTHON_VERSION : ${{ matrix.python_version }}
166
+ - name : Build Docs # only build docs once
167
+ if : ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.11' }}
168
+ run : |
169
+ sudo apt-get install -y graphviz
170
+ # the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
171
+ wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
172
+ tar xf doxygen-1.9.7.linux.bin.tar.gz
173
+ cd doxygen-1.9.7 && sudo make install && cd -
174
+ rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz
175
+ BUILD_DOCS=1 BUILD_TYPE=None poetry install
176
+ - name : Upload Doxygen-generated docs as CI artifacts
177
+ if : ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.11' }}
178
+ uses : actions/upload-artifact@v3
179
+ with :
180
+ name : docs-${{ github.run_id }}-${{ github.sha }}
181
+ path : ./build/docs/html/
182
+ - name : Read the mozilla-central commit hash to be used
183
+ run : echo "MOZCENTRAL_VERSION=$(cat mozcentral.version)" >> $GITHUB_ENV
168
184
- name : Use cached spidermonkey build
169
185
uses : actions/cache@v4
170
186
with :
171
187
path : |
172
188
./_spidermonkey_install/*
173
- key : spidermonkey115.8.0 -${{ runner.os }}-${{ runner.arch }}
189
+ key : spidermonkey-${{ env.MOZCENTRAL_VERSION }} -${{ runner.os }}-${{ runner.arch }}
174
190
fail-on-cache-miss : true # SpiderMonkey is expected to be cached in its dedicated job
175
191
- name : Build pminit
176
192
run : |
@@ -185,13 +201,24 @@ jobs:
185
201
WORKFLOW_BUILD_TYPE=${{ inputs.build_type }}
186
202
BUILD_TYPE=${WORKFLOW_BUILD_TYPE:-"Debug"} poetry build --format=wheel
187
203
ls -lah ./dist/
204
+ - name : Make the wheels we build also support lower versions of macOS
205
+ if : ${{ matrix.os == 'macos-12' || matrix.os == 'macos-14' }}
206
+ # Change the platform tag part of the wheel filename to `macosx_11_0_xxx` (means to support macOS 11.0 and above)
207
+ # See https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-format
208
+ # A wheel package file will only be selected by pip to install if the platform tag satisfies, regardless of whether the binary compatibility actually is.
209
+ # Otherwise, pip would fallback to compile from the source distribution.
210
+ run : |
211
+ cd ./dist/
212
+ for file in *.whl; do
213
+ mv "$file" "$(echo "$file" | sed -E 's/macosx_[0-9]+_[0-9]+/macosx_11_0/')";
214
+ done
188
215
- name : Upload wheel as CI artifacts
189
216
uses : actions/upload-artifact@v3
190
217
with :
191
218
name : wheel-${{ github.run_id }}-${{ github.sha }}
192
219
path : ./dist/
193
220
- name : Set cores to get stored in /cores
194
- if : ${{ matrix.os != 'windows-2019 ' }}
221
+ if : ${{ matrix.os != 'windows-2022 ' }}
195
222
# TODO (Caleb Aikens) figure out how to get Windows core dumps
196
223
run : |
197
224
sudo mkdir -p /cores
@@ -226,7 +253,7 @@ jobs:
226
253
credentials : " admin:admin"
227
254
- name : Upload core dumps as CI artifacts
228
255
uses : actions/upload-artifact@v3
229
- if : ${{ matrix.os != 'windows-2019 ' && failure() }}
256
+ if : ${{ matrix.os != 'windows-2022 ' && failure() }}
230
257
# TODO (Caleb Aikens) figure out how to get Windows core dumps
231
258
with :
232
259
name : cores-${{ matrix.os }}-${{ matrix.python_version }}
@@ -246,26 +273,27 @@ jobs:
246
273
version : 1.5.1
247
274
- name : Build source distribution (sdist) file
248
275
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
255
276
poetry self add "poetry-dynamic-versioning[plugin]"
256
- BUILD_DOCS=1 BUILD_TYPE=None poetry install
257
277
poetry build --format=sdist
258
278
ls -lah ./dist/
259
279
- name : Upload sdist as CI artifacts
260
280
uses : actions/upload-artifact@v3
261
281
with :
262
282
name : wheel-${{ github.run_id }}-${{ github.sha }}
263
283
path : ./dist/
264
- - name : Upload Doxygen-generated docs as CI artifacts
265
- uses : actions/upload-artifact@v3
284
+ check-install-from-sdist :
285
+ needs : sdist
286
+ runs-on : ubuntu-24.04
287
+ steps :
288
+ - uses : actions/setup-python@v5
266
289
with :
267
- name : docs-${{ github.run_id }}-${{ github.sha }}
268
- path : ./build/docs/html/
290
+ python-version : ' 3.10'
291
+ - name : Download wheels built
292
+ uses : actions/download-artifact@v3
293
+ with :
294
+ name : wheel-${{ github.run_id }}-${{ github.sha }}
295
+ path : ./dist/
296
+ - run : pip install ./dist/pythonmonkey-*.tar.gz
269
297
publish :
270
298
needs : [build-and-test, sdist]
271
299
runs-on : ubuntu-20.04
0 commit comments