Skip to content

Commit

Permalink
ci/docs: wheels from cache (Lightning-AI#17201)
Browse files Browse the repository at this point in the history
* ci: wheel from cache

* ci: wheel from cache

* rev
  • Loading branch information
Borda authored Mar 27, 2023
1 parent be69880 commit 1284292
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 33 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-examples-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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"

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-tests-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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"

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci-tests-fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -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"

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-tests-pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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: |
Expand All @@ -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"

Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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]
Expand Down

0 comments on commit 1284292

Please sign in to comment.