Skip to content

Commit e77643f

Browse files
authored
Merge pull request #372 from Distributive-Network/philippe/ubuntu2404-fix
Philippe/ubuntu2404 fix
2 parents d0f237f + 2633b5a commit e77643f

File tree

2 files changed

+54
-36
lines changed

2 files changed

+54
-36
lines changed

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

+17-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ jobs:
5959
strategy:
6060
fail-fast: false
6161
matrix:
62-
# Use Ubuntu 20.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
63-
os: [ 'ubuntu-20.04', 'macos-13', 'macos-14' ] # macOS 14 runner exclusively runs on M1 hardwares
62+
# Use Ubuntu 20.04 / Ubuntu 24.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
63+
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-13', 'macos-14' ] # macOS 14 runner exclusively runs on M1 hardwares
6464
# see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
6565
python_version: [ '3.10' ]
6666
runs-on: ${{ matrix.os }}
@@ -81,8 +81,7 @@ jobs:
8181
lookup-only: true # skip download
8282
- name: Setup XCode
8383
if: ${{ (matrix.os == 'macos-13' || matrix.os == 'macos-14') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
84-
# SpiderMonkey 115 ESR requires XCode SDK version at least 13.3
85-
# 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
8685
run: sudo xcode-select -switch /Applications/Xcode_14.3.app
8786
- name: Build spidermonkey
8887
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
@@ -128,8 +127,7 @@ jobs:
128127
strategy:
129128
fail-fast: false
130129
matrix:
131-
# The lowest supported version is Ubuntu 20.04 + Python 3.8 or macOS 12 + Python 3.9
132-
os: [ 'ubuntu-20.04', 'macos-12', 'macos-14', 'windows-2022' ]
130+
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-12', 'macos-14', 'windows-2022' ]
133131
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
134132
exclude:
135133
# actions/setup-python: The version '3.8'/'3.9' with architecture 'arm64' was not found for macOS.
@@ -274,6 +272,19 @@ jobs:
274272
with:
275273
name: wheel-${{ github.run_id }}-${{ github.sha }}
276274
path: ./dist/
275+
check-install-from-sdist:
276+
needs: sdist
277+
runs-on: ubuntu-24.04
278+
steps:
279+
- uses: actions/setup-python@v5
280+
with:
281+
python-version: '3.10'
282+
- name: Download wheels built
283+
uses: actions/download-artifact@v3
284+
with:
285+
name: wheel-${{ github.run_id }}-${{ github.sha }}
286+
path: ./dist/
287+
- run: pip install ./dist/pythonmonkey-*.tar.gz
277288
publish:
278289
needs: [build-and-test, sdist]
279290
runs-on: ubuntu-20.04

setup.sh

+37-30
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
set -euo pipefail
33
IFS=$'\n\t'
44

5-
# set git hooks
6-
ln -s -f ../../githooks/pre-commit .git/hooks/pre-commit
7-
# set blame ignore file
8-
git config blame.ignorerevsfile .git-blame-ignore-revs
9-
105
# Get number of CPU cores
116
CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
127

@@ -17,11 +12,12 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
1712
# sudo is present on the system, so use it
1813
SUDO='sudo'
1914
fi
20-
$SUDO apt-get update --yes
15+
echo "Installing apt packages"
2116
$SUDO apt-get install --yes cmake graphviz llvm clang pkg-config m4 unzip \
22-
wget curl python3-distutils python3-dev
17+
wget curl python3-dev
2318
# Install Doxygen
2419
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
20+
echo "Installing doxygen"
2521
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
2622
tar xf doxygen-1.9.7.linux.bin.tar.gz
2723
cd doxygen-1.9.7 && $SUDO make install && cd -
@@ -36,41 +32,20 @@ else
3632
exit 1
3733
fi
3834
# Install rust compiler
35+
echo "Installing rust compiler"
3936
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.76
4037
cargo install cbindgen
4138
# Setup Poetry
39+
echo "Installing poetry"
4240
curl -sSL https://install.python-poetry.org | python3 - --version "1.7.1"
4341
if [[ "$OSTYPE" == "msys"* ]]; then # Windows
4442
POETRY_BIN="$APPDATA/Python/Scripts/poetry"
4543
else
4644
POETRY_BIN=`echo ~/.local/bin/poetry` # expand tilde
4745
fi
4846
$POETRY_BIN self add 'poetry-dynamic-versioning[plugin]'
49-
$POETRY_BIN run pip install autopep8
5047
echo "Done installing dependencies"
5148

52-
echo "Downloading uncrustify source code"
53-
wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz
54-
mkdir -p uncrustify-source
55-
tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder
56-
echo "Done downloading uncrustify source code"
57-
58-
echo "Building uncrustify"
59-
cd uncrustify-source
60-
mkdir -p build
61-
cd build
62-
if [[ "$OSTYPE" == "msys"* ]]; then # Windows
63-
cmake ../
64-
cmake --build . -j$CPUS --config Release
65-
cp Release/uncrustify.exe ../../uncrustify.exe
66-
else
67-
cmake ../
68-
make -j$CPUS
69-
cp uncrustify ../../uncrustify
70-
fi
71-
cd ../..
72-
echo "Done building uncrustify"
73-
7449
echo "Downloading spidermonkey source code"
7550
# Read the commit hash for mozilla-central from the `mozcentral.version` file
7651
MOZCENTRAL_VERSION=$(cat mozcentral.version)
@@ -118,3 +93,35 @@ if [[ "$OSTYPE" == "darwin"* ]]; then # macOS
11893
install_name_tool -id @rpath/$(basename ./libmozjs*) ./libmozjs* # making it work for whatever name the libmozjs dylib is called
11994
fi
12095
echo "Done installing spidermonkey"
96+
97+
# if this is being ran in the root directory of the PythonMonkey repo, then include dev configurations
98+
if test -f .git/hooks/pre-commit; then
99+
# set git hooks
100+
ln -s -f ../../githooks/pre-commit .git/hooks/pre-commit
101+
# set blame ignore file
102+
git config blame.ignorerevsfile .git-blame-ignore-revs
103+
# install autopep8
104+
$POETRY_BIN run pip install autopep8
105+
# install uncrustify
106+
echo "Downloading uncrustify source code"
107+
wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz
108+
mkdir -p uncrustify-source
109+
tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder
110+
echo "Done downloading uncrustify source code"
111+
112+
echo "Building uncrustify"
113+
cd uncrustify-source
114+
mkdir -p build
115+
cd build
116+
if [[ "$OSTYPE" == "msys"* ]]; then # Windows
117+
cmake ../
118+
cmake --build . -j$CPUS --config Release
119+
cp Release/uncrustify.exe ../../uncrustify.exe
120+
else
121+
cmake ../
122+
make -j$CPUS
123+
cp uncrustify ../../uncrustify
124+
fi
125+
cd ../..
126+
echo "Done building uncrustify"
127+
fi

0 commit comments

Comments
 (0)