-
Notifications
You must be signed in to change notification settings - Fork 93
125 lines (106 loc) · 4 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
name: Test
on: [push, pull_request]
env:
FORCE_COLOR: 1
jobs:
prebuild_xapian_wheel:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
xapian-version: ['1.4.19']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Checkout xapian-haystack
uses: actions/checkout@v2
- name: Check for cached xapian wheel
# https://github.com/actions/cache#cache-limits
# says this cached wheel will be evicted after a week unused.
id: xapian-cache
uses: actions/cache@v2
with:
path: xapian*.whl
key: xapian-${{ matrix.xapian-version }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('xapian_wheel_builder.sh') }}
- name: Build xapian wheel
if: steps.xapian-cache.outputs.cache-hit != 'true'
run: |
./xapian_wheel_builder.sh ${{ matrix.xapian-version }}
test:
needs: prebuild_xapian_wheel
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
django-version: ['3.2', '4.0', '4.1']
xapian-version: ['1.4.19']
filelock-version: ['3.4.2']
exclude:
# Django dropped python 3.7 support in 4.0
- python-version: '3.7'
django-version: '4.0'
- python-version: '3.7'
django-version: '4.1'
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Checkout xapian-haystack
uses: actions/checkout@v2
- name: Check for cached xapian wheel
# This will always succeed since the previous job just ran.
id: xapian-cache
uses: actions/cache@v2
with:
path: xapian*.whl
key: xapian-${{ matrix.xapian-version }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('xapian_wheel_builder.sh') }}
- name: Install Django and other Python dependencies
run: |
python -m pip install --upgrade pip
pip install django~=${{ matrix.django-version }} filelock~=${{ matrix.filelock-version }} coveralls xapian*.whl
- name: Checkout django-haystack
uses: actions/checkout@v2
with:
repository: 'django-haystack/django-haystack'
path: django-haystack
- name: Copy some test files to django-haystack
run: |
cp xapian_backend.py django-haystack/haystack/backends/
cp -r tests/* django-haystack/test_haystack/
cp tests/xapian_tests/__init__.py django-haystack/test_haystack/
cp .coveragerc django-haystack/
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=/usr/lib/python3/dist-packages:." >> $GITHUB_ENV
- name: Ensure all apps have migrations
run: |
cd django-haystack
django-admin makemigrations --settings=test_haystack.xapian_settings
- name: Running tests
run: |
cd django-haystack
coverage run $(command -v django-admin) test test_haystack.xapian_tests --settings=test_haystack.xapian_settings
env:
PYTHONPATH: "/usr/lib/python3/dist-packages:."
- name: Coveralls
run: |
coverage combine django-haystack/.coverage
coverage report
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-django-${{ matrix.django-version }}-xapian-${{ matrix.xapian-version }}
COVERALLS_PARALLEL: true
coveralls:
needs: test
runs-on: ubuntu-latest
steps:
- name: Inform Coveralls of Completion
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}