Skip to content

Commit 3115e5e

Browse files
committed
chore: update CI workflows to enhance Poetry integration
- Added the Poetry binary path to the environment in multiple steps to ensure accessibility during the CI process. - Implemented a verification step for the Poetry installation to confirm successful setup. - Modified dependency installation and test execution commands to dynamically reference the Poetry binary, improving robustness in different environments. These changes aim to streamline the CI workflow and ensure consistent behavior across different runs.
1 parent 439a7d2 commit 3115e5e

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

.github/workflows/ci_prepare.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
installer-parallel: true
2828

2929
- name: Add Poetry to PATH
30-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
30+
run: |
31+
echo "$HOME/.local/bin" >> $GITHUB_PATH
32+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
3133
3234
- name: Load cached Poetry dependencies
3335
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
@@ -74,7 +76,9 @@ jobs:
7476
installer-parallel: true
7577

7678
- name: Add Poetry to PATH
77-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
79+
run: |
80+
echo "$HOME/.local/bin" >> $GITHUB_PATH
81+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
7882
7983
- name: Load cached Poetry dependencies
8084
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
@@ -118,13 +122,20 @@ jobs:
118122

119123
- name: Install Poetry
120124
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1
125+
id: poetry
121126
with:
122127
version: latest
123128
virtualenvs-create: true
124129
installer-parallel: true
125130

126131
- name: Add Poetry to PATH
127-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
132+
run: |
133+
echo "$HOME/.local/bin" >> $GITHUB_PATH
134+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
135+
136+
- name: Verify Poetry installation
137+
run: |
138+
poetry --version || $HOME/.local/bin/poetry --version || $HOME/.poetry/bin/poetry --version
128139
129140
- name: Load cached Poetry dependencies
130141
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
@@ -137,16 +148,25 @@ jobs:
137148
138149
- name: Install dependencies
139150
run: |
140-
poetry install --with test --no-root --no-interaction
151+
POETRY_BIN="$HOME/.local/bin/poetry"
152+
if [ ! -f "$POETRY_BIN" ]; then
153+
POETRY_BIN="poetry"
154+
fi
155+
"$POETRY_BIN" install --with test --no-root --no-interaction
156+
shell: bash
157+
env:
158+
PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin
141159

142160
- name: Run tests with coverage
143161
run: |
144-
poetry run pytest tests/ \
145-
--cov=temporal_boost \
146-
--cov-report=xml \
147-
--cov-report=term \
148-
--cov-report=html \
149-
-v
162+
POETRY_BIN="$HOME/.local/bin/poetry"
163+
if [ ! -f "$POETRY_BIN" ]; then
164+
POETRY_BIN="poetry"
165+
fi
166+
"$POETRY_BIN" run pytest tests/ --cov=temporal_boost --cov-report=xml --cov-report=term --cov-report=html -v
167+
shell: bash
168+
env:
169+
PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin
150170

151171
- name: Upload coverage to Codecov
152172
if: matrix.python-version == '3.11'
@@ -185,7 +205,9 @@ jobs:
185205
installer-parallel: true
186206

187207
- name: Add Poetry to PATH
188-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
208+
run: |
209+
echo "$HOME/.local/bin" >> $GITHUB_PATH
210+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
189211
190212
- name: Load cached Poetry dependencies
191213
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4

0 commit comments

Comments
 (0)