Skip to content

Commit

Permalink
Modify test action
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiara Rasi committed Jan 29, 2025
1 parent 7b27000 commit 1bc3a4f
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/test_n_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,45 @@ on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9' ]
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
curl -O -sSL https://install.python-poetry.org/install-poetry.py
python install-poetry.py -y
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
rm install-poetry.py
- name: Check out git repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
python-version: '3.9'

# install & configure poetry
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

# load cached venv if cache exists
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction

- name: Print python versions
run: |
python -V
poetry run python -V
- name: Install project
run: poetry install --no-interaction

- name: Test with pytest
run: poetry run pytest --cov=./ --cov-report=xml

Expand Down

0 comments on commit 1bc3a4f

Please sign in to comment.