Skip to content
Snippets Groups Projects
tests.yml 5.19 KiB
name: continuous-integration

on:
  push:
    branches: [master]
    tags:
      - 'v*'
  pull_request:
  schedule:
    - cron:  '0 0 * * *'

jobs:

  pre-commit:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - uses: pre-commit/action@v2.0.0

  # for speed, we run a test matrix against only the tests that do not require TeX,
  # then test-with-cov for all tests, for a single environment

  test-with-cov:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.8]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install Python dependencies
      run: |
        python -m pip install --upgrade pip
        pip install wheel
        pip install -e .[testing]

    - name: Install Headless Chrome dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -yq $(cat .github/workflows/pyppeteer_reqs.txt)

    - name: Install latex dependencies
      run: |
        sudo apt-get -qq update
        sudo apt-get install -y   \
          texlive                 \
          texlive-xetex           \
          texlive-latex-extra     \
          texlive-fonts-extra     \
          fonts-freefont-otf      \
          latexmk                 \
          xindy

    - name: Run pytest
      run: |
        pytest --durations=10 --cov=jupyter_book --cov-report=xml --cov-report=term-missing
        coverage xml
      # for some reason the tests/conftest.py::check_nbs fixture breaks pytest-cov's cov-report outputting
      # this is why we run `coverage xml` afterwards (required by codecov)