Skip to content

Commit 5d638cf

Browse files
authored
ci: fix & unify pkg name (#15470)
1 parent 56132d9 commit 5d638cf

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

.github/workflows/ci-pkg-install.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
fail-fast: true
4141
max-parallel: 1
4242
matrix:
43-
pkg: ["lite"]
43+
pkg-name: ["lite"]
4444
steps:
4545
- uses: actions/checkout@v3
4646
- uses: actions/setup-python@v4
@@ -52,7 +52,7 @@ jobs:
5252
path: pypi
5353
- name: Build package
5454
env:
55-
PACKAGE_NAME: ${{ matrix.pkg }}
55+
PACKAGE_NAME: ${{ matrix.pkg-name }}
5656
run: |
5757
python setup.py sdist
5858
cp dist/* pypi/
@@ -68,7 +68,7 @@ jobs:
6868
fail-fast: false
6969
matrix:
7070
os: [ubuntu-22.04, macOS-12, windows-2022]
71-
pkg: ["app", "lite", "pytorch", ""]
71+
pkg-name: ["app", "lite", "pytorch", ""]
7272
python-version: ["3.7" , "3.10"]
7373
steps:
7474
- uses: actions/checkout@v3
@@ -82,10 +82,10 @@ jobs:
8282
pip install pytest -q
8383
python -m pytest setup_tools.py
8484
85-
- run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg }}' == 'pytorch' else 1))" >> $GITHUB_ENV
85+
- run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg-name }}' == 'pytorch' else 1))" >> $GITHUB_ENV
8686
- uses: ./.github/actions/pkg-check
8787
with:
88-
pkg-name: ${{ matrix.pkg }}
88+
pkg-name: ${{ matrix.pkg-name }}
8989
nb-dirs: ${{ env.NB_DIRS }}
9090

9191
- uses: actions/download-artifact@v3
@@ -99,11 +99,11 @@ jobs:
9999

100100
- name: Run CLI
101101
# todo: add testing for `lightning_app`
102-
if: ${{ matrix.pkg == '' }}
102+
if: ${{ matrix.pkg-name == '' }}
103103
run: python -m lightning --version
104104

105105
- name: DocTest package
106106
run: |
107107
pip list
108-
scope=$(python -c "lut = {'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning'} ; print(lut.get('${{matrix.pkg}}', 'lightning'))")
108+
scope=$(python -c "lut = {'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning'} ; print(lut.get('${{matrix.pkg-name}}', 'lightning'))")
109109
python -m pytest src/${scope} --ignore-glob="**/cli/*-template/**"

.github/workflows/docs-checks.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
strategy:
4949
fail-fast: false
5050
matrix:
51-
pkg: ["app", "pytorch"] # TODO: , "lit"
51+
pkg-name: ["app", "pytorch"] # TODO: , "lit"
5252
env:
5353
FREEZE_REQUIREMENTS: "1"
5454
steps:
@@ -69,9 +69,9 @@ jobs:
6969
uses: actions/cache@v3
7070
with:
7171
path: ~/.cache/pip
72-
key: ${{ runner.os }}-docs-test-${{ matrix.pkg }}-${{ hashFiles('requirements/${{ matrix.pkg }}/*.txt') }}
72+
key: ${{ runner.os }}-docs-test-${{ matrix.pkg-name }}-${{ hashFiles('requirements/${{ matrix.pkg-name }}/*.txt') }}
7373
restore-keys: |
74-
${{ runner.os }}-docs-test-${{ matrix.pkg }}-
74+
${{ runner.os }}-docs-test-${{ matrix.pkg-name }}-
7575
7676
- name: Install dependencies
7777
run: |
@@ -81,25 +81,27 @@ jobs:
8181
8282
- name: Install LAI package
8383
# This is needed as App docs is heavily using/referring to lightning package
84-
if: ${{ matrix.pkg == 'app' }}
84+
if: ${{ matrix.pkg-name== 'app' }}
8585
run: |
8686
pip install -e . -U --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --find-links pypi
8787
git checkout -- setup.py MANIFEST.in
8888
89-
- name: Adjust examples
90-
if: ${{ matrix.pkg-name == 'lightning' }}
91-
run: python .actions/assistant.py copy_replace_imports --source_dir="./src" --source_import="pytorch_lightning,lightning_lite" --target_import="lightning.pytorch,lightning.lite"
89+
- name: Adjust docs refs
90+
if: ${{ matrix.pkg-name == 'app' }}
91+
run: |
92+
pip install -q -r .actions/requirements.txt
93+
python .actions/assistant.py copy_replace_imports --source_dir="./docs" --source_import="pytorch_lightning,lightning_lite" --target_import="lightning.pytorch,lightning.lite"
9294
9395
- name: Install this package
9496
env:
95-
PACKAGE_NAME: ${{ matrix.pkg }}
97+
PACKAGE_NAME: ${{ matrix.pkg-name }}
9698
run: |
97-
pip install -e .[extra,cloud,ui] -U -r requirements/${{ matrix.pkg }}/docs.txt --find-links pypi
99+
pip install -e .[extra,cloud,ui] -U -r requirements/${{ matrix.pkg-name }}/docs.txt --find-links pypi
98100
99101
- name: Test Documentation
100102
env:
101103
SPHINX_MOCK_REQUIREMENTS: 0
102-
working-directory: ./docs/source-${{ matrix.pkg }}
104+
working-directory: ./docs/source-${{ matrix.pkg-name }}
103105
run: |
104106
make doctest
105107
make coverage
@@ -110,7 +112,7 @@ jobs:
110112
strategy:
111113
fail-fast: false
112114
matrix:
113-
pkg: ["app", "pytorch", "lit"]
115+
pkg-name: ["app", "pytorch", "lit"]
114116
env:
115117
FREEZE_REQUIREMENTS: "1"
116118
steps:
@@ -131,32 +133,32 @@ jobs:
131133
uses: actions/cache@v3
132134
with:
133135
path: ~/.cache/pip
134-
key: ${{ runner.os }}-docs-make-${{ matrix.pkg }}-${{ hashFiles('requirements/${{ matrix.pkg }}/*.txt') }}
136+
key: ${{ runner.os }}-docs-make-${{ matrix.pkg-name }}-${{ hashFiles('requirements/${{ matrix.pkg-name }}/*.txt') }}
135137
restore-keys: |
136-
${{ runner.os }}-docs-make-${{ matrix.pkg }}-
138+
${{ runner.os }}-docs-make-${{ matrix.pkg-name }}-
137139
138140
- name: Install package & dependencies
139141
env:
140-
PACKAGE_NAME: ${{ matrix.pkg }}
142+
PACKAGE_NAME: ${{ matrix.pkg-name }}
141143
run: |
142144
sudo apt-get update
143145
sudo apt-get install -y cmake pandoc texlive-latex-extra dvipng texlive-pictures
144146
pip --version
145-
pip install -e . -r requirements/${{ matrix.pkg }}/docs.txt \
147+
pip install -e . -r requirements/${{ matrix.pkg-name }}/docs.txt \
146148
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html \
147149
--find-links pypi
148150
pip list
149151
shell: bash
150152

151153
- name: Make Documentation
152-
working-directory: ./docs/source-${{ matrix.pkg }}
154+
working-directory: ./docs/source-${{ matrix.pkg-name }}
153155
run: |
154156
make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
155157
156158
- name: Upload built docs
157159
uses: actions/upload-artifact@v3
158160
with:
159-
name: docs-${{ matrix.pkg }}-${{ github.sha }}
161+
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
160162
path: docs/build/html/
161163
# Use always() to always run this step to publish test results when there are test failures
162164
if: success()

0 commit comments

Comments
 (0)