Skip to content

chore(ci): use variable for poetry version #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ env:
METRICS_ENDPOINT: ${{ secrets.METRICS_ENDPOINT }}

jobs:
# ------------------------------------------ Check Files Changes ------------------------------------------
prepare-environment:
uses: ./.github/workflows/define-versions.yml
# ------------------------------------------ Check Files Changes ------------------------------------------
files-changed:
name: Detect which file has changed
runs-on: ubuntu-latest
Expand Down Expand Up @@ -152,7 +154,7 @@ jobs:
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
needs: ["files-changed", "yaml-lint", "python-lint"]
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
Expand All @@ -166,7 +168,7 @@ jobs:
python-version: "3.12"
- name: "Setup Python environment"
run: |
pipx install poetry==2.1
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
poetry config virtualenvs.create true --local
poetry env use 3.12
- name: "Install dependencies"
Expand Down Expand Up @@ -218,7 +220,7 @@ jobs:
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.files-changed.outputs.python == 'true'
needs: ["files-changed", "yaml-lint", "python-lint"]
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -230,7 +232,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: "Setup environment"
run: |
pipx install poetry==2.1 --python python${{ matrix.python-version }}
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }} --python python${{ matrix.python-version }}
poetry config virtualenvs.create true --local
pip install invoke toml codecov
- name: "Install Package"
Expand Down Expand Up @@ -266,7 +268,7 @@ jobs:
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.files-changed.outputs.python == 'true'
needs: ["files-changed", "yaml-lint", "python-lint"]
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
runs-on:
group: "huge-runners"
timeout-minutes: 30
Expand All @@ -283,7 +285,7 @@ jobs:
echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
- name: "Setup environment"
run: |
pipx install poetry==2.1
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
poetry config virtualenvs.create true --local
pip install invoke toml codecov
- name: "Install Package"
Expand All @@ -306,7 +308,7 @@ jobs:
# !contains(needs.*.result, 'cancelled') &&
# needs.files-changed.outputs.python == 'true' &&
# (github.base_ref == 'stable' || github.base_ref == 'develop')
# needs: ["files-changed", "yaml-lint", "python-lint"]
# needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
# runs-on:
# group: "huge-runners"
# timeout-minutes: 30
Expand Down Expand Up @@ -356,7 +358,7 @@ jobs:

# - name: "Setup environment"
# run: |
# pipx install poetry==2.1
# pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
# poetry config virtualenvs.create true --local
# pip install invoke toml codecov

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/define-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# yamllint disable rule:truthy rule:truthy rule:line-length
name: "Define versions"
on:
workflow_call:
outputs:
POETRY_VERSION:
value: "2.1.3"

jobs:
prepare:
runs-on: ubuntu-latest
steps:
- run: "true"
5 changes: 4 additions & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ on:
default: false

jobs:
prepare-environment:
uses: ./.github/workflows/define-versions.yml
publish_to_pypi:
name: "Publish Infrahub SDK to PyPI"
runs-on: "ubuntu-22.04"
needs: prepare-environment
steps:
- name: "Set up Python"
uses: "actions/setup-python@v5"
Expand All @@ -41,7 +44,7 @@ jobs:
- name: "Install Poetry"
uses: "snok/install-poetry@v1"
with:
version: 1.8.5
version: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ on:
- published

jobs:
prepare-environment:
uses: ./.github/workflows/define-versions.yml
check_release:
runs-on: ubuntu-22.04
needs: prepare-environment
outputs:
is_prerelease: ${{ steps.release.outputs.is_prerelease }}
is_devrelease: ${{ steps.release.outputs.is_devrelease }}
Expand All @@ -30,7 +33,7 @@ jobs:
- name: "Install Poetry"
uses: "snok/install-poetry@v1"
with:
version: 1.8.5
version: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
Expand Down
Loading