Merge pull request #2447 from native-api/ci_modified_micropython

CI: support Micropython, deleted scripts; build with -v
This commit is contained in:
native-api 2022-09-03 22:22:56 +03:00 committed by GitHub
commit 2e5983b004
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 28 deletions

View file

@ -27,7 +27,7 @@ jobs:
run: | run: |
echo $PYENV_ROOT echo $PYENV_ROOT
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
bin/pyenv install ${{ matrix.python-version }} bin/pyenv install -v ${{ matrix.python-version }}
bin/pyenv global ${{ matrix.python-version }} bin/pyenv global ${{ matrix.python-version }}
bin/pyenv rehash bin/pyenv rehash
- run: python --version - run: python --version

View file

@ -12,7 +12,7 @@ jobs:
run: > run: >
versions=$(git diff "origin/$GITHUB_BASE_REF" --name-only -z versions=$(git diff "origin/$GITHUB_BASE_REF" --name-only -z
| perl -ne 'BEGIN {$\="\n";$/="\0";} chomp; | perl -ne 'BEGIN {$\="\n";$/="\0";} chomp;
if (/^plugins\/python-build\/share\/python-build\/(?:([^\/]+)|patches\/([^\/]+)\/.*)$/) if (/^plugins\/python-build\/share\/python-build\/(?:([^\/]+)|patches\/([^\/]+)\/.*)$/ and -e $& )
{ print $1.$2; }' \ { print $1.$2; }' \
| sort -u); | sort -u);
echo -e "versions<<!\\n$versions\\n!" >> $GITHUB_ENV echo -e "versions<<!\\n$versions\\n!" >> $GITHUB_ENV
@ -38,22 +38,33 @@ jobs:
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: | - run: |
pyenv install ${{ matrix.python-version }} pyenv install -v ${{ matrix.python-version }}
pyenv global ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }}
- run: | # Micropython doesn't support --version
python --version - run: >
python -m pip --version if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
- shell: python # Prove that actual Python == expected Python python -c 'import sys; print(sys.version)'
env: 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 }} EXPECTED_PYTHON: ${{ matrix.python-version }}
run: | run: |
import os, sys, os.path if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
correct_dir = os.path.join( [[ $(pyenv which python) == "${{ env.PYENV_ROOT }}/versions/${{ matrix.python-version }}/bin/python" ]] || exit 1
os.environ['PYENV_ROOT'], python -c 'import sys; assert sys.implementation.name == "micropython"'
'versions', else
os.environ['EXPECTED_PYTHON'], python -c 'if True:
'bin') import os, sys, os.path
assert os.path.dirname(sys.executable) == correct_dir 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 # bundled executables in some Anaconda releases cause the post-run step to hang in MacOS
- run: | - run: |
pyenv global system pyenv global system
@ -80,18 +91,30 @@ jobs:
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: | - run: |
pyenv install ${{ matrix.python-version }} pyenv install -v ${{ matrix.python-version }}
pyenv global ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }}
- run: python --version # Micropython doesn't support --version
- run: python -m pip --version - run: >
- shell: python # Prove that actual Python == expected Python if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
env: 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 }} EXPECTED_PYTHON: ${{ matrix.python-version }}
run: | run: |
import os, sys, os.path if [[ "${{ matrix.python-version }}" == "micropython-"* ]]; then
correct_dir = os.path.join( [[ $(pyenv which python) == "${{ env.PYENV_ROOT }}/versions/${{ matrix.python-version }}/bin/python" ]] || exit 1
os.environ['PYENV_ROOT'], python -c 'import sys; assert sys.implementation.name == "micropython"'
'versions', else
os.environ['EXPECTED_PYTHON'], python -c 'if True:
'bin') import os, sys, os.path
assert os.path.dirname(sys.executable) == correct_dir correct_dir = os.path.join(
os.environ["PYENV_ROOT"],
"versions",
os.environ["EXPECTED_PYTHON"],
"bin")
assert os.path.dirname(sys.executable) == correct_dir'
fi

View file

@ -29,7 +29,7 @@ jobs:
run: | run: |
echo $PYENV_ROOT echo $PYENV_ROOT
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
bin/pyenv install ${{ matrix.python-version }} bin/pyenv install -v ${{ matrix.python-version }}
bin/pyenv global ${{ matrix.python-version }} bin/pyenv global ${{ matrix.python-version }}
bin/pyenv rehash bin/pyenv rehash
- run: python --version - run: python --version