-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: clean install & share pkg build #15986
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
99826e9
abstract pkg build
Borda 466ae1e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3438082
share
Borda ae2c9cc
ci
Borda c5df6c8
Merge branch 'master' into ci/install-pkg
Borda 4e3917f
syntax
Borda 61f2e31
copy
Borda 911be01
args
Borda e681732
docs
Borda 4e19d12
Merge branch 'master' into ci/install-pkg
Borda a3c4784
Merge branch 'master' into ci/install-pkg
Borda 8dcf666
Merge branch 'master' into ci/install-pkg
Borda 0ee1940
Checkgroup
carmocca a0032a9
Merge branch 'master' into ci/install-pkg
carmocca a5b4207
lines
Borda 98fa7a7
Merge branch 'master' into ci/install-pkg
Borda 0b393f6
typo
Borda a175a17
folders
Borda dbb3209
pip
Borda e6a6a0d
pkg file
Borda 17ddb72
dir
Borda 3e379f9
Merge branch 'master' into ci/install-pkg
Borda fd6963a
remake
Borda 31cbac7
whl 1st
Borda b1c10a8
skip
Borda 2f2c9a2
doctest
Borda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Building packages | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
artifact-name: | ||
description: 'Unique name for collecting artifacts' | ||
required: true | ||
type: string | ||
pkg-names: | ||
description: 'list package names to be build in json format' | ||
required: false | ||
type: string | ||
default: | | ||
["lightning", "app", "lite", "pytorch"] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
init: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: | | ||
mkdir dist && touch dist/.placeholder | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
path: dist | ||
|
||
|
||
build-packages: | ||
needs: init | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
max-parallel: 1 # run sequential to prevent download/upload collisions | ||
matrix: | ||
pkg-name: ${{ fromJSON(inputs.pkg-names) }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
path: pypi | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- 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-name }} | ||
nb-dirs: ${{ env.NB_DIRS }} | ||
|
||
- run: | | ||
mkdir pypi/${{ matrix.pkg-name }} | ||
cp dist/* pypi/${{ matrix.pkg-name }}/ | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
path: pypi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ on: | |
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/**" | ||
|
@@ -28,52 +31,71 @@ defaults: | |
|
||
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", "notset"] | ||
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 }} | ||
|
||
- name: DocTests actions | ||
working-directory: .actions/ | ||
run: | | ||
pip install -q pytest | ||
python -m pytest setup_tools.py | ||
|
||
- run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg-name }}' == 'pytorch' else 1))" >> $GITHUB_ENV | ||
|
||
- uses: ./.github/actions/pkg-check | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
pkg-name: ${{ matrix.pkg-name }} | ||
nb-dirs: ${{ env.NB_DIRS }} | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why move these directories? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so there is no accidental use of local version but importing the install version |
||
|
||
- 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': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning', 'notset': 'lightning'}['${{matrix.pkg-name}}'])") | ||
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/**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the source code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because I want to test the main package on all subset of our doctests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see for example: https://github.com/Lightning-AI/lightning/actions/runs/3681710895/jobs/6228712319