diff --git a/.github/actions/set-up-legacy-python/action.yml b/.github/actions/set-up-legacy-python/action.yml index 791c7db8..18fec72e 100644 --- a/.github/actions/set-up-legacy-python/action.yml +++ b/.github/actions/set-up-legacy-python/action.yml @@ -20,6 +20,20 @@ runs: with: default: "${{ inputs.python-version }}" command: pip install -U pip + + - name: Restore PATH on cache hit + if: steps.pyenv-cache.outputs.cache-hit == 'true' + shell: bash + run: | + PYENV_ROOT="/opt/hostedtoolcache/pyenv_root/2.4.20/x64" + PYTHON_BIN="$PYENV_ROOT/versions/${{ inputs.python-version }}/bin" + echo "$PYTHON_BIN" >> $GITHUB_PATH + + - name: Verify Python version + shell: bash + run: | + echo "Active Python: $(python --version)" + python --version 2>&1 | grep -q "^Python ${{ inputs.python-version }}" || (echo "ERROR: Expected Python ${{ inputs.python-version }}" && exit 1) - name: Install dependencies run: | python -m pip install flake8 pytest setuptools wheel diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index db5076da..0f6e32b0 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -27,6 +27,11 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Verify Python version + shell: bash + run: | + echo "Active Python: $(python --version)" + python --version 2>&1 | grep -q "^Python ${{ inputs.python-version }}" || (echo "ERROR: Expected Python ${{ inputs.python-version }}" && exit 1) - name: Install dependencies run: | python -m pip install --upgrade pip @@ -34,13 +39,13 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | - flake8 . --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160 + python -m flake8 . --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160 - name: Lint with pyright (type checking) run: | - pyright cfbs --pythonversion ${{ matrix.python-version }} + python -m pyright cfbs --pythonversion ${{ matrix.python-version }} - name: Test with pytest run: | - pytest + python -m pytest - name: Install run: | python setup.py sdist bdist_wheel