Skip to content

Commit

Permalink
fix: CI pipelines issue with wrong poetry version
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinying committed Jan 6, 2025
1 parent 7b66910 commit 14d0563
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
28 changes: 20 additions & 8 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
required: false
description: "The python version to use"
default: "3.12"
poetry-version:
required: false
description: "The poetry version to use"
default: "1.8.3"

runs:
using: "composite"
Expand All @@ -14,21 +18,29 @@ runs:
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
plugins: poetry-plugin-export
cache: 'pip'

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-${{ inputs.python-version }}-
- name: Install Poetry
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: ${{ inputs.poetry-version }}
virtualenvs-in-project: true
installer-parallel: true
plugins: poetry-plugin-export

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction --no-root
shell: bash
24 changes: 17 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
quality-check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out
uses: actions/checkout@v4
Expand All @@ -21,6 +23,8 @@ jobs:

tox:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
Expand All @@ -29,30 +33,36 @@ jobs:
- name: Check out
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v5
- name: Set up poetry
uses: ./.github/actions/setup-poetry
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Load cached venv
- name: Load cached tox
id: cached-tox
uses: actions/cache@v4
with:
path: .tox
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
key: tox-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
tox-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install tox
if: steps.cached-tox.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
env:
PYTHON_VERSION: ${{ matrix.python-version }}

docs:
runs-on: ubuntu-latest
permissions:
contents: read
if: github.event_name != 'pull_request'
steps:
- name: Check out
uses: actions/checkout@v4
Expand Down

0 comments on commit 14d0563

Please sign in to comment.