-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #49
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
- 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 |