-
Notifications
You must be signed in to change notification settings - Fork 3.3k
101 lines (91 loc) · 3.41 KB
/
ci-pkg-install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Package
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- ".actions/**"
- ".github/actions/pkg-check/*"
- ".github/actions/pkg-install/*"
- ".github/workflows/_build-packages.yml"
- ".github/workflows/ci-pkg-install.yml"
- "setup.py"
- "src/**"
- "requirements/**"
- "!requirements/docs.txt"
- "!requirements/*/docs.txt"
- "!*.md"
- "!**/*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
defaults:
run:
shell: bash
jobs:
build-packages:
uses: ./.github/workflows/_build-packages.yml
with:
artifact-name: dist-packages-${{ github.sha }}
install-pkg:
needs: build-packages
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macOS-12, windows-2022]
pkg-name: ["app", "lite", "pytorch", "lightning"]
python-version: ["3.7" , "3.10"]
# TODO: add also install from source
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: dist-packages-${{ github.sha }}
path: dist
- run: |
python -c "print('PKG_DIR=' + {'notset': 'lightning'}.get('${{matrix.pkg-name}}', '${{matrix.pkg-name}}'))" >> $GITHUB_ENV
- uses: ./.github/actions/pkg-install
with:
pkg-folder: dist/${{ env.PKG_DIR }}
pkg-name: ${{ matrix.pkg-name }}
- name: Run CLI (via python)
if: ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'notset' }}
run: python -m lightning --version
- name: Run CLI (direct bash)
if: ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'app' }}
run: lightning --version
- name: Adjust code for Lit
if: ${{ matrix.pkg-name == 'lightning' || matrix.pkg-name == 'notset' }}
run: |
pip install -q -r .actions/requirements.txt
python .actions/assistant.py copy_replace_imports --source_dir="./src" \
--source_import="pytorch_lightning,lightning_lite,lightning_app" \
--target_import="lightning.pytorch,lightning.lite,lightning.app"
rm -rf src/lightning
- name: Rename src folders
working-directory: src/
run: |
mv pytorch_lightning pl
mv lightning_lite lit_lite
mv lightning_app lit_app
- name: DocTests actions
working-directory: .actions/
run: |
pip install -q pytest
python -m pytest setup_tools.py
- name: DocTest package
env:
LIGHTING_TESTING: 1 # path for require wrapper
PY_IGNORE_IMPORTMISMATCH: 1
run: |
pip install -q "pytest-doctestplus>=0.9.0"
pip list
PKG_NAME=$(python -c "print({'app': 'lit_app', 'lite': 'lit_lite', 'pytorch': 'pl'}.get('${{matrix.pkg-name}}', ''))")
python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**"