forked from Lightning-AI/pytorch-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
57 lines (48 loc) · 1.47 KB
/
action.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
name: Create and check package
description: building, checking the package
inputs:
pkg-name:
description: package name inside lightning.*
required: true
nb-dirs:
description: nb of packages in the wrap/distribution
required: false
default: "1"
runs:
using: "composite"
steps:
- name: install dev. env
run: pip install "twine==4.0.1" setuptools wheel flake8
shell: bash
- name: Set PACKAGE_NAME envvar
if: ${{ inputs.pkg-name != 'notset' }}
run: echo "PACKAGE_NAME=${{ inputs.pkg-name }}" >> $GITHUB_ENV
shell: bash
- name: Source check
run: python setup.py check --metadata --strict
shell: bash
- name: Create package
run: python setup.py sdist bdist_wheel
shell: bash
- name: Check package
run: |
git diff --exit-code || exit $? # make sure there are no local unstaged changes
ls -l dist/
twine check dist/*
shell: bash
- name: Unzip packages
working-directory: dist
run: for file in `ls *.gz`; do tar -xzf $file; done
shell: bash
- name: Check single pkg/folder
working-directory: dist
run: |
import os, glob, pathlib, shutil
# list folders without ending .egg-info
ls = glob.glob(os.path.join("*", "src", "*"))
dirs = [d for d in ls if os.path.isdir(d) and not d.endswith(".egg-info")]
print(dirs)
assert len(dirs) == ${{ inputs.nb-dirs }}
# cleaning
shutil.rmtree(pathlib.Path(dirs[0]).parent.parent)
shell: python