diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 4cabc9e42..9beb4a1ea 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -108,11 +108,26 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Get pip cache dir + id: pip-cache + run: | + python -m pip install --upgrade pip wheel + echo "::set-output name=dir::$(pip cache dir)" + + - name: pip cache + uses: actions/cache@v2 + id: cache + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-py${{ matrix.python-version }}-mpi-${{ matrix.enable-mpi }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: ${{ runner.os }}-py${{ matrix.python-version }}-mpi-${{ matrix.enable-mpi }}-pip- + - name: Install Python dependencies - run: pip install autograd h5py jax jaxlib matplotlib numpy parameterized pytest scipy + if: steps.cache.outputs.cache-hit != 'true' + run: pip install -r python/requirements.txt - name: Install mpi4py - if: matrix.enable-mpi + if: ${{ matrix.enable-mpi && steps.cache.outputs.cache-hit != true }} run: pip install mpi4py - name: Run autoreconf diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 000000000..772aac158 --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1,9 @@ +autograd +h5py +jax +jaxlib +matplotlib +numpy +parameterized +pytest +scipy