Skip to content

Commit

Permalink
Merge pull request #372 from Distributive-Network/philippe/ubuntu2404…
Browse files Browse the repository at this point in the history
…-fix

Philippe/ubuntu2404 fix
  • Loading branch information
caleb-distributive authored Jul 16, 2024
2 parents d0f237f + 2633b5a commit e77643f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 36 deletions.
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
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' ]
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:
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

0 comments on commit e77643f

Please sign in to comment.