-
-
Notifications
You must be signed in to change notification settings - Fork 991
117 lines (113 loc) · 3.49 KB
/
test.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: Test
on:
push:
branches-ignore:
- deepsource-fix-**
- renovate/**
- weblate
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
requirements: [latest]
database: [postgresql]
experimental: [false]
include:
# Reduced testing for mysql
- python-version: 3.11
requirements: latest
database: mysql
experimental: false
# Reduced testing for mariadb
- python-version: 3.11
requirements: latest
database: mariadb
experimental: false
# Reduced testing for minimal deps
- python-version: '3.10'
requirements: minimal
database: postgresql
experimental: false
# Reduced testing for edge deps
- python-version: 3.11
requirements: edge
database: postgresql
experimental: true
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@v4
- name: Start services
run: ./ci/services-up ${{ matrix.database }}
- name: Install apt dependencies
run: sudo ./ci/apt-install $CI_DATABASE
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Used versions
run: ./ci/print-versions
- name: Install Python 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: Demo import
run: coverage run ./manage.py import_demo
- 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/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
flags: unittests
name: Tests py${{ matrix.python-version }}, ${{ matrix.database }}, ${{ matrix.requirements }} deps
- name: DeepSource
uses: deepsourcelabs/test-coverage-action@v1.1.2
if: ${{ github.event_name == 'push' }}
with:
key: python
coverage-file: coverage.xml
dsn: ${{ secrets.DEEPSOURCE_DSN }}
- name: Stop services
if: always()
run: ./ci/services-down ${{ matrix.database }}