Use Poetry #357
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: unit-tests | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- main | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
id: set-up-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Load cached Poetry installation | |
id: cached_poetry_install | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-1 # increment to reset cache | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached virtual env | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.set-up-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
shell: bash | |
if: steps.cached_poetry_install.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-ansi | |
- name: Cache River datasets | |
uses: actions/cache@v3 | |
with: | |
path: ~/river_data | |
key: ${{ runner.os }} | |
- name: Cache scikit-learn datasets | |
uses: actions/cache@v3 | |
with: | |
path: ~/scikit_learn_data | |
key: ${{ runner.os }} | |
# - name: Download datasets | |
# run: | | |
# poetry run python -c "from river import datasets; datasets.CreditCard().download(); datasets.Elec2().download(); datasets.SMSSpam().download()" | |
# poetry run python -c "from river import bandit; bandit.datasets.NewsArticles().download()" | |
- name: pytest [Branch] | |
if: github.event_name == 'pull_request' | |
run: | | |
poetry run pytest river/linear_model/lin_reg.py --durations=10 -n logical # Run pytest on all logical CPU cores | |
- name: pytest [Main] | |
if: github.event_name == 'push' | |
run: | | |
poetry run pytest -m "not datasets" --durations=10 -n logical # Run pytest on all logical CPU cores |