55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
name: Install and validate the package
|
|
description: Install and validate the package
|
|
|
|
inputs:
|
|
pkg-folder:
|
|
description: Define folder with packages
|
|
required: true
|
|
pkg-name:
|
|
description: Package name to import
|
|
required: true
|
|
pkg-extra:
|
|
description: argument for install extra
|
|
required: false
|
|
default: ""
|
|
pip-flags:
|
|
description: Additional pip install flags
|
|
required: false
|
|
default: ""
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Choose package import
|
|
working-directory: ${{ inputs.pkg-folder }}
|
|
run: |
|
|
import os, glob
|
|
|
|
lut = {'app': 'lightning_app', 'fabric': 'lightning_fabric', 'pytorch': 'pytorch_lightning'}
|
|
act_pkg = lut.get('${{inputs.pkg-name}}', 'lightning')
|
|
pkg_sdist = glob.glob('*.tar.gz')[0]
|
|
pkg_wheel = glob.glob('*.whl')[0]
|
|
extra = '${{inputs.pkg-extra}}'
|
|
extra = f'[{extra}]' if extra else ''
|
|
|
|
envs = [f'PKG_IMPORT={act_pkg}', f'PKG_SOURCE={pkg_sdist}', f'PKG_WHEEL={pkg_wheel}', f'PKG_EXTRA={extra}']
|
|
with open(os.getenv('GITHUB_ENV'), "a") as gh_env:
|
|
gh_env.write(os.linesep.join(envs))
|
|
shell: python
|
|
|
|
- name: Install package - wheel
|
|
working-directory: ${{ inputs.pkg-folder }}
|
|
run: |
|
|
pip install "${PKG_WHEEL}${PKG_EXTRA}" ${{ inputs.pip-flags }}
|
|
pip list | grep lightning
|
|
python -c "import ${{ env.PKG_IMPORT }}; print(${{ env.PKG_IMPORT }}.__version__)"
|
|
shell: bash
|
|
|
|
- name: Install package - archive
|
|
working-directory: ${{ inputs.pkg-folder }}
|
|
run: |
|
|
pip install "${PKG_SOURCE}${PKG_EXTRA}" ${{ inputs.pip-flags }}
|
|
pip list | grep lightning
|
|
python -c "import ${{ env.PKG_IMPORT }}; print(${{ env.PKG_IMPORT }}.__version__)"
|
|
shell: bash
|