forked from deepset-ai/haystack
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (93 loc) · 3.9 KB
/
windows_ci.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
name: Windows CI
on:
workflow_dispatch:
push:
branches: [ master ]
# pull_request:
# branches: [ master ]
jobs:
type-check:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Test with mypy
run: |
pip install mypy==0.910 types-Markdown types-requests types-PyYAML pydantic
mypy haystack
build-cache:
needs: type-check
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Cache
id: cache-python-env
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
# The cache currently misses at every change in the Python files to ensure
# that the code changes to Haystack are not being cached along with the dependencies.
# TODO for the tests refactoring: We could speed up the process by caching only
# the dependencies and installing Haystack again separately for each test runner.
key: windows-${{ hashFiles('**/*.py') }}-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github') }}
- name: Install Pytorch on windows
run: |
pip install torch==1.8.1+cpu -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
- name: Install dependencies
if: steps.cache-python-env.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager .[test]
pip install --upgrade --upgrade-strategy eager rest_api/
pip install --upgrade --upgrade-strategy eager ui/
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cpu.html
prepare-build:
needs: build-cache
# With Windows it gives error, also this step only listing test files only
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- id: set-matrix
run: |
echo "::set-output name=matrix::$(find $(find . -type d -name test -not -path "./*env*/*") -type f -name test_*.py | jq -SR . | jq -cs .)"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
build:
needs: prepare-build
runs-on: windows-latest
strategy:
matrix:
test-path: ${{fromJson(needs.prepare-build.outputs.matrix)}}
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: windows-${{ hashFiles('**/*.py') }}-${{ hashFiles('**/setup.cfg') }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github') }}
# Windows runner can't run Linux containers. Refer https://github.com/actions/virtual-environments/issues/1143
- name: Set up Windows test env
run: |
choco install xpdf-utils
choco install openjdk11
refreshenv
choco install tesseract --pre
choco install elasticsearch --version=7.9.2
refreshenv
Get-Service elasticsearch-service-x64 | Start-Service
# We have to remove files if not test going to run from it
# As on windows we are going to disable quite a few tests these, hence these files will throw error refer https://github.com/pytest-dev/pytest/issues/812
# Removing test_ray, test_utils, test_preprocessor, test_knowledge_graph and test_connector
- name: Run tests
if: ${{ !contains(fromJSON('["test_ray.py", "test_knowledge_graph.py", "test_connector.py", "test_summarizer_translation.py"]'), matrix.test-path) }}
run: pytest --document_store_type=memory,faiss,elasticsearch -m "not tika and not graphdb" -k "not test_parsr_converter" -s ${{ matrix.test-path }}