-
-
Notifications
You must be signed in to change notification settings - Fork 964
126 lines (121 loc) · 3.77 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
118
119
120
121
122
123
124
125
126
name: Test
on:
push:
paths:
- 'weblate/**'
- '*.py'
- 'requirements*.txt'
- 'ci/*'
- '.github/workflows/test.yml'
pull_request:
paths:
- 'weblate/**'
- '*.py'
- 'requirements*.txt'
- 'ci/*'
- '.github/workflows/test.yml'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
requirements: ["latest", "minimal", "edge"]
database: ["postgresql", "mysql"]
exclude:
# Reduce testing for mysql
- python-version: 3.5
requirements: "minimal"
database: "mysql"
- python-version: 3.6
requirements: "minimal"
database: "mysql"
- python-version: 3.8
requirements: "minimal"
database: "mysql"
- python-version: 3.5
requirements: "latest"
database: "mysql"
- python-version: 3.6
requirements: "latest"
database: "mysql"
- python-version: 3.8
requirements: "latest"
database: "mysql"
# No working combination of psycopg2 and Django 2.2 on Python 3.8
- python-version: 3.8
requirements: "minimal"
database: "postgresql"
# Reduce amount of testing for edge
- python-version: 3.5
requirements: "edge"
database: "mysql"
- python-version: 3.6
requirements: "edge"
database: "mysql"
- python-version: 3.7
requirements: "edge"
database: "mysql"
- python-version: 3.8
requirements: "edge"
database: "mysql"
- python-version: 3.6
requirements: "edge"
database: "postgresql"
- python-version: 3.7
requirements: "edge"
database: "postgresql"
name: py${{ matrix.python-version }}, ${{ matrix.database }}, ${{ matrix.requirements }} deps
steps:
- uses: actions/checkout@v2
- name: Start services
run: ./ci/services-up ${{ matrix.database }}
- name: Cache pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install apt dependencies
run: sudo ./ci/apt-install
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install pip dependencies
run: ./ci/pip-install ${{ matrix.requirements }}
- name: Test with Django
env:
CI_DATABASE: ${{ matrix.database }}
CI_DB_PASSWORD: "weblate"
CI_DB_HOST: "127.0.0.1"
CI_DB_PORT: "60000"
CI_SELENIUM: "1"
DJANGO_SETTINGS_MODULE: "weblate.settings_test"
run: |
./ci/prepare-database
./ci/run-test
- name: Coverage
run: |
coverage combine
coverage xml
- uses: codecov/codecov-action@v1
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: https://c2c2d54f2be9498e94048d17dc8e3965@deepsource.io
run: |
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
- uses: actions/upload-artifact@v1
with:
name: Screenshots
path: test-images
- name: Stop services
if: always()
run: ./ci/services-down ${{ matrix.database }}