Skip to content

Commit f373130

Browse files
committed
refac: streamline Python environment setup and testing workflow
1 parent 2c028a0 commit f373130

File tree

4 files changed

+7
-38
lines changed

4 files changed

+7
-38
lines changed

.github/actions/setup-python-poetry/action.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,24 @@ runs:
4141
- name: Set virtual environment path
4242
id: venv-path
4343
shell: bash
44-
env:
45-
VENV: .venv/bin/activate
4644
run: |
47-
echo "venv-path=.venv" >> "$GITHUB_OUTPUT"
48-
echo "venv-activate=.venv/bin/activate" >> "$GITHUB_OUTPUT"
45+
echo "venv-path=$(poetry env info -p)" >> "$GITHUB_OUTPUT"
46+
echo "venv-activate=$(poetry env info -p)/bin/activate" >> "$GITHUB_OUTPUT"
4947
5048
- name: Cache virtual environment
5149
id: cache-venv
5250
uses: actions/cache@v3
53-
if: steps.venv-path.outputs.venv-path != ''
5451
with:
55-
path: .venv
52+
path: ${{ steps.venv-path.outputs.venv-path }}
5653
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-venv-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
5754
restore-keys: |
5855
${{ inputs.cache-key-prefix }}-${{ runner.os }}-venv-${{ inputs.python-version }}-
5956
6057
- name: Install dependencies
6158
if: steps.cache-venv.outputs.cache-hit != 'true'
6259
shell: bash
63-
env:
64-
PYTHON_VERSION: ${{ inputs.python-version }}
6560
run: |
66-
python -m pip install --upgrade pip
67-
python -m pip install poetry
68-
poetry config virtualenvs.in-project true
69-
poetry install --no-interaction --with dev
61+
poetry install --no-interaction --no-root --with dev
7062
7163
- name: Sanity check
7264
shell: bash

.github/workflows/python-unittests.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,11 @@ jobs:
1919
id: extract_repo_name
2020
run: echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
2121

22-
- name: Activate virtual environment
23-
run: |
24-
source .venv/bin/activate
25-
python -m pip install --upgrade pip
26-
python -m pip install pytest pytest-cov exceptiongroup
27-
2822
- name: Run tests
2923
env:
3024
REPO_NAME: ${{ env.REPO_NAME }}
31-
PYTHONPATH: ${{ github.workspace }}
3225
run: |
33-
source .venv/bin/activate
34-
python -m pytest --cov-branch --cov-report=xml --cov=${{ env.REPO_NAME }}
26+
poetry run pytest --cov-branch --cov-report=xml --cov=${{ env.REPO_NAME }}
3527
ls -lah
3628
3729
- name: Upload coverage reports to Codecov

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
"Operating System :: OS Independent",
2323
]
2424
urls = { "Homepage" = "https://github.com/arthur-debert/dotcat" }
25-
dependencies = ["pyyaml>=6.0.2", "exceptiongroup>=1.1.0"]
25+
dependencies = ["pyyaml>=6.0.2"]
2626

2727
[project.optional-dependencies]
2828
dev = [

0 commit comments

Comments
 (0)