Skip to content

Commit

Permalink
update merge workflow to use cache
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisbader committed Nov 3, 2024
1 parent 1774468 commit 79807f1
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,33 @@ jobs:
with:
python-version: '3.9'

- name: "3. Setup Pip"
# only restore cache but do not upload
- name: "3. Restore cached python environment"
uses: actions/cache/restore@v4
id: pythonenv-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }}

- name: "(No-Cache) Setup Pip"
if: steps.pythonenv-cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
- name: "4. Install Dependencies"
run: |
pip install -r requirements/dev-all.txt
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "5. Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "5. Install Locally"
- name: "6. Install Locally"
run: |
pip install .
# TODO: why is this a matrix? there is no pip caching, and we restart this for each item in the matrix
- name: "6. Run example ${{matrix.example-name}}"
- name: "7. Run example ${{matrix.example-name}}"
working-directory: ./examples
run: |
papermill ${{matrix.example-name}} ${{matrix.example-name}}
Expand All @@ -118,12 +131,13 @@ jobs:
with:
python-version: '3.9'

- name: "3. Cache python environment"
uses: actions/cache@v4
# only restore cache but do not upload
- name: "3. Restore cached python environment"
uses: actions/cache/restore@v4
id: pythonenv-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements/*.txt') }}

- name: "4. Install pandoc"
run: |
Expand All @@ -136,13 +150,17 @@ jobs:
- name: "5. Install Dependencies"
run: |
# install latest dependencies (potentially using cached files)
# install latest dependencies (potentially updating cached dependencies)
pip install -U -r requirements/dev-all.txt
- name: "6. Install Locally"
- name: "6. Install libomp (for LightGBM)"
run: |
./.github/scripts/libomp-${{ runner.os }}.sh
- name: "7. Install Locally"
run: |
pip install .
- name: "7. Build docs"
- name: "8. Build docs"
run: |
make --directory ./docs build-all-docs

0 comments on commit 79807f1

Please sign in to comment.