diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 03931e447c960..4128f721b8576 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -40,7 +40,7 @@ jobs: fail-fast: true max-parallel: 1 matrix: - pkg: ["lite"] + pkg-name: ["lite"] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -52,7 +52,7 @@ jobs: path: pypi - name: Build package env: - PACKAGE_NAME: ${{ matrix.pkg }} + PACKAGE_NAME: ${{ matrix.pkg-name }} run: | python setup.py sdist cp dist/* pypi/ @@ -68,7 +68,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-22.04, macOS-12, windows-2022] - pkg: ["app", "lite", "pytorch", ""] + pkg-name: ["app", "lite", "pytorch", ""] python-version: ["3.7" , "3.10"] steps: - uses: actions/checkout@v3 @@ -82,10 +82,10 @@ jobs: pip install pytest -q python -m pytest setup_tools.py - - run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg }}' == 'pytorch' else 1))" >> $GITHUB_ENV + - run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg-name }}' == 'pytorch' else 1))" >> $GITHUB_ENV - uses: ./.github/actions/pkg-check with: - pkg-name: ${{ matrix.pkg }} + pkg-name: ${{ matrix.pkg-name }} nb-dirs: ${{ env.NB_DIRS }} - uses: actions/download-artifact@v3 @@ -99,11 +99,11 @@ jobs: - name: Run CLI # todo: add testing for `lightning_app` - if: ${{ matrix.pkg == '' }} + if: ${{ matrix.pkg-name == '' }} run: python -m lightning --version - name: DocTest package run: | pip list - scope=$(python -c "lut = {'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning'} ; print(lut.get('${{matrix.pkg}}', 'lightning'))") + scope=$(python -c "lut = {'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning'} ; print(lut.get('${{matrix.pkg-name}}', 'lightning'))") python -m pytest src/${scope} --ignore-glob="**/cli/*-template/**" diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index c4f159442b105..2baada8f21ade 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -41,7 +41,7 @@ jobs: strategy: fail-fast: false matrix: - pkg: ["app", "pytorch"] # TODO: , "lit" + pkg-name: ["app", "pytorch"] # TODO: , "lit" env: FREEZE_REQUIREMENTS: "1" steps: @@ -62,9 +62,9 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-docs-test-${{ matrix.pkg }}-${{ hashFiles('requirements/${{ matrix.pkg }}/*.txt') }} + key: ${{ runner.os }}-docs-test-${{ matrix.pkg-name }}-${{ hashFiles('requirements/${{ matrix.pkg-name }}/*.txt') }} restore-keys: | - ${{ runner.os }}-docs-test-${{ matrix.pkg }}- + ${{ runner.os }}-docs-test-${{ matrix.pkg-name }}- - name: Install dependencies run: | @@ -74,25 +74,27 @@ jobs: - name: Install LAI package # This is needed as App docs is heavily using/referring to lightning package - if: ${{ matrix.pkg == 'app' }} + if: ${{ matrix.pkg-name== 'app' }} run: | pip install -e . -U --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --find-links pypi git checkout -- setup.py MANIFEST.in - - name: Adjust examples - if: ${{ matrix.pkg-name == 'lightning' }} - run: python .actions/assistant.py copy_replace_imports --source_dir="./src" --source_import="pytorch_lightning,lightning_lite" --target_import="lightning.pytorch,lightning.lite" + - name: Adjust docs refs + if: ${{ matrix.pkg-name == 'app' }} + run: | + pip install -q -r .actions/requirements.txt + python .actions/assistant.py copy_replace_imports --source_dir="./docs" --source_import="pytorch_lightning,lightning_lite" --target_import="lightning.pytorch,lightning.lite" - name: Install this package env: - PACKAGE_NAME: ${{ matrix.pkg }} + PACKAGE_NAME: ${{ matrix.pkg-name }} run: | - pip install -e .[extra,cloud,ui] -U -r requirements/${{ matrix.pkg }}/docs.txt --find-links pypi + pip install -e .[extra,cloud,ui] -U -r requirements/${{ matrix.pkg-name }}/docs.txt --find-links pypi - name: Test Documentation env: SPHINX_MOCK_REQUIREMENTS: 0 - working-directory: ./docs/source-${{ matrix.pkg }} + working-directory: ./docs/source-${{ matrix.pkg-name }} run: | make doctest make coverage @@ -103,7 +105,7 @@ jobs: strategy: fail-fast: false matrix: - pkg: ["app", "pytorch", "lit"] + pkg-name: ["app", "pytorch", "lit"] env: FREEZE_REQUIREMENTS: "1" steps: @@ -124,32 +126,32 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-docs-make-${{ matrix.pkg }}-${{ hashFiles('requirements/${{ matrix.pkg }}/*.txt') }} + key: ${{ runner.os }}-docs-make-${{ matrix.pkg-name }}-${{ hashFiles('requirements/${{ matrix.pkg-name }}/*.txt') }} restore-keys: | - ${{ runner.os }}-docs-make-${{ matrix.pkg }}- + ${{ runner.os }}-docs-make-${{ matrix.pkg-name }}- - name: Install package & dependencies env: - PACKAGE_NAME: ${{ matrix.pkg }} + PACKAGE_NAME: ${{ matrix.pkg-name }} run: | sudo apt-get update sudo apt-get install -y cmake pandoc texlive-latex-extra dvipng texlive-pictures pip --version - pip install -e . -r requirements/${{ matrix.pkg }}/docs.txt \ + pip install -e . -r requirements/${{ matrix.pkg-name }}/docs.txt \ --find-links https://download.pytorch.org/whl/cpu/torch_stable.html \ --find-links pypi pip list shell: bash - name: Make Documentation - working-directory: ./docs/source-${{ matrix.pkg }} + working-directory: ./docs/source-${{ matrix.pkg-name }} run: | make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going" - name: Upload built docs uses: actions/upload-artifact@v3 with: - name: docs-${{ matrix.pkg }}-${{ github.sha }} + name: docs-${{ matrix.pkg-name }}-${{ github.sha }} path: docs/build/html/ # Use always() to always run this step to publish test results when there are test failures if: success()