From 79807f128c38de74a24db8dfd9a433cd23c13adb Mon Sep 17 00:00:00 2001 From: dennisbader Date: Sun, 3 Nov 2024 11:38:43 +0100 Subject: [PATCH] update merge workflow to use cache --- .github/workflows/merge.yml | 40 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 6d0a9ba2d2..58db19465a 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -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}} @@ -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: | @@ -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