Check and test transferwee #531
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
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 |