pyopenbook/.github/workflows/main.yml

79 lines
2.4 KiB
YAML

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [alpha, master]
pull_request:
branches: [alpha, master]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pipenv
uses: dschep/install-pipenv-action@v1
- name: Install CI dependencies
run: |
pipenv run install-ci-deps
- name: Run linters
run: |
pipenv run black --check --diff --line-length=120 setup.py pyserum tests
pipenv run pylint --rcfile=.pylintrc setup.py pyserum tests
pipenv run flake8 setup.py pyserum tests
pipenv run mypy pyserum
- name: Run unit tests
run: |
pipenv run pytest -v -m "not integration"
coverage:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pipenv
uses: dschep/install-pipenv-action@v1
- name: Generate coverage report
run: |
pipenv install --dev --skip-lock pytest pytest-cov
scripts/run_coverage.sh
- name: Upload coverage to Codecov
# You may pin to the exact commit or the version.
# uses: codecov/codecov-action@6004246f47ab62d32be025ce173b241cd84ac58e
uses: codecov/codecov-action@v1.0.13
with:
token: ${{ secrets.CODECOV_TOKEN }}
# Path to coverage file to upload
file: ./coverage.xml
env_vars: OS,PYTHON
# Specify whether or not CI build should fail if Codecov runs into an error during upload
fail_ci_if_error: true