diff --git a/.github/workflows/simple-release.yml b/.github/workflows/simple-release.yml index dc13d3e..bcd3ca2 100644 --- a/.github/workflows/simple-release.yml +++ b/.github/workflows/simple-release.yml @@ -22,6 +22,18 @@ jobs: virtualenvs-create: true virtualenvs-in-project: true + - name: Ensure Poetry is on PATH (Windows) + shell: pwsh + run: | + # Add the typical Poetry installer location to PATH for subsequent steps. + # This writes the directory to GITHUB_PATH so it is appended to PATH automatically. + $poetryPath = Join-Path $env:USERPROFILE ".local\bin" + Write-Output "Adding $poetryPath to PATH via GITHUB_PATH" + Write-Output $poetryPath >> $Env:GITHUB_PATH + # Confirm it's on PATH for this step (diagnostics only) + Write-Output "PATH is now: $env:PATH" + Get-Command -ErrorAction SilentlyContinue poetry | ForEach-Object { Write-Output "poetry location: $($_.Source)" } || Write-Output "poetry not found yet (will be available in subsequent steps)" + - name: Install dependencies run: | poetry install @@ -39,7 +51,7 @@ jobs: build-debian: runs-on: ubuntu-latest container: - image: debian:12-slim + image: python:3.12-slim steps: - name: Install system dependencies run: | @@ -56,7 +68,7 @@ jobs: - name: Install Poetry run: | - curl -sSL https://install.python-poetry.org | python3.12 - + curl -sSL https://install.python-poetry.org | python - echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV - name: Configure Poetry @@ -68,7 +80,7 @@ jobs: - name: Install dependencies run: | export PATH="$HOME/.local/bin:$PATH" - poetry env use python3.12 + poetry env use python3.12 || true poetry install - name: Build Debian executable @@ -90,7 +102,7 @@ jobs: - name: Install system dependencies run: | pacman -Syu --noconfirm - pacman -S --noconfirm git base-devel curl + pacman -S --noconfirm python python-pip curl git base-devel - name: Checkout code uses: actions/checkout@v4 @@ -132,26 +144,66 @@ jobs: container: image: rockylinux:9 steps: - - name: Install system dependencies + - name: Install system build dependencies for Python and pyenv (enable CRB for -devel packages) run: | - dnf update -y - dnf install -y curl git gcc gcc-c++ make + # enable the CodeReady Builder (CRB) repository so -devel packages (like gdbm-devel) are available + dnf -y install dnf-plugins-core + dnf config-manager --set-enabled crb + + # Refresh metadata and install the packages required to build CPython from source + dnf -y update + dnf -y install git gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel \ + readline-devel sqlite-devel tk-devel gdbm-devel libuuid-devel patch - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install Poetry + - name: Install pyenv and build Python 3.12.11 (native to Rocky) — idempotent + env: + PYENV_ROOT: ${{ github.workspace }}/.pyenv_temp run: | - curl -sSL https://install.python-poetry.org | python3.12 - - echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV + # Use $HOME/.pyenv for the pyenv installation (runtime only — this will NOT change your repo files) + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + + # Clone or update pyenv (idempotent) + if [ -d "$PYENV_ROOT/.git" ]; then + echo "pyenv already exists — updating" + cd "$PYENV_ROOT" + git fetch --all --prune + git reset --hard origin/master || true + cd - + else + echo "Cloning pyenv" + git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT" + fi + + # Persist pyenv environment for subsequent steps + echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV + echo "PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" >> $GITHUB_ENV + + # Initialize pyenv for this step and ensure pyenv is usable immediately + export PATH="$PYENV_ROOT/bin:$PATH" + eval "$($PYENV_ROOT/bin/pyenv init -)" + + # Install the specified Python version if not already installed (-s = skip if present) + $PYENV_ROOT/bin/pyenv install -s 3.12.11 + $PYENV_ROOT/bin/pyenv global 3.12.11 + + # Verify installed python + python --version + pip --version + + - name: Install Poetry (use action; Poetry will use the pyenv-built python) + uses: snok/install-poetry@v1 + with: + version: latest + virtualenvs-create: true + virtualenvs-in-project: true - name: Configure Poetry run: | + echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV export PATH="$HOME/.local/bin:$PATH" poetry config virtualenvs.create true poetry config virtualenvs.in-project true @@ -159,7 +211,8 @@ jobs: - name: Install dependencies run: | export PATH="$HOME/.local/bin:$PATH" - poetry env use python3.12 + # ensure poetry uses the pyenv python + poetry env use 3.12.11 || true poetry install - name: Build Rocky executable