Skip to content

Commit 9f95217

Browse files
authored
Use setup-poetry-env (#197)
I created new GitHub actions for cleanup some setup Poetry steps. This change simplifies the setup of poetry.
1 parent fc44250 commit 9f95217

File tree

4 files changed

+29
-91
lines changed

4 files changed

+29
-91
lines changed

.github/workflows/code-checks.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: Setup Poetry
15-
run: |
16-
pipx install poetry
17-
poetry config virtualenvs.in-project true
18-
- uses: actions/setup-python@v4
14+
- uses: 5yutan5/[email protected]
1915
with:
2016
python-version: '3.11'
21-
cache: 'poetry'
22-
- run: poetry install --only dev
17+
poetry-install--only: dev
18+
poetry-install--no-root: 'true'
19+
poetry-virtualenvs-in-project: 'true'
2320
# Hack to make pre-commit/action to use virtual env pre-commit.
2421
# pre-commit/action installs pre-commit using following command:
2522
# `python -m pip install pre-commit`
@@ -36,19 +33,12 @@ jobs:
3633
runs-on: ubuntu-latest
3734
steps:
3835
- uses: actions/checkout@v3
39-
- name: Setup Poetry
40-
run: |
41-
pipx install poetry
42-
poetry config virtualenvs.in-project true
43-
- uses: actions/setup-python@v4
36+
- uses: 5yutan5/[email protected]
4437
with:
4538
python-version: '3.11'
46-
cache: 'poetry'
47-
- name: Install dependencies for pyright
48-
run: |
49-
poetry install --only main,test
50-
poetry run pip install PyQt6
51-
- run: poetry run pip list
39+
poetry-install--only: main,test
40+
poetry-virtualenvs-in-project: 'true'
41+
- run: poetry run pip install PyQt6
5242
# Pyright uses dependencies of the interpreter run with the `python`.
5343
# But `python` doesn't run virtual env interpreter when PATH is default.
5444
# Override PATH to use virtual env interpreter.

.github/workflows/test.yml

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,13 @@ jobs:
5050

5151
steps:
5252
- uses: actions/checkout@v3
53-
- name: Setup Poetry
54-
run: |
55-
pipx install poetry
56-
poetry config virtualenvs.in-project true
57-
- uses: actions/setup-python@v4
58-
id: setup-python
53+
- uses: 5yutan5/[email protected]
5954
with:
6055
python-version: ${{ matrix.py }}
56+
additional-dependency-cache-key: ${{ matrix.qt }}
57+
poetry-install--only: github-actions,test,main
6158

62-
- name: Cache ./.venv (poetry dependencies)
63-
id: cache-venv
64-
uses: actions/cache@v3
65-
with:
66-
path: .venv
67-
key: "\
68-
venv-\
69-
${{ runner.os }}-\
70-
${{ steps.setup-python.outputs.python-version }}-\
71-
${{ matrix.qt }}-\
72-
${{ hashFiles('**/poetry.lock') }}"
73-
74-
- name: Install dependencies
75-
if: steps.cache-venv.outputs.cache-hit != 'true'
76-
run: poetry install --only github-actions,test,main
77-
78-
- name: Install Qt dependencies
79-
run: poetry run pip install -U ${{ matrix.qt }}
59+
- run: poetry run pip install -U ${{ matrix.qt }}
8060

8161
- name: Install Linux dependencies
8262
if: runner.os == 'Linux'
@@ -133,28 +113,10 @@ jobs:
133113

134114
steps:
135115
- uses: actions/checkout@v3
136-
- name: Setup Poetry
137-
run: |
138-
pipx install poetry
139-
poetry config virtualenvs.in-project true
140-
- uses: actions/setup-python@v4
141-
id: setup-python
116+
- uses: 5yutan5/[email protected]
142117
with:
143118
python-version: '3.11'
144-
145-
- name: Cache ./.venv (poetry dependencies)
146-
id: cache-venv
147-
uses: actions/cache@v3
148-
with:
149-
path: .venv
150-
key: "\
151-
venv-without-qt\
152-
${{ runner.os }}-\
153-
${{ steps.setup-python.outputs.python-version }}-\
154-
${{ hashFiles('**/poetry.lock') }}"
155-
156-
- run: poetry install --only github-actions,test,main
157-
if: steps.cache-venv.outputs.cache-hit != 'true'
119+
poetry-install--only: 'github-actions,test,main'
158120

159121
- name: Run pytest without Qt lib
160122
run: |
@@ -180,25 +142,13 @@ jobs:
180142
runs-on: ubuntu-latest
181143
steps:
182144
- uses: actions/checkout@v3
183-
- uses: actions/setup-python@v4
184-
id: setup-python
145+
- uses: 5yutan5/[email protected]
185146
with:
186147
python-version: '3.11'
148+
poetry-install--only: main
149+
additional-dependency-cache-key: PyInstaller
187150

188-
- name: Cache ./.venv (poetry dependencies)
189-
id: cache-venv
190-
uses: actions/cache@v3
191-
with:
192-
path: .venv
193-
key: "\
194-
venv-test-PyInstaller-\
195-
${{ steps.setup-python.outputs.python-version }}"
196-
197-
- run: python -m venv .venv
198-
if: steps.cache-venv.outputs.cache-hit != 'true'
199-
200-
- name: Install Python dependencies
201-
run: .venv/bin/python -m pip install -U . PyInstaller
151+
- run: poetry run pip install -U PyInstaller
202152

203153
- name: Make test file
204154
run: |
@@ -217,7 +167,7 @@ jobs:
217167
218168
- name: Build test app
219169
run: |
220-
.venv/bin/python -m PyInstaller -y --onefile \
170+
poetry run python -m PyInstaller -y --onefile \
221171
${{ env.TEST_FILE_NAME }} \
222172
--name test_app \
223173
--distpath ./dist

.github/workflows/update-icon.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- run: pipx install poetry
15-
- uses: actions/setup-python@v4
14+
- uses: 5yutan5/[email protected]
1615
with:
17-
python-version: "3.11"
18-
cache: 'poetry'
19-
- run: poetry install --only main
16+
python-version: '3.11'
17+
poetry-install--only: main
2018
- name: Download latest svg and update style
2119
run: |
2220
poetry run python -c \

poetry.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)