64 lines (55 loc) · 1.83 KB
/
ci.yaml
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
name: ci-workflow
# run workflow for these events
on: [push, pull_request, workflow_dispatch]
jobs:
cache_nltk_data:
name: cache nltk_data
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache nltk data
uses: actions/cache@v2
id: restore-cache
with:
path: ~/nltk_data
key: nltk_data
- name: Download nltk data packages on cache miss
run: |
pip install regex # dependencies needed to download nltk data
python -c "import nltk; nltk.download('all')"
shell: bash
if: steps.restore-cache.outputs.cache-hit != 'true'
test:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
needs: cache_nltk_data
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v2
id: restore-cache
with:
path: ${{ env.pythonLocation }}
key: python-dependencies-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements-ci.txt') }}-${{ env.pythonLocation }}
- name: Install dependencies on cache miss
run: pip install --upgrade --requirement requirements-ci.txt
if: steps.restore-cache.outputs.cache-hit != 'true'
- name: Use cached nltk data
uses: actions/cache@v2
with:
path: ~/nltk_data
key: nltk_data
- name: Run pytest
run: pytest --numprocesses auto -rsx nltk/test
shell: bash