9
9
types : [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
10
10
paths :
11
11
- " .actions/**"
12
+ - " .github/actions/pkg-check/*"
13
+ - " .github/actions/pkg-install/*"
14
+ - " .github/workflows/_build-packages.yml"
12
15
- " .github/workflows/ci-pkg-install.yml"
13
16
- " setup.py"
14
17
- " src/**"
@@ -28,52 +31,71 @@ defaults:
28
31
29
32
jobs :
30
33
34
+ build-packages :
35
+ uses : ./.github/workflows/_build-packages.yml
36
+ with :
37
+ artifact-name : dist-packages-${{ github.sha }}
38
+
31
39
install-pkg :
40
+ needs : build-packages
32
41
runs-on : ${{ matrix.os }}
33
42
strategy :
34
43
fail-fast : false
35
44
matrix :
36
45
os : [ubuntu-22.04, macOS-12, windows-2022]
37
46
pkg-name : ["app", "lite", "pytorch", "lightning", "notset"]
38
47
python-version : ["3.7" , "3.10"]
48
+ # TODO: add also install from source
39
49
steps :
40
50
- uses : actions/checkout@v3
41
-
42
51
- uses : actions/setup-python@v4
43
52
with :
44
53
python-version : ${{ matrix.python-version }}
45
-
46
- - name : DocTests actions
47
- working-directory : .actions/
48
- run : |
49
- pip install -q pytest
50
- python -m pytest setup_tools.py
51
-
52
- - run : python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg-name }}' == 'pytorch' else 1))" >> $GITHUB_ENV
53
-
54
- - uses : ./.github/actions/pkg-check
54
+ - uses : actions/download-artifact@v3
55
55
with :
56
- pkg- name : ${{ matrix.pkg-name }}
57
- nb-dirs : ${{ env.NB_DIRS }}
56
+ name : dist-packages- ${{ github.sha }}
57
+ path : dist
58
58
59
+ - run : |
60
+ python -c "print('PKG_DIR=' + {'notset': 'lightning'}.get('${{matrix.pkg-name}}', '${{matrix.pkg-name}}'))" >> $GITHUB_ENV
59
61
- uses : ./.github/actions/pkg-install
60
62
with :
63
+ pkg-folder : dist/${{ env.PKG_DIR }}
61
64
pkg-name : ${{ matrix.pkg-name }}
62
65
63
66
- name : Run CLI (via python)
64
67
if : ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'notset' }}
65
68
run : python -m lightning --version
66
-
67
69
- name : Run CLI (direct bash)
68
70
if : ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'app' }}
69
71
run : lightning --version
70
72
73
+ - name : Adjust code for Lit
74
+ if : ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'notset' }}
75
+ run : |
76
+ pip install -q -r .actions/requirements.txt
77
+ python .actions/assistant.py copy_replace_imports --source_dir="./src" \
78
+ --source_import="pytorch_lightning,lightning_lite,lightning_app" \
79
+ --target_import="lightning.pytorch,lightning.lite,lightning.app"
80
+ rm -rf src/lightning
81
+ - name : Rename src folders
82
+ working-directory : src/
83
+ run : |
84
+ mv pytorch_lightning pl
85
+ mv lightning_lite lit_lite
86
+ mv lightning_app lit_app
87
+
88
+ - name : DocTests actions
89
+ working-directory : .actions/
90
+ run : |
91
+ pip install -q pytest
92
+ python -m pytest setup_tools.py
71
93
- name : DocTest package
72
94
env :
73
95
LIGHTING_TESTING : 1 # path for require wrapper
74
96
PY_IGNORE_IMPORTMISMATCH : 1
75
97
run : |
76
98
pip install -q "pytest-doctestplus>=0.9.0"
77
99
pip list
78
- PKG_NAME=$(python -c "print({'app': 'lightning_app ', 'lite': 'lightning_lite ', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning', 'notset': 'lightning'}[ '${{matrix.pkg-name}}'] )")
100
+ PKG_NAME=$(python -c "print({'app': 'lit_app ', 'lite': 'lit_lite ', 'pytorch': 'pl'}.get( '${{matrix.pkg-name}}', '') )")
79
101
python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**"
0 commit comments