-
Notifications
You must be signed in to change notification settings - Fork 38
76 lines (74 loc) · 2.19 KB
/
python.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Check and test transferwee
'on':
push:
branches:
- master
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
build:
name: Check and test transferwee
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ['3.8', '3.10', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.version }}
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding
# requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
pip install flake8
pip install mypy
pip install requests
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --select=E9,F63,F7,F82 --show-source
# exit-zero treats all errors as warnings.
flake8 . --exit-zero --max-complexity=10
- name: Check code style via Black
run: |
black --check .
- name: Static type checking via mypy
run: |
mypy --non-interactive --install-types .
mypy --strict --disable-error-code no-any-return .
- name: Test transferwee
shell: bash
env:
PYTHONDEVMODE: 1
PYTHONTRACEMALLOC: 1
run: |
sleep_time=1
factor=2
cd tests
until ./check.sh ; do
e=$?
if [ "${sleep_time}" -gt 64 ]; then
echo "Tried too much times"
exit $e
fi
echo "Tests failed with exit code ${e}"
echo "Retrying in ${sleep_time}"
sleep ${sleep_time}
sleep_time=$((sleep_time * factor))
done