diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 9da1b68f..296b66af 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -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 }} @@ -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' }} @@ -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. @@ -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 diff --git a/setup.sh b/setup.sh index f647ee84..eab31081 100755 --- a/setup.sh +++ b/setup.sh @@ -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) @@ -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 - @@ -36,9 +32,11 @@ 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" @@ -46,31 +44,8 @@ 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) @@ -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 \ No newline at end of file