Files
the-littlest-jupyterhub/.github/workflows/unit-test.yaml
2021-10-19 14:42:36 +02:00

75 lines
2.0 KiB
YAML

# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
name: Unit tests
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/unit-test.yaml"
push:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/unit-test.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
workflow_dispatch:
jobs:
unit-tests:
name: ${{ matrix.name }}
runs-on: ubuntu-${{ matrix.ubuntu_version }}
container: ubuntu:${{ matrix.ubuntu_version }}
strategy:
fail-fast: false
matrix:
include:
- name: "Unit tests: Ubuntu 18.04, Py 3.6"
ubuntu_version: 18.04
python_version: 3.6
- name: "Unit tests: Ubuntu 20.04, Py 3.9"
ubuntu_version: 20.04
python_version: 3.9
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Install venv, git and setup venv
run: |
apt-get update --yes && apt-get install --yes python3-venv git
python3 -m venv /srv/venv
echo '/srv/venv/bin' >> $GITHUB_PATH
- name: Cache pip deps
uses: actions/cache@v2
with:
path: /srv/venv/
key: pip-${{ matrix.ubuntu_version }}-${{ matrix.python_version }}-${{ hashFiles('*setup.py', '*dev-requirements.txt') }}
- name: Install Python dependencies
run: |
python3 -m pip install -U pip==20.0.*
python3 -m pip install -r dev-requirements.txt
python3 -m pip install -e .
pip freeze
- name: Run unit tests
run: |
pytest --verbose --maxfail=2 --color=yes --cov=tljh tests/
- name: Upload code coverage stats
run: |
codecov