Skip to content

Commit ec3fb3b

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

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,22 @@ jobs:
2929
artifactory-deployer-role: qa-deployer
3030
deploy-pull-request: true
3131

32+
install_deps:
33+
name: "Install Dependencies"
34+
id: install
35+
runs-on: github-ubuntu-latest-s
36+
permissions:
37+
id-token: write
38+
contents: write
39+
steps:
40+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
41+
- uses: ./.github/actions/config-poetry
42+
- run: |
43+
poetry install
44+
3245
formatting:
3346
name: "Formatting"
47+
needs: [install]
3448
runs-on: github-ubuntu-latest-s
3549
permissions:
3650
id-token: write
@@ -47,6 +61,7 @@ jobs:
4761
documentation:
4862
name: "CLI Documentation"
4963
runs-on: github-ubuntu-latest-s
64+
needs: [install]
5065
permissions:
5166
id-token: write
5267
contents: read
@@ -63,6 +78,7 @@ jobs:
6378
coverage:
6479
name: "Coverage report generation"
6580
runs-on: github-ubuntu-latest-s
81+
needs: [install]
6682
permissions:
6783
id-token: write
6884
contents: write
@@ -106,6 +122,7 @@ jobs:
106122
qa:
107123
name: "Test Python ${{ matrix.python-version }}"
108124
runs-on: github-ubuntu-latest-s
125+
needs: [install]
109126
permissions:
110127
id-token: write
111128
contents: write
@@ -121,6 +138,7 @@ jobs:
121138
qa-windows:
122139
name: "Test Windows"
123140
runs-on: github-windows-latest-s
141+
needs: [install]
124142
permissions:
125143
id-token: write
126144
contents: write

0 commit comments

Comments
 (0)