-
Notifications
You must be signed in to change notification settings - Fork 9
93 lines (80 loc) · 2.74 KB
/
ci.yml
File metadata and controls
93 lines (80 loc) · 2.74 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- master
- 'release/**'
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9'] # todo: 3.10 should be enabled after mysql migration
defaults:
run:
shell: bash
steps:
- name: Checkout
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v2
- name: Checkout PR
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install libsqlcipher-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "ENCRYPTED=False" >> $GITHUB_ENV
fi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest-cov
if [ -f requirements.txt ]; then
pip install -r requirements.txt;
fi
if [ "$RUNNER_OS" == "Linux" ]; then
pip install pysqlcipher3==1.2.0;
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 pytest with coverage
env:
BOT_OWNER: ${{ secrets.BOT_OWNER }}
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
GMAIL_EMAIL: ${{ secrets.GMAIL_EMAIL }}
GMAIL_PASSWORD: ${{ secrets.GMAIL_PASSWORD }}
TWITCH_SECRET: ${{ secrets.TWITCH_SECRET }}
TWITCH_TOKEN: ${{ secrets.TWITCH_TOKEN }}
run: |
pytest --cov=./ --cov-report=xml tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt
verbose: true