#-------- Python 3 -----
- name: Set up supported Python ${{ matrix.python-version }}
id: setup-python
- if: ${{ matrix.python-impl == 'cpython' && matrix.python-version != '2.6' && matrix.python-version != '2.7'}}
+ if: ${{ matrix.python-impl == 'cpython' && matrix.python-version != '2.6' && matrix.python-version != '2.7' && matrix.python-version != '3.12'}}
# wrap broken actions/setup-python@v4
uses: ytdl-org/setup-python@v1
with:
'import sys' \
'print(sys.path)' \
| ${expected} -
+ #-------- Python 3.12 -
+ - name: Set up Python 3.12 environment
+ if: ${{ matrix.python-version == '3.12' }}
+ shell: bash
+ run: |
+ PYENV_ROOT=$HOME/.local/share/pyenv
+ echo "PYENV_ROOT=${PYENV_ROOT}" >> "$GITHUB_ENV"
+ - name: Cache Python 3.12
+ id: cache312
+ if: ${{ matrix.python-version == '3.12' }}
+ uses: actions/cache@v3
+ with:
+ key: python-3.12
+ path: |
+ ${{ env.PYENV_ROOT }}
+ - name: Build and set up Python 3.12
+ if: ${{ matrix.python-version == '3.12' && ! steps.cache312.outputs.cache-hit }}
+ # dl and build locally
+ shell: bash
+ run: |
+ # Install build environment
+ sudo apt-get install -y build-essential llvm libssl-dev tk-dev \
+ libncursesw5-dev libreadline-dev libsqlite3-dev \
+ libffi-dev xz-utils zlib1g-dev libbz2-dev liblzma-dev
+ # Download PyEnv from its GitHub repository.
+ export PYENV_ROOT=${{ env.PYENV_ROOT }}
+ export PATH=$PYENV_ROOT/bin:$PATH
+ git clone "https://github.com/pyenv/pyenv.git" "$PYENV_ROOT"
+ pyenv install 3.12.0b4
+ - name: Locate Python 3.12
+ if: ${{ matrix.python-version == '3.12' }}
+ shell: bash
+ run: |
+ PYTHONHOME="${{ env.PYENV_ROOT }}/versions/3.12.0b4"
+ echo "PYTHONHOME=$PYTHONHOME" >> "$GITHUB_ENV"
+ echo "PATH=${PYTHONHOME}/bin:$PATH" >> "$GITHUB_ENV"
#-------- Python 2.7 --
- name: Set up Python 2.7
if: ${{ matrix.python-version == '2.7' }}
done
#-------- nose --------
- name: Install nose for Python ${{ matrix.python-version }}
- if: ${{ (matrix.python-version != '3.2' && steps.setup-python.outputs.python-path) || matrix.python-version == '2.7' }}
+ if: ${{ (matrix.python-version != '3.2' && steps.setup-python.outputs.python-path) || matrix.python-version == '2.7' || matrix.python-version == '3.12' }}
shell: bash
run: |
echo "$PATH"