Skip to content

Commit 2c028a0

Browse files
committed
feat: update Python environment setup and add exceptiongroup dependency
1 parent 4e2ff72 commit 2c028a0

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,32 @@ runs:
4141
- name: Set virtual environment path
4242
id: venv-path
4343
shell: bash
44+
env:
45+
VENV: .venv/bin/activate
4446
run: |
45-
echo "venv-path=$(poetry env info -p)" >> "$GITHUB_OUTPUT"
46-
echo "venv-activate=$(poetry env info -p)/bin/activate" >> "$GITHUB_OUTPUT"
47+
echo "venv-path=.venv" >> "$GITHUB_OUTPUT"
48+
echo "venv-activate=.venv/bin/activate" >> "$GITHUB_OUTPUT"
4749
4850
- name: Cache virtual environment
4951
id: cache-venv
5052
uses: actions/cache@v3
53+
if: steps.venv-path.outputs.venv-path != ''
5154
with:
52-
path: ${{ steps.venv-path.outputs.venv-path }}
55+
path: .venv
5356
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-venv-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
5457
restore-keys: |
5558
${{ inputs.cache-key-prefix }}-${{ runner.os }}-venv-${{ inputs.python-version }}-
5659
5760
- name: Install dependencies
5861
if: steps.cache-venv.outputs.cache-hit != 'true'
5962
shell: bash
63+
env:
64+
PYTHON_VERSION: ${{ inputs.python-version }}
6065
run: |
61-
poetry install --no-interaction --no-root -E dev
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
6270
6371
- name: Sanity check
6472
shell: bash

.github/workflows/python-unittests.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,26 @@ jobs:
1212
- name: Setup Python environment
1313
uses: ./.github/actions/setup-python-poetry
1414
with:
15-
python-version: '3.9'
16-
cache-key-prefix: 'test-env'
15+
python-version: "3.11"
16+
cache-key-prefix: "test-env"
1717

1818
- name: Extract repo name
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+
2228
- name: Run tests
2329
env:
2430
REPO_NAME: ${{ env.REPO_NAME }}
31+
PYTHONPATH: ${{ github.workspace }}
2532
run: |
26-
poetry run pytest --cov-branch --cov-report=xml --cov=${{ env.REPO_NAME }}
33+
source .venv/bin/activate
34+
python -m pytest --cov-branch --cov-report=xml --cov=${{ env.REPO_NAME }}
2735
ls -lah
2836
2937
- name: Upload coverage reports to Codecov

poetry.lock

Lines changed: 16 additions & 1 deletion
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"]
25+
dependencies = ["pyyaml>=6.0.2", "exceptiongroup>=1.1.0"]
2626

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

0 commit comments

Comments
 (0)