2022-05-23 00:36:39 +00:00
|
|
|
name: modified_scripts
|
|
|
|
on: [pull_request]
|
|
|
|
jobs:
|
|
|
|
discover_modified_scripts:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
versions: ${{steps.modified-versions.outputs.versions}}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- run: git fetch origin "$GITHUB_BASE_REF"
|
|
|
|
- shell: bash
|
|
|
|
run: >
|
|
|
|
versions=$(git diff "origin/$GITHUB_BASE_REF" --name-only -z
|
|
|
|
| perl -ne 'BEGIN {$\="\n";$/="\0";} chomp;
|
|
|
|
if (/^plugins\/python-build\/share\/python-build\/(?:([^\/]+)|patches\/([^\/]+)\/.*)$/)
|
|
|
|
{ print $1.$2; }' \
|
|
|
|
| sort -u);
|
|
|
|
echo -e "versions<<!\\n$versions\\n!" >> $GITHUB_ENV
|
|
|
|
- id: modified-versions
|
|
|
|
run: |
|
|
|
|
echo -n "::set-output name=versions::"
|
|
|
|
echo "${{ env.versions }}" | jq -R . | jq -sc .
|
|
|
|
macos_build:
|
|
|
|
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-10.15", "macos-11"]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- run: |
|
|
|
|
brew install openssl openssl@1.1 readline sqlite3 xz zlib
|
2022-06-05 22:07:46 +00:00
|
|
|
- run: |
|
2022-06-08 17:36:10 +00:00
|
|
|
export PYENV_ROOT="$GITHUB_WORKSPACE"
|
|
|
|
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
|
2022-05-23 00:36:39 +00:00
|
|
|
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
|
2022-06-05 22:07:46 +00:00
|
|
|
- run: |
|
|
|
|
pyenv install ${{ matrix.python-version }}
|
|
|
|
pyenv global ${{ matrix.python-version }}
|
2022-06-08 17:36:10 +00:00
|
|
|
- run: |
|
|
|
|
python --version
|
|
|
|
python -m pip --version
|
2022-05-23 00:36:39 +00:00
|
|
|
- shell: python # Prove that actual Python == expected Python
|
|
|
|
env:
|
|
|
|
EXPECTED_PYTHON: ${{ matrix.python-version }}
|
2022-06-05 22:07:46 +00:00
|
|
|
run: |
|
|
|
|
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
|
2022-06-08 17:36:10 +00:00
|
|
|
# bundled executables in some Anaconda releases cause the post-run step to hang in MacOS
|
|
|
|
- run: |
|
|
|
|
pyenv global system
|
|
|
|
rm -f "$(pyenv root)"/shims/*
|
2022-05-23 00:36:39 +00:00
|
|
|
|
|
|
|
ubuntu_build:
|
|
|
|
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: ["ubuntu-18.04", "ubuntu-20.04"]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- run: |
|
|
|
|
sudo apt-get update -q; sudo apt-get install -yq build-essential \
|
|
|
|
libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
|
|
|
|
wget curl llvm libncurses5-dev libncursesw5-dev \
|
|
|
|
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
|
2022-06-05 22:07:46 +00:00
|
|
|
- run: |
|
2022-06-08 17:36:10 +00:00
|
|
|
export PYENV_ROOT="$GITHUB_WORKSPACE"
|
|
|
|
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
|
2022-05-23 00:36:39 +00:00
|
|
|
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
|
2022-06-05 22:07:46 +00:00
|
|
|
- run: |
|
|
|
|
pyenv install ${{ matrix.python-version }}
|
|
|
|
pyenv global ${{ matrix.python-version }}
|
2022-05-23 00:36:39 +00:00
|
|
|
- run: python --version
|
|
|
|
- run: python -m pip --version
|
|
|
|
- shell: python # Prove that actual Python == expected Python
|
|
|
|
env:
|
|
|
|
EXPECTED_PYTHON: ${{ matrix.python-version }}
|
2022-06-05 22:07:46 +00:00
|
|
|
run: |
|
|
|
|
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
|