Skip to content

Commit

Permalink
Avoid pip install in workflow if cache is hit (#592)
Browse files Browse the repository at this point in the history
* Avoid pip install if cache is hit

* Fix true literal

* Separate extras install

* Fix syntax error

* Fix logical error

* Fix syntax error
  • Loading branch information
stefsmeets authored May 30, 2023
1 parent 0155a5a commit d3b0aef
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions .github/actions/install-python-and-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ inputs:
default: "3.9"
extras-require:
required: false
description: "The extras dependencies packages to be installed, for instance 'dev' or 'dev,publishing,notebooks'."
default: "dev"
description: "The extras dependencies packages to be installed, for instance 'docs' or 'publishing,notebooks'."

runs:
using: "composite"
steps:
Expand All @@ -18,6 +18,7 @@ runs:
python-version: ${{ inputs.python-version }}

- uses: actions/cache@v3
id: cache-python-env
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
Expand All @@ -29,19 +30,27 @@ runs:
python3 --version
- name: Upgrade pip
if: steps.cache-python-env.outputs.cache-hit != 'true'
shell: bash {0}
run: |
python3 -m pip install --upgrade pip setuptools wheel
# only necessary on linux to avoid bloated installs
- name: Install tensorflow/pytorch cpu version
if: runner.os == 'Linux'
if: runner.os == 'Linux' && steps.cache-python-env.outputs.cache-hit != 'true'
shell: bash {0}
run: |
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python3 -m pip install tensorflow-cpu
- name: Upgrade pip
- name: Install DIANNA
if: steps.cache-python-env.outputs.cache-hit != 'true'
shell: bash {0}
run: |
python3 -m pip install -e .[dev]
- name: Install DIANNA extras
if: ${{ inputs.extras-require }}
shell: bash {0}
run: |
python3 -m pip install -e .[${{ inputs.extras-require }}]

0 comments on commit d3b0aef

Please sign in to comment.