From da540ce9a4b58b4861f84edff41840a1aa43a851 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Fri, 1 May 2026 20:31:19 +0200 Subject: [PATCH] Use python from venv --- .gitea/workflows/test.yaml | 37 +++++++++++++++++++++++++++++++++---- Dockerfile | 3 +++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index 5cbf939..17cc367 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -6,18 +6,47 @@ env: jobs: run-tests: runs-on: python + container: + image: catthehacker/ubuntu:act-24.04 steps: - name: Checkout uses: actions/checkout@v4 with: ssh-key: ${{ secrets.SSH_JOHN_PRIVATE_KEY }} + - name: Setup Python + id: setup_python + uses: actions/setup-python@v6 + with: + python-version: '3.14.1' + architecture: 'x86' + cache: 'pip' + - name: Restore cached virtualenv + uses: actions/cache/restore@v4 + with: + key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }} + path: .venv + - name: Create virtual env + run: | + python3 -m venv .venv + source .venv/bin/activate + which python + python --version + python -m sqlite3 --version - name: Install poetry run: | - python3 -m pip install poetry==2.3.4 + source .venv/bin/activate + pip install poetry==2.3.4 - name: Install the project dependencies run: | - python3 -m poetry install - python3 -m poetry env info + source .venv/bin/activate + poetry install + poetry env info + - name: Cache virtual env + uses: actions/cache/save@v4 + with: + key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }} + path: .venv - name: Run the automated tests run: | - python3 -m poetry run python -m pytest tests + source .venv/bin/activate + poetry run pytest tests diff --git a/Dockerfile b/Dockerfile index bf389f5..f49ed01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,9 @@ ENV PYTHONFAULTHANDLER=1 \ POETRY_CACHE_DIR='/var/cache/pypoetry' \ POETRY_HOME='/usr/local' +RUN apk update && \ + apk upgrade && \ + rm -rf /var/cache/apk/* RUN apk add --no-cache tini RUN pip install -Iv --no-cache-dir "poetry==${POETRY_VERSION}"