[pre-commit.ci] auto fixes from pre-commit.com hooks #347
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: Test | |
on: | |
push: | |
branches-ignore: | |
- dependabot/** | |
- deepsource-fix-** | |
- renovate/** | |
- weblate | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: | |
- '3.7' | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
requirements: [latest] | |
database: [postgresql] | |
include: | |
# Reduced testing for mysql | |
- python-version: 3.7 | |
requirements: minimal | |
database: mysql | |
- python-version: 3.9 | |
requirements: latest | |
database: mysql | |
# Reduced testing for mariadb | |
- python-version: 3.7 | |
requirements: minimal | |
database: mariadb | |
- python-version: 3.9 | |
requirements: latest | |
database: mariadb | |
# Reduced testing for minimal deps | |
- python-version: 3.7 | |
requirements: minimal | |
database: postgresql | |
# Reduced testing for edge deps | |
- python-version: 3.9 | |
requirements: edge | |
database: postgresql | |
name: py${{ matrix.python-version }}, ${{ matrix.database }}, ${{ matrix.requirements }} deps | |
env: | |
CI_DATABASE: ${{ matrix.database }} | |
CI_REDIS_HOST: 127.0.0.1 | |
CI_REDIS_PORT: '60001' | |
CI_DB_PASSWORD: weblate | |
CI_DB_HOST: 127.0.0.1 | |
CI_DB_PORT: '60000' | |
CI_SELENIUM: '1' | |
DJANGO_SETTINGS_MODULE: weblate.settings_test | |
PYTHONWARNINGS: default,ignore:unclosed:ResourceWarning | |
PYTHONUNBUFFERED: 1 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Start services | |
run: ./ci/services-up ${{ matrix.database }} | |
- name: Cache pip | |
uses: actions/[email protected] | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} | |
- name: Install apt dependencies | |
run: sudo ./ci/apt-install $CI_DATABASE | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Used versions | |
run: ./ci/print-versions | |
- name: Install pip dependencies | |
run: ./ci/pip-install ${{ matrix.requirements }} | |
- name: Prepare database | |
run: ./ci/prepare-database | |
- name: Compile MO files | |
run: coverage run ./manage.py compilemessages | |
- name: Collect static files | |
run: coverage run ./manage.py collectstatic --noinput --verbosity 0 | |
- name: Migrate database | |
run: coverage run ./manage.py migrate --noinput --traceback | |
- name: Django checks | |
run: coverage run ./manage.py check | |
- name: Test with Django | |
run: coverage run ./manage.py test -v2 | |
- name: Test wsgi startup | |
env: | |
PYTHONPATH: . | |
run: coverage run weblate/wsgi.py | |
- name: Coverage | |
run: | | |
coverage combine | |
coverage xml | |
- uses: codecov/[email protected] | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
flags: unittests | |
name: Tests py${{ matrix.python-version }}, ${{ matrix.database }}, ${{ matrix.requirements }} deps | |
- name: DeepSource | |
continue-on-error: true | |
env: | |
DEEPSOURCE_DSN: ${{secrets.DEEPSOURCE_DSN}} | |
run: | | |
curl https://deepsource.io/cli | sh | |
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml | |
- uses: actions/[email protected] | |
if: always() | |
with: | |
name: Screenshots | |
path: test-images | |
- name: Stop services | |
if: always() | |
run: ./ci/services-down ${{ matrix.database }} |