73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
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/workflows/ci-pkg-install.yml"
|
|
- "setup.py"
|
|
- "src/**"
|
|
- "requirements/**"
|
|
- "!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:
|
|
|
|
install-pkg:
|
|
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"]
|
|
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 pytest -q
|
|
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
|
|
with:
|
|
pkg-name: ${{ matrix.pkg-name }}
|
|
nb-dirs: ${{ env.NB_DIRS }}
|
|
|
|
- uses: ./.github/actions/pkg-install
|
|
with:
|
|
pkg-name: ${{ matrix.pkg-name }}
|
|
|
|
- name: Run CLI
|
|
# todo: add testing for `lightning_app`
|
|
if: ${{ matrix.pkg-name == 'lightning' }}
|
|
run: python -m lightning --version
|
|
|
|
- name: DocTest package
|
|
env:
|
|
PY_IGNORE_IMPORTMISMATCH: 1
|
|
run: |
|
|
PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])")
|
|
python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**"
|