Skip to content

Commit

Permalink
[MNT] Add dependency caching (#197)
Browse files Browse the repository at this point in the history
* Add dependency caching

* correct env ref

* trigger build

* poetry run

* ad python version to cache key

* trigger build

* add os to cache key

* trigger build
  • Loading branch information
lmmentel authored Oct 20, 2024
1 parent 6efc606 commit 1d45e18
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Test and build mendeleev package

env:
POETRY_VERSION: 1.8.2

on:
push:
branches: [master]
Expand All @@ -24,24 +27,35 @@ jobs:

steps:
- uses: actions/checkout@v4

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

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: ./.venv
key: pydeps-${{ matrix.os }}-python${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: poetry install --with vis --no-interaction -v

- name: Lint and format with ruff
uses: pre-commit/action@v3.0.1

- name: Test with pytest
run: |
source $VENV
pytest
run: poetry run pytest

deploy:
needs: test
Expand Down

0 comments on commit 1d45e18

Please # to comment.