Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7a398bf
python3-distutils is not needed and a problem on ubuntu-24_04
philippedistributive Jul 9, 2024
eebcb67
added ubuntu-24.04 to CI
philippedistributive Jul 9, 2024
862dbde
Merge branch 'main' into philippe/ubuntu2404-fix
philippedistributive Jul 10, 2024
efc161e
only use one version of ubuntu for CI, the latest one
philippedistributive Jul 11, 2024
a8cc4dd
Merge branch 'main' into philippe/ubuntu2404-fix
philippedistributive Jul 11, 2024
7f67f6e
still need ubuntu 20.04 after all as lowest common denominator
philippedistributive Jul 11, 2024
97c3220
Merge branch 'philippe/ubuntu2404-fix' of github.com:Distributive-Net…
philippedistributive Jul 11, 2024
9a6325b
restrict actions for ubuntu 24.04 to build and test
philippedistributive Jul 11, 2024
66f0078
more CI for Ubuntu 24.04
philippedistributive Jul 12, 2024
f888be4
fix(setup.sh): only perform dev configurations if in a repo
zollqir Jul 16, 2024
daeb266
meta(CI): include a test of sdist installation in CI
zollqir Jul 16, 2024
310ccf1
Update .github/workflows/test-and-publish.yaml
philippedistributive Jul 16, 2024
f854430
Update .github/workflows/test-and-publish.yaml
philippedistributive Jul 16, 2024
1d776f6
Update .github/workflows/test-and-publish.yaml
philippedistributive Jul 16, 2024
b319ae6
Update .github/workflows/test-and-publish.yaml
philippedistributive Jul 16, 2024
4ef34d2
fixup
philippedistributive Jul 16, 2024
984cb9d
Merge branch 'main' into philippe/ubuntu2404-fix
philippedistributive Jul 16, 2024
d70d555
Merge branch 'main' into philippe/ubuntu2404-fix
philippedistributive Jul 16, 2024
2633b5a
meta(CI): check-install-from-sdist step doesn't require build-and-test
zollqir Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/test-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
strategy:
fail-fast: false
matrix:
# Use Ubuntu 20.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
os: [ 'ubuntu-20.04', 'macos-13', 'macos-14' ] # macOS 14 runner exclusively runs on M1 hardwares
# Use Ubuntu 20.04 / Ubuntu 24.04 / macOS 13 x86_64 / macOS 14 arm64 + Python 3.10 to build SpiderMonkey
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-13', 'macos-14' ] # macOS 14 runner exclusively runs on M1 hardwares
# see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
python_version: [ '3.10' ]
runs-on: ${{ matrix.os }}
Expand All @@ -81,8 +81,7 @@ jobs:
lookup-only: true # skip download
- name: Setup XCode
if: ${{ (matrix.os == 'macos-13' || matrix.os == 'macos-14') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
# SpiderMonkey 115 ESR requires XCode SDK version at least 13.3
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#installed-sdks
# SpiderMonkey requires XCode SDK version at least 13.3
Comment thread
zollqir marked this conversation as resolved.
run: sudo xcode-select -switch /Applications/Xcode_14.3.app
- name: Build spidermonkey
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -128,8 +127,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# The lowest supported version is Ubuntu 20.04 + Python 3.8 or macOS 12 + Python 3.9
os: [ 'ubuntu-20.04', 'macos-12', 'macos-14', 'windows-2022' ]
os: [ 'ubuntu-20.04', 'ubuntu-24.04', 'macos-12', 'macos-14', 'windows-2022' ]
Comment thread
zollqir marked this conversation as resolved.
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
exclude:
# actions/setup-python: The version '3.8'/'3.9' with architecture 'arm64' was not found for macOS.
Expand Down Expand Up @@ -274,6 +272,19 @@ jobs:
with:
name: wheel-${{ github.run_id }}-${{ github.sha }}
path: ./dist/
check-install-from-sdist:
Comment thread
zollqir marked this conversation as resolved.
needs: sdist
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download wheels built
uses: actions/download-artifact@v3
with:
name: wheel-${{ github.run_id }}-${{ github.sha }}
path: ./dist/
- run: pip install ./dist/pythonmonkey-*.tar.gz
publish:
needs: [build-and-test, sdist]
runs-on: ubuntu-20.04
Expand Down
67 changes: 37 additions & 30 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
set -euo pipefail
IFS=$'\n\t'

# set git hooks
ln -s -f ../../githooks/pre-commit .git/hooks/pre-commit
# set blame ignore file
git config blame.ignorerevsfile .git-blame-ignore-revs

# Get number of CPU cores
CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)

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

echo "Downloading uncrustify source code"
wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz
mkdir -p uncrustify-source
tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder
echo "Done downloading uncrustify source code"

echo "Building uncrustify"
cd uncrustify-source
mkdir -p build
cd build
if [[ "$OSTYPE" == "msys"* ]]; then # Windows
cmake ../
cmake --build . -j$CPUS --config Release
cp Release/uncrustify.exe ../../uncrustify.exe
else
cmake ../
make -j$CPUS
cp uncrustify ../../uncrustify
fi
cd ../..
echo "Done building uncrustify"

echo "Downloading spidermonkey source code"
# Read the commit hash for mozilla-central from the `mozcentral.version` file
MOZCENTRAL_VERSION=$(cat mozcentral.version)
Expand Down Expand Up @@ -118,3 +93,35 @@ if [[ "$OSTYPE" == "darwin"* ]]; then # macOS
install_name_tool -id @rpath/$(basename ./libmozjs*) ./libmozjs* # making it work for whatever name the libmozjs dylib is called
fi
echo "Done installing spidermonkey"

# if this is being ran in the root directory of the PythonMonkey repo, then include dev configurations
if test -f .git/hooks/pre-commit; then
# set git hooks
ln -s -f ../../githooks/pre-commit .git/hooks/pre-commit
# set blame ignore file
git config blame.ignorerevsfile .git-blame-ignore-revs
# install autopep8
$POETRY_BIN run pip install autopep8
# install uncrustify
echo "Downloading uncrustify source code"
wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz
mkdir -p uncrustify-source
tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder
echo "Done downloading uncrustify source code"

echo "Building uncrustify"
cd uncrustify-source
mkdir -p build
cd build
if [[ "$OSTYPE" == "msys"* ]]; then # Windows
cmake ../
cmake --build . -j$CPUS --config Release
cp Release/uncrustify.exe ../../uncrustify.exe
else
cmake ../
make -j$CPUS
cp uncrustify ../../uncrustify
fi
cd ../..
echo "Done building uncrustify"
fi