-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (47 loc) · 2.34 KB
/
python-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This file will define what the workflow consists of, that is what operations we want to perform and when. The first
# part names the action, the second states when the action is triggered (on push or on pull request) and on what
# branches (main and dev in our case).
name: Unittests
on:
push:
branches: [ main, dev ] # run when anything is pushed to these branches
pull_request:
branches: [ main, dev ] # run for the code submitted as a PR to these branches
# jobs are a series of steps which run commands in the chosen virtualized environment to perform some action
jobs:
build:
runs-on: ubuntu-latest # run in Ubuntu VM, so assuming a Unix-like environment for our commands
steps:
# first step checks out the code into
- uses: actions/checkout@v2
# Setup Python using a existing action "actions/setup-python@v2" from Github's library of actions
# Arguments are provided to this action using the key-values under "with"
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
# Install the requirements for this library plus those for running out tests (flake8 and coverage)
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 coverage
pip install -e .
pip list
# Run flake8 to do basic code quality checks, the output will appear in the action log
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=121 --statistics
# Run the unit tests using the coverage program and create the XML output file
- name: Test with unittest
run: |
./runtests.sh --coverage
# Using Codecov's action, upload the coverage report for the triggering commit/PR
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml