move no deps higher, make download not occur if cache was hit
@@ -89,39 +89,21 @@ jobs:
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
+# Set up pip
+
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install -U pip # to ensure version > 20 to have cache dir
echo "::set-output name=dir::$(pip cache dir)"
+
- name: Pip Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ matrix.task }}-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}
- - name: Install poetry
- run: |
- pip install poetry
-
- - name: Configure poetry
- run: |
- poetry config virtualenvs.in-project true
-
- - name: Poetry Cache
- uses: actions/cache@v2
- id: cache
- with:
- path: .venv
- key: venv-${{ matrix.task }}-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
-
- - name: Ensure cache is healthy
- if: steps.cache.outputs.cache-hit == 'true'
- shell: bash
- run: |
- poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
-
-# No dependencies
+# No import and run CLI with no dependencies
- name: Build wheel and install core dependencies
if: matrix.task == 'tests'
@@ -145,6 +127,29 @@ jobs:
pymedphys --help
python -c "import pymedphys"
+# Set up Poetry
+
+ - name: Install poetry
+ run: |
+ pip install poetry
+
+ - name: Configure poetry
+ run: |
+ poetry config virtualenvs.in-project true
+
+ - name: Poetry Cache
+ uses: actions/cache@v2
+ id: poetry-cache
+ with:
+ path: .venv
+ key: venv-${{ matrix.task }}-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
+
+ - name: Ensure cache is healthy
+ if: steps.poetry-cache.outputs.cache-hit == 'true'
+ shell: bash
+ run: |
+ poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
+
# System installs
- name: Install FreeTDS on MacOS
@@ -201,20 +206,19 @@ jobs:
# Download all data for consistent cache
- name: Get PyMedPhys cache directory
- if: matrix.task != 'clean'
- id: pymedphys-cache
+ id: pymedphys-cache-location
run: |
echo "::set-output name=dir::$(poetry run python -c 'import pymedphys._config as cf; print(str(cf.get_config_dir()))')"
- name: PyMedPhys Cache
- if: matrix.task != 'clean'
+ id: pymedphys-cache
uses: actions/cache@v2
with:
- path: ${{ steps.pymedphys-cache.outputs.dir }}
+ path: ${{ steps.pymedphys-cache-location.outputs.dir }}
key: pymedphys-${{ hashFiles('**/hashes.json') }}
- name: Download all PyMedPhys data for a consistent cache
- if: matrix.task != 'clean'
+ if: steps.pymedphys-cache.outputs.cache-hit != 'true'
run: |
poetry run python -c "from pymedphys._data import download; download.download_all()"
