From ca71e56c481c6d5ce69b4756f8f8c0aff97d79b5 Mon Sep 17 00:00:00 2001 From: dirkf Date: Thu, 20 Jul 2023 16:36:54 +0100 Subject: [PATCH] [workflows/ci.yml] Build 3.12 with pyenv --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10951d322..a1e21fd4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: #-------- 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: @@ -162,6 +162,42 @@ jobs: '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' }} @@ -325,7 +361,7 @@ jobs: 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"