-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(tests): Use poetry cache action #316
Conversation
Codecov Report
@@ Coverage Diff @@
## master #316 +/- ##
=======================================
Coverage 86.80% 86.80%
=======================================
Files 15 15
Lines 879 879
=======================================
Hits 763 763
Misses 116 116 Continue to review full report at Codecov.
|
3a68636
to
03c77b1
Compare
{{ env.poetry_virtualenvs_path }} | ||
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update (as of actions/setup-python):
When I do this, I've found I had to run poetry env ${{ matrix.python-version }}
before poetry install
or else it'd use the default python version:
name: tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
curl -O -sSL https://install.python-poetry.org/install-poetry.py
python install-poetry.py -y --version 1.1.12
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
rm install-poetry.py
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
# This is required to do as of @actions/checkout@v3 to prevent default action python (3.8) from being used
poetry env use ${{ matrix.python-version }}
poetry install
- name: Lint with flake8
run: poetry run flake8
- name: Print python versions
run: |
python -V
poetry run python -V
- name: Test with pytest
run: poetry run py.test
This was originally added in #316 but retracted due to actions/setup-python#374. In recent versions this python version issue has apparently been fixed.
Potential bug (as of actions/setup-python v3.1):
Filed a report here: actions/setup-python#374, reproduction: https://github.com/tony/setup-python-poetry-version-example
The workaround for now is to use
poetry env use <python-version>
beforepoetry install
Original message
As of yesterday,
@actions/setup-python@v3
supports this via v3.1.0: Release, Tag, actions/setup-python#281See also: python-poetry/poetry#4205