From 13f273188d233c613c1183e2914a9c472dd0749a Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 3 Sep 2022 02:11:33 +0300 Subject: [PATCH 1/3] CI: Exclude deleted scripts from modified check --- .github/workflows/modified_scripts_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/modified_scripts_build.yml b/.github/workflows/modified_scripts_build.yml index 15ca6497..a34056ed 100644 --- a/.github/workflows/modified_scripts_build.yml +++ b/.github/workflows/modified_scripts_build.yml @@ -12,7 +12,7 @@ jobs: 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\/([^\/]+)\/.*)$/) + if (/^plugins\/python-build\/share\/python-build\/(?:([^\/]+)|patches\/([^\/]+)\/.*)$/ and -e $& ) { print $1.$2; }' \ | sort -u); echo -e "versions<> $GITHUB_ENV From 7c1e3a710ceb7fae99975fe9487635bd309a31df Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 3 Sep 2022 02:20:24 +0300 Subject: [PATCH 2/3] CI: Support Micropython --- .github/workflows/modified_scripts_build.yml | 69 +++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/.github/workflows/modified_scripts_build.yml b/.github/workflows/modified_scripts_build.yml index a34056ed..f3ae23b5 100644 --- a/.github/workflows/modified_scripts_build.yml +++ b/.github/workflows/modified_scripts_build.yml @@ -40,20 +40,31 @@ jobs: - run: | pyenv install ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }} - - run: | - python --version - python -m pip --version - - shell: python # Prove that actual Python == expected Python - env: + # Micropython doesn't support --version + - run: > + 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: | - 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 + 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 @@ -82,16 +93,28 @@ jobs: - run: | pyenv install ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }} - - run: python --version - - run: python -m pip --version - - shell: python # Prove that actual Python == expected Python - env: + # Micropython doesn't support --version + - run: > + 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: | - 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 + 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 From 27b5f62dfb431e9961f2d8ad940f3ea535a2e17e Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Sat, 3 Sep 2022 21:43:05 +0300 Subject: [PATCH 3/3] CI: Build with -v --- .github/workflows/macos_build.yml | 2 +- .github/workflows/modified_scripts_build.yml | 4 ++-- .github/workflows/ubuntu_build.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml index 83f86957..fb295bae 100644 --- a/.github/workflows/macos_build.yml +++ b/.github/workflows/macos_build.yml @@ -27,7 +27,7 @@ jobs: run: | echo $PYENV_ROOT 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 rehash - run: python --version diff --git a/.github/workflows/modified_scripts_build.yml b/.github/workflows/modified_scripts_build.yml index f3ae23b5..0544ada3 100644 --- a/.github/workflows/modified_scripts_build.yml +++ b/.github/workflows/modified_scripts_build.yml @@ -38,7 +38,7 @@ jobs: echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH - run: | - pyenv install ${{ matrix.python-version }} + pyenv install -v ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }} # Micropython doesn't support --version - run: > @@ -91,7 +91,7 @@ jobs: echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH - run: | - pyenv install ${{ matrix.python-version }} + pyenv install -v ${{ matrix.python-version }} pyenv global ${{ matrix.python-version }} # Micropython doesn't support --version - run: > diff --git a/.github/workflows/ubuntu_build.yml b/.github/workflows/ubuntu_build.yml index 3f9d2d58..852eb530 100644 --- a/.github/workflows/ubuntu_build.yml +++ b/.github/workflows/ubuntu_build.yml @@ -29,7 +29,7 @@ jobs: run: | echo $PYENV_ROOT 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 rehash - run: python --version