Skip to content

Commit

Permalink
Change the poetry env within the poetry install step
Browse files Browse the repository at this point in the history
Each step runs in its own process in GitHub Actions so environment changes
are not preserved between steps. I may need to add this to the
`poetry run ...` commands as well. I hope it's unnecessary. Apparently
Poetry has some "well-known" issues with correctly detecting the
desired Python version. See:

* Poetry issue: python-poetry/poetry#655
* setup-python workaround: actions/setup-python#374 (comment)
  • Loading branch information
ian-noaa committed Oct 14, 2022
1 parent d79b1a6 commit 940d49b
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/api.yaml
Expand Up @@ -32,12 +32,11 @@ jobs:
python-version: '3.9'
cache: 'poetry'
cache-dependency-path: 'services/api/poetry.lock'
- name: Force Poetry to the correct Python version
working-directory: services/api
run: poetry env use 3.9
- name: Install dependencies
working-directory: services/api
run: poetry install
run: |
poetry env use 3.9
poetry install
- name: Lint with Black
working-directory: services/api
run: poetry run black --check .
Expand All @@ -55,12 +54,11 @@ jobs:
python-version: '3.9'
cache: 'poetry'
cache-dependency-path: 'services/api/poetry.lock'
- name: Force Poetry to the correct Python version
working-directory: services/api
run: poetry env use 3.9
- name: Install dependencies
working-directory: services/api
run: poetry install
run: |
poetry env use 3.9
poetry install
- name: Check Types with mypy
working-directory: services/api
run: poetry run mypy src/
Expand All @@ -75,12 +73,11 @@ jobs:
python-version: '3.9'
cache: 'poetry'
cache-dependency-path: 'services/api/poetry.lock'
- name: Force Poetry to the correct Python version
working-directory: services/api
run: poetry env use 3.9
- name: Install dependencies
working-directory: services/api
run: poetry install
run: |
poetry env use 3.9
poetry install
- name: Test
working-directory: services/api
run: poetry run pytest
Expand Down

0 comments on commit 940d49b

Please sign in to comment.