| 1 |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 |
|
| 4 |
name: Python package |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
branches: [ main ] |
| 9 |
pull_request: |
| 10 |
branches: [ main ] |
| 11 |
|
| 12 |
defaults: |
| 13 |
run: |
| 14 |
shell: bash -eux {0} |
| 15 |
|
| 16 |
jobs: |
| 17 |
build: |
| 18 |
|
| 19 |
runs-on: ubuntu-latest |
| 20 |
strategy: |
| 21 |
matrix: |
| 22 |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] |
| 23 |
fail-fast: false |
| 24 |
|
| 25 |
steps: |
| 26 |
- uses: actions/checkout@v2 |
| 27 |
- name: Set up Python ${{ matrix.python-version }} |
| 28 |
uses: actions/setup-python@v2 |
| 29 |
with: |
| 30 |
python-version: ${{ matrix.python-version }} |
| 31 |
- name: Install dependencies |
| 32 |
run: | |
| 33 |
python -m pip install --upgrade pip check-manifest |
| 34 |
pip install pytest-cov |
| 35 |
pip install ".[test]" |
| 36 |
python -m ipykernel.kernelspec --user |
| 37 |
- name: Test with pytest |
| 38 |
run: | |
| 39 |
pytest --cov jupyter_console || pytest jupyter_console --lf |
| 40 |
|
| 41 |
lint: |
| 42 |
runs-on: ubuntu-latest |
| 43 |
steps: |
| 44 |
- uses: actions/checkout@v2 |
| 45 |
- uses: actions/setup-python@v2 |
| 46 |
- name: Linting |
| 47 |
run: | |
| 48 |
pip install Flake8-pyproject mypy |
| 49 |
mypy jupyter_console |
| 50 |
flake8 jupyter_console |
| 51 |
|
| 52 |
check_release: |
| 53 |
runs-on: ubuntu-latest |
| 54 |
steps: |
| 55 |
- uses: actions/checkout@v3 |
| 56 |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 57 |
- uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 |
| 58 |
with: |
| 59 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 60 |
|
| 61 |
check_links: |
| 62 |
runs-on: ubuntu-latest |
| 63 |
steps: |
| 64 |
- uses: actions/checkout@v3 |
| 65 |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 66 |
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 |
| 67 |
|
| 68 |
test_minimum_versions: |
| 69 |
name: Test Minimum Versions |
| 70 |
runs-on: ubuntu-latest |
| 71 |
timeout-minutes: 10 |
| 72 |
steps: |
| 73 |
- uses: actions/checkout@v3 |
| 74 |
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 |
| 75 |
with: |
| 76 |
dependency_type: minimum |
| 77 |
- name: Run the unit tests |
| 78 |
run: | |
| 79 |
pip install ".[test]" |
| 80 |
pytest || pytest --lf |
| 81 |
|
| 82 |
tests_check: # This job does nothing and is only used for the branch protection |
| 83 |
if: always() |
| 84 |
needs: |
| 85 |
- build |
| 86 |
- lint |
| 87 |
- check_release |
| 88 |
- check_links |
| 89 |
- test_minimum_versions |
| 90 |
runs-on: ubuntu-latest |
| 91 |
steps: |
| 92 |
- name: Decide whether the needed jobs succeeded or failed |
| 93 |
uses: re-actors/alls-green@release/v1 |
| 94 |
with: |
| 95 |
jobs: ${{ toJSON(needs) }} |