From 1284292df0e2d4cc4511858950425ee9e527b86b Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Mon, 27 Mar 2023 16:40:44 +0200 Subject: [PATCH] ci/docs: wheels from cache (#17201) * ci: wheel from cache * ci: wheel from cache * rev --- .github/workflows/ci-examples-app.yml | 8 +++---- .github/workflows/ci-tests-app.yml | 12 +++++------ .github/workflows/ci-tests-fabric.yml | 14 ++++++------ .github/workflows/ci-tests-pytorch.yml | 12 +++++------ .github/workflows/docs-build.yml | 30 +++++++++++++++++--------- 5 files changed, 43 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci-examples-app.yml b/.github/workflows/ci-examples-app.yml index aca0e0d4f8970..76c930b093357 100644 --- a/.github/workflows/ci-examples-app.yml +++ b/.github/workflows/ci-examples-app.yml @@ -51,7 +51,7 @@ jobs: PACKAGE_NAME: ${{ matrix.pkg-name }} FREEZE_REQUIREMENTS: 1 TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" - PYPI_CACHE: "_pip-wheels" + PYPI_CACHE_DIR: "_pip-wheels" steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -69,20 +69,20 @@ jobs: - name: pip wheels cache uses: actions/cache/restore@v3 with: - path: ${{ env.PYPI_CACHE }} + path: ${{ env.PYPI_CACHE_DIR }} key: pypi_wheels - name: Install Lightning package & dependencies run: | # do not use `-e` because it will make both packages available since it adds `src` to `sys.path` automatically - pip install .[dev] -U -f ${TORCH_URL} -f ${PYPI_CACHE} --prefer-binary + pip install .[dev] -U -f ${TORCH_URL} -f ${PYPI_CACHE_DIR} --prefer-binary pip list - name: Dump handy wheels if: github.event_name == 'push' && github.ref == 'refs/heads/master' continue-on-error: true uses: ./.github/actions/pip-wheels with: - wheel-dir: ${{ env.PYPI_CACHE }} + wheel-dir: ${{ env.PYPI_CACHE_DIR }} torch-url: ${{ env.TORCH_URL }} cache-key: "pypi_wheels" diff --git a/.github/workflows/ci-tests-app.yml b/.github/workflows/ci-tests-app.yml index 3671d4c63b51f..c5b0f4aecb510 100644 --- a/.github/workflows/ci-tests-app.yml +++ b/.github/workflows/ci-tests-app.yml @@ -51,7 +51,7 @@ jobs: env: PACKAGE_NAME: ${{ matrix.pkg-name }} FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} - PYPI_CACHE: "_pip-wheels" + PYPI_CACHE_DIR: "_pip-wheels" steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -69,25 +69,25 @@ jobs: - name: pip wheels cache uses: actions/cache/restore@v3 with: - path: ${{ env.PYPI_CACHE }} + path: ${{ env.PYPI_CACHE_DIR }} key: pypi_wheels - run: | - mkdir -p $PYPI_CACHE - ls -lh $PYPI_CACHE + mkdir -p $PYPI_CACHE_DIR + ls -lh $PYPI_CACHE_DIR - name: Switch PyTorch URL run: python -c "print('TORCH_URL=https://download.pytorch.org/whl/' + str('test/cpu/torch_test.html' if '${{matrix.release}}' == 'pre' else 'cpu/torch_stable.html'))" >> $GITHUB_ENV - name: Install package & dependencies run: | - pip install -e .[dev] -U -f ${TORCH_URL} -f ${PYPI_CACHE} --prefer-binary + pip install -e .[dev] -U -f ${TORCH_URL} -f ${PYPI_CACHE_DIR} --prefer-binary pip list - name: Dump handy wheels if: github.event_name == 'push' && github.ref == 'refs/heads/master' continue-on-error: true uses: ./.github/actions/pip-wheels with: - wheel-dir: ${{ env.PYPI_CACHE }} + wheel-dir: ${{ env.PYPI_CACHE_DIR }} torch-url: ${{ env.TORCH_URL }} cache-key: "pypi_wheels" diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 59a0de9949482..93463278b81d7 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -63,7 +63,7 @@ jobs: env: PACKAGE_NAME: ${{ matrix.pkg-name }} FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} - PYPI_CACHE: "_pip-wheels" + PYPI_CACHE_DIR: "_pip-wheels" TORCH_URL_STABLE: "https://download.pytorch.org/whl/cpu/torch_stable.html" TORCH_URL_TEST: "https://download.pytorch.org/whl/test/cpu/torch_test.html" steps: @@ -92,11 +92,11 @@ jobs: - name: pip wheels cache uses: actions/cache/restore@v3 with: - path: ${{ env.PYPI_CACHE }} + path: ${{ env.PYPI_CACHE_DIR }} key: pypi_wheels - run: | - mkdir -p $PYPI_CACHE - ls -lh $PYPI_CACHE + mkdir -p $PYPI_CACHE_DIR + ls -lh $PYPI_CACHE_DIR - name: Env. variables run: | @@ -108,15 +108,15 @@ jobs: - name: Install package & dependencies run: | - pip install -e .[test] "pytest-timeout" -U -f ${TORCH_URL} ${TORCH_PREINSTALL} -f ${PYPI_CACHE} --prefer-binary - pip install -r requirements/fabric/strategies.txt -f ${PYPI_CACHE} --prefer-binary + pip install -e .[test] "pytest-timeout" -U -f ${TORCH_URL} ${TORCH_PREINSTALL} -f ${PYPI_CACHE_DIR} --prefer-binary + pip install -r requirements/fabric/strategies.txt -f ${PYPI_CACHE_DIR} --prefer-binary pip list - name: Dump handy wheels if: github.event_name == 'push' && github.ref == 'refs/heads/master' continue-on-error: true uses: ./.github/actions/pip-wheels with: - wheel-dir: ${{ env.PYPI_CACHE }} + wheel-dir: ${{ env.PYPI_CACHE_DIR }} torch-url: ${{ env.TORCH_URL }} cache-key: "pypi_wheels" diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 42b9ab49bcb3c..a76588accb3d0 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -69,7 +69,7 @@ jobs: TORCH_URL_STABLE: "https://download.pytorch.org/whl/cpu/torch_stable.html" TORCH_URL_TEST: "https://download.pytorch.org/whl/test/cpu/torch_test.html" FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} - PYPI_CACHE: "_pip-wheels" + PYPI_CACHE_DIR: "_pip-wheels" steps: - uses: actions/checkout@v3 @@ -99,11 +99,11 @@ jobs: - name: pip wheels cache uses: actions/cache/restore@v3 with: - path: ${{ env.PYPI_CACHE }} + path: ${{ env.PYPI_CACHE_DIR }} key: pypi_wheels - run: | - mkdir -p $PYPI_CACHE - ls -lh $PYPI_CACHE + mkdir -p $PYPI_CACHE_DIR + ls -lh $PYPI_CACHE_DIR - name: Env. variables run: | @@ -118,14 +118,14 @@ jobs: pip install -q pip -U pip install .[extra,test] -U \ "pytest-timeout" -r requirements/_integrations/accelerators.txt \ - -f ${TORCH_URL} ${TORCH_PREINSTALL} -f ${PYPI_CACHE} --prefer-binary + -f ${TORCH_URL} ${TORCH_PREINSTALL} -f ${PYPI_CACHE_DIR} --prefer-binary pip list - name: Dump handy wheels if: github.event_name == 'push' && github.ref == 'refs/heads/master' continue-on-error: true uses: ./.github/actions/pip-wheels with: - wheel-dir: ${{ env.PYPI_CACHE }} + wheel-dir: ${{ env.PYPI_CACHE_DIR }} torch-url: ${{ env.TORCH_URL }} cache-key: "pypi_wheels" diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index e9bff8bc19fd7..7d31cb9433b83 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -31,7 +31,7 @@ defaults: env: FREEZE_REQUIREMENTS: "1" TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" - PYPI_CACHE: "_pip-wheels" + PYPI_CACHE_DIR: "_pip-wheels" jobs: make-doctest: @@ -61,15 +61,16 @@ jobs: - name: pip wheels cache uses: actions/cache/restore@v3 with: - path: ${{ env.PYPI_CACHE }} + path: ${{ env.PYPI_CACHE_DIR }} key: pypi_wheels - - name: Install package + - name: Install package & dependencies run: | - ls -lh $PYPI_CACHE - mkdir -p pypi_pkgs + mkdir -p $PYPI_CACHE_DIR # in case cache was not hit + ls -lh $PYPI_CACHE_DIR + mkdir -p pypi_pkgs # in case template is not pulled pip install .[extra,cloud,ui] -U -r requirements/${{ matrix.pkg-name }}/docs.txt \ - -f pypi_pkgs/ -f $PYPI_CACHE -f ${TORCH_URL} + -f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL} pip list - name: Test Documentation @@ -108,16 +109,17 @@ jobs: - name: pip wheels cache uses: actions/cache/restore@v3 with: - path: ${{ env.PYPI_CACHE }} + path: ${{ env.PYPI_CACHE_DIR }} key: pypi_wheels - name: Install package & dependencies run: | - ls -lh $PYPI_CACHE - mkdir -p pypi_pkgs + mkdir -p $PYPI_CACHE_DIR # in case cache was not hit + ls -lh $PYPI_CACHE_DIR + mkdir -p pypi_pkgs # in case template is not pulled pip --version pip install . -U -r requirements/${{ matrix.pkg-name }}/docs.txt \ - -f pypi_pkgs/ -f $PYPI_CACHE -f ${TORCH_URL} + -f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL} pip list shell: bash @@ -141,6 +143,14 @@ jobs: path: docs/build/html/ retention-days: ${{ steps.keep-artifact.outputs.DAYS }} + - name: Dump handy wheels + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + continue-on-error: true + uses: ./.github/actions/pip-wheels + with: + wheel-dir: ${{ env.PYPI_CACHE_DIR }} + torch-url: ${{ env.TORCH_URL }} + cache-key: "pypi_wheels" deploy-docs: needs: [make-doctest, make-html]