forked from pyenv/pyenv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: + build with bundled MacOS dependencies (pyenv#3123)
- Loading branch information
1 parent
4c90a31
commit 25e70b2
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,67 @@ jobs: | |
pyenv global system | ||
rm -f "$(pyenv root)"/shims/* | ||
macos_build_bundled_dependencies: | ||
needs: discover_modified_scripts | ||
if: needs.discover_modified_scripts.outputs.versions != '[""]' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ${{fromJson(needs.discover_modified_scripts.outputs.versions)}} | ||
os: ["macos-13", "macos-14"] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
#envvars | ||
export PYENV_ROOT="$GITHUB_WORKSPACE" | ||
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV | ||
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH | ||
- run: | | ||
#prerequisites | ||
brew install sqlite3 xz zlib | ||
"$GITHUB_WORKSPACE/.github/workflows/scripts/brew-uninstall-cascade.sh" openssl@3 [email protected] readline | ||
if [[ "${{ matrix.python-version }}" =~ pypy.*-(src|dev) ]]; then | ||
export PYENV_BOOTSTRAP_VERSION=pypy2.7-7 | ||
echo "PYENV_BOOTSTRAP_VERSION=$PYENV_BOOTSTRAP_VERSION" >> $GITHUB_ENV | ||
pyenv install $PYENV_BOOTSTRAP_VERSION | ||
fi | ||
- run: | | ||
#build | ||
pyenv --debug install ${{ matrix.python-version }} | ||
pyenv global ${{ matrix.python-version }} | ||
# Micropython doesn't support --version | ||
- run: | | ||
#print version | ||
if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then | ||
python -c 'import sys; print(sys.version)' | ||
else | ||
python --version | ||
python -m pip --version | ||
fi | ||
# Micropython doesn't support sys.executable, os.path, older versions even os | ||
- env: | ||
EXPECTED_PYTHON: ${{ matrix.python-version }} | ||
run: | | ||
#check | ||
if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then | ||
[[ $(pyenv which python) == "${{ env.PYENV_ROOT }}/versions/${{ matrix.python-version }}/bin/python" ]] || exit 1 | ||
python -c 'import sys; assert sys.implementation.name == "micropython"' | ||
else | ||
python -c 'if True: | ||
import os, sys, os.path | ||
correct_dir = os.path.join( | ||
os.environ["PYENV_ROOT"], | ||
"versions", | ||
os.environ["EXPECTED_PYTHON"], | ||
"bin") | ||
assert os.path.dirname(sys.executable) == correct_dir' | ||
fi | ||
# bundled executables in some Anaconda releases cause the post-run step to hang in MacOS | ||
- run: | | ||
pyenv global system | ||
rm -f "$(pyenv root)"/shims/* | ||
ubuntu_build: | ||
needs: discover_modified_scripts | ||
if: needs.discover_modified_scripts.outputs.versions != '[""]' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
declare -a packages rdepends | ||
packages=("$@") | ||
|
||
# have to try one by one, otherwise `brew uses` would only print | ||
# packages that require them all rather than any of them | ||
for package in "${packages[@]}"; do | ||
rdepends+=($(brew uses --installed --include-build --include-test --include-optional --recursive "$package")) | ||
done | ||
brew uninstall "${packages[@]}" "${rdepends[@]}" |