.github/workflows/build.yml
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Python
uses: actions/setup-python@v2.2.2
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: 3.9 # optional, default is 3.x
# The target architecture (x86, x64) of the Python interpreter.
architecture: x64 # optional
# Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user.
token: ${{ github.token }} # optional, default is ${{ github.token }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 coverage
pip install colorama
pip install numpy
pip install orjson
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- 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=127 --statistics
- name: Test with Unittest
run: |
python setup.py install
coverage run tests.py
coverage xml -o testresult.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./testresult.xml
directory: ./
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt
verbose: true