Skip to content

Commit 975f7ca

Browse files
committed
Extract Poetry project setup
Signed-off-by: Tim Walter <tim.walter@iteratec.com>
1 parent b84875f commit 975f7ca

File tree

3 files changed

+59
-27
lines changed

3 files changed

+59
-27
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Setup Poetry Project
2+
description: "Set ups Poetry and install the project's dependencies"
3+
4+
inputs:
5+
install_plugin:
6+
description: "Whether the Poetry dynamic versioning plugin should be installed"
7+
required: true
8+
default: "true"
9+
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Install Poetry
15+
env:
16+
PIP_PROGRESS_BAR: "off"
17+
PIP_DISABLE_PIP_VERSION_CHECK: "on"
18+
shell: sh
19+
run: |
20+
export POETRY_HOME=$HOME/poetry
21+
python -m venv $POETRY_HOME
22+
$POETRY_HOME/bin/pip install poetry==1.8.3
23+
$POETRY_HOME/bin/poetry --version
24+
echo "$HOME/poetry/bin" >> $GITHUB_PATH
25+
26+
- name: Add Poetry plugin
27+
env:
28+
PIP_PROGRESS_BAR: "off"
29+
PIP_DISABLE_PIP_VERSION_CHECK: "on"
30+
POETRY_NO_INTERACTION: 1
31+
POETRY_VIRTUALENVS_IN_PROJECT: true
32+
shell: sh
33+
if: ${{ inputs.install_plugin == 'true' }}
34+
run: poetry self add "poetry-dynamic-versioning[plugin]"
35+
36+
- name: Install Dependencies
37+
env:
38+
POETRY_NO_INTERACTION: 1
39+
POETRY_VIRTUALENVS_IN_PROJECT: true
40+
shell: sh
41+
run: poetry install --with dev

.github/workflows/lint.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ jobs:
2424
image: python:3.12-alpine
2525

2626
steps:
27-
- name: Checkout Repository
28-
uses: actions/checkout@v4
27+
- name: Checkout Repository
28+
uses: actions/checkout@v4
2929

30-
- name: Install Poetry
31-
run: pip install poetry
30+
- uses: ./.github/actions/setup-poetry-project
31+
with:
32+
install_plugin: false
3233

33-
- name: Install Dependencies
34-
run: poetry install --with dev
34+
- name: Run ruff check
35+
run: poetry run ruff check
3536

36-
- name: Run ruff check
37-
run: poetry run ruff check
38-
39-
- name: Run ruff format check
40-
run: poetry run ruff format --check .
37+
- name: Run ruff format check
38+
run: poetry run ruff format --check .

.github/workflows/test.yaml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,22 @@ jobs:
1212
tests:
1313
runs-on: ubuntu-latest
1414
env:
15-
PIP_PROGRESS_BAR: "off"
16-
PIP_DISABLE_PIP_VERSION_CHECK: "on"
1715
POETRY_NO_INTERACTION: 1
18-
POETRY_VIRTUALENVS_CREATE: false
1916
strategy:
2017
matrix:
21-
python-version: ['3.11', '3.12'] # Define Python versions here
18+
python-version: [ '3.11', '3.12' ] # Define Python versions here
2219

2320
container:
2421
image: python:${{ matrix.python-version }}-alpine # Use Python Docker images
2522

2623
steps:
27-
- name: Checkout Repository
28-
uses: actions/checkout@v4
24+
- name: Checkout Repository
25+
uses: actions/checkout@v4
2926

30-
- name: Install Poetry
31-
run: |
32-
pip install poetry
27+
- uses: ./.github/actions/setup-poetry-project
28+
with:
29+
install_plugin: false
3330

34-
- name: Install Dependencies
35-
run: |
36-
poetry install --with dev
37-
38-
- name: Run Pytest
39-
run: |
40-
poetry run pytest
31+
- name: Run Pytest
32+
run: |
33+
poetry run pytest

0 commit comments

Comments
 (0)