From f300daf0afe43617a52c607b6ed8d555dd214efd Mon Sep 17 00:00:00 2001 From: AnotherSamWilson Date: Sat, 27 Jul 2024 09:03:36 -0400 Subject: [PATCH] Use poetry in github workflows instead of pip. --- .github/workflows/run_tests.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index d882dc1..c08e010 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -21,12 +21,30 @@ jobs: with: python-version: ${{ matrix.python-version }} + # install & configure poetry + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + 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@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + # install dependencies if cache does not exist - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest mypy codecov pytest-cov pandas - pip install plotnine matplotlib scipy scikit-learn - pip install lightgbm pyarrow black isort dill + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + + # install root project + - name: Install project + run: poetry install --no-interaction --with dev - name: MyPy Checks run: mypy miceforest --ignore-missing-imports