Skip to content

Commit a865b9a

Browse files
committed
Test with poetry env
1 parent ed2c2ae commit a865b9a

File tree

3 files changed

+46
-8
lines changed

3 files changed

+46
-8
lines changed

.github/actions/config-poetry-win/action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ name: Configure Poetry for Windows
33
description: GitHub Action to configure a poetry project for windows runner
44

55
inputs:
6-
poetry_version:
6+
poetry-version:
77
description: The version of poetry to install
88
default: 2.2.1
9+
poetry-virtualenvs-path:
10+
description: Path to the Poetry virtual environments, relative to GitHub workspace. The folder is cached only if it is a subdirectory of
11+
`poetry-cache-dir`.
12+
default: .cache/pypoetry/virtualenvs
13+
poetry-cache-dir:
14+
description: Path to the Poetry cache directory, relative to GitHub workspace.
15+
default: .cache/pypoetry
916
outputs:
1017
BUILD_NUMBER:
1118
description: The build number, incremented or reused if already cached
@@ -25,7 +32,7 @@ runs:
2532
- name: Cache local Poetry cache
2633
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
2734
with:
28-
path: ${{ github.workspace }}/.cache/pypoetry
35+
path: ${{ github.workspace }}/${{ inputs.poetry-cache-dir }}
2936
key: poetry-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
3037
restore-keys: poetry-${{ runner.os }}-
3138
- name: Vault
@@ -45,6 +52,9 @@ runs:
4552
- name: Install Poetry
4653
id: install_poetry
4754
shell: bash
55+
env:
56+
POETRY_VIRTUALENVS_PATH: ${{ github.workspace }}/${{ inputs.poetry-virtualenvs-path }}
57+
POETRY_CACHE_DIR: ${{ github.workspace }}/${{ inputs.poetry-cache-dir }}
4858
run: |
4959
pip install poetry==${{ inputs.poetry_version }}
5060
- name: Config Poetry
@@ -54,6 +64,8 @@ runs:
5464
ARTIFACTORY_URL: https://repox.jfrog.io/artifactory
5565
ARTIFACTORY_PYPI_REPO: sonarsource-pypi
5666
ARTIFACTORY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ACCESS_TOKEN }}
67+
POETRY_VIRTUALENVS_PATH: ${{ github.workspace }}/${{ inputs.poetry-virtualenvs-path }}
68+
POETRY_CACHE_DIR: ${{ github.workspace }}/${{ inputs.poetry-cache-dir }}
5769
run: |
5870
${GITHUB_ACTION_PATH}/../../scripts/config-poetry.sh
5971

.github/actions/config-poetry/action.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@ name: Configure Poetry
33
description: GitHub Action to configure a poetry project
44

55
inputs:
6-
poetry_version:
6+
poetry-version:
77
description: The version of poetry to install
88
default: 2.2.1
9-
jfrog_version:
9+
jfrog-version:
1010
description: The version of jFrog to install
1111
default: 2.77.0
12+
poetry-virtualenvs-path:
13+
description: Path to the Poetry virtual environments, relative to GitHub workspace. The folder is cached only if it is a subdirectory of
14+
`poetry-cache-dir`.
15+
default: .cache/pypoetry/virtualenvs
16+
poetry-cache-dir:
17+
description: Path to the Poetry cache directory, relative to GitHub workspace.
18+
default: .cache/pypoetry
1219
outputs:
1320
BUILD_NUMBER:
1421
description: The build number, incremented or reused if already cached
@@ -28,13 +35,13 @@ runs:
2835
- name: Cache local Poetry cache
2936
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
3037
with:
31-
path: ${{ github.workspace }}/.cache/pypoetry
38+
path: ${{ github.workspace }}/${{ inputs.poetry-cache-dir }}
3239
key: poetry-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
3340
restore-keys: poetry-${{ runner.os }}-
3441
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
3542
with:
3643
version: 2025.7.12
37-
install_args: "jfrog-cli@${{ inputs.jfrog_version }} poetry@${{ inputs.poetry_version}}"
44+
install_args: "jfrog-cli@${{ inputs.jfrog-version }} poetry@${{ inputs.poetry-version }}"
3845
- name: Vault
3946
# yamllint disable rule:line-length
4047
id: secrets
@@ -50,8 +57,10 @@ runs:
5057
ARTIFACTORY_URL: https://repox.jfrog.io/artifactory
5158
ARTIFACTORY_PYPI_REPO: sonarsource-pypi
5259
ARTIFACTORY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ACCESS_TOKEN }}
60+
POETRY_VIRTUALENVS_PATH: ${{ github.workspace }}/${{ inputs.poetry-virtualenvs-path }}
61+
POETRY_CACHE_DIR: ${{ github.workspace }}/${{ inputs.poetry-cache-dir }}
5362
run: |
54-
mise use -g poetry@${{ inputs.poetry_version }}
55-
mise use -g jfrog-cli@${{ inputs.jfrog_version }}
63+
mise use -g poetry@${{ inputs.poetry-version }}
64+
mise use -g jfrog-cli@${{ inputs.jfrog-version }}
5665
${GITHUB_ACTION_PATH}/../../scripts/config-poetry.sh
5766

.github/workflows/build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,21 @@ jobs:
2929
artifactory-deployer-role: qa-deployer
3030
deploy-pull-request: true
3131

32+
install_deps:
33+
name: "Install Dependencies"
34+
runs-on: github-ubuntu-latest-s
35+
permissions:
36+
id-token: write
37+
contents: write
38+
steps:
39+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
40+
- uses: ./.github/actions/config-poetry
41+
- run: |
42+
poetry install
43+
3244
formatting:
3345
name: "Formatting"
46+
needs: [install_deps]
3447
runs-on: github-ubuntu-latest-s
3548
permissions:
3649
id-token: write
@@ -47,6 +60,7 @@ jobs:
4760
documentation:
4861
name: "CLI Documentation"
4962
runs-on: github-ubuntu-latest-s
63+
needs: [install_deps]
5064
permissions:
5165
id-token: write
5266
contents: read
@@ -63,6 +77,7 @@ jobs:
6377
coverage:
6478
name: "Coverage report generation"
6579
runs-on: github-ubuntu-latest-s
80+
needs: [install_deps]
6681
permissions:
6782
id-token: write
6883
contents: write
@@ -106,6 +121,7 @@ jobs:
106121
qa:
107122
name: "Test Python ${{ matrix.python-version }}"
108123
runs-on: github-ubuntu-latest-s
124+
needs: [install_deps]
109125
permissions:
110126
id-token: write
111127
contents: write
@@ -121,6 +137,7 @@ jobs:
121137
qa-windows:
122138
name: "Test Windows"
123139
runs-on: github-windows-latest-s
140+
needs: [install_deps]
124141
permissions:
125142
id-token: write
126143
contents: write

0 commit comments

Comments
 (0)