config.yml 7.79 KB
Newer Older
Julien Chaumond's avatar
Julien Chaumond committed
1
2
version: 2
jobs:
Aymeric Augustin's avatar
Aymeric Augustin committed
3
    run_tests_torch_and_tf:
4
        working_directory: ~/transformers
5
        docker:
6
            - image: circleci/python:3.6
7
8
        environment:
            OMP_NUM_THREADS: 1
9
10
11
12
        resource_class: xlarge
        parallelism: 1
        steps:
            - checkout
13
14
15
16
17
18
19
20
21
22
23
            - restore_cache:
                  keys:
                      - v0.3-torch_and_tf-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
            - run: pip install .[sklearn,tf-cpu,torch,testing]
            - run: pip install codecov pytest-cov
            - save_cache:
                key: v0.3-{{ checksum "setup.py" }}
                paths:
                    - '~/.cache/pip'
24
            - run: python -m pytest -n 8 --dist=loadfile -s ./tests/ --cov  | tee output.txt
25
            - run: codecov
26
27
28
            - store_artifacts:
                  path: ~/transformers/output.txt
                  destination: test_output.txt
Aymeric Augustin's avatar
Aymeric Augustin committed
29
    run_tests_torch:
30
        working_directory: ~/transformers
Julien Chaumond's avatar
Julien Chaumond committed
31
        docker:
32
            - image: circleci/python:3.7
33
34
        environment:
            OMP_NUM_THREADS: 1
35
        resource_class: xlarge
36
        parallelism: 1
Julien Chaumond's avatar
Julien Chaumond committed
37
38
        steps:
            - checkout
39
40
41
42
43
44
45
46
47
48
            - restore_cache:
                  keys:
                      - v0.3-torch-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
            - run: pip install .[sklearn,torch,testing]
            - save_cache:
                  key: v0.3-torch-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
49
50
51
52
53
            - run: python -m pytest -n 8 --dist=loadfile -s ./tests/ | tee output.txt
            - store_artifacts:
                  path: ~/transformers/output.txt
                  destination: test_output.txt

Aymeric Augustin's avatar
Aymeric Augustin committed
54
    run_tests_tf:
55
        working_directory: ~/transformers
thomwolf's avatar
thomwolf committed
56
        docker:
57
            - image: circleci/python:3.7
58
59
        environment:
            OMP_NUM_THREADS: 1
thomwolf's avatar
thomwolf committed
60
61
62
63
        resource_class: xlarge
        parallelism: 1
        steps:
            - checkout
64
65
66
67
68
69
70
71
72
73
            - restore_cache:
                  keys:
                      - v0.3-tf-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
            - run: pip install .[sklearn,tf-cpu,testing]
            - save_cache:
                  key: v0.3-tf-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
74
75
76
77
            - run: python -m pytest -n 8 --dist=loadfile -s ./tests/ | tee output.txt
            - store_artifacts:
               path: ~/transformers/output.txt
               destination: test_output.txt
Aymeric Augustin's avatar
Aymeric Augustin committed
78
    run_tests_custom_tokenizers:
79
80
        working_directory: ~/transformers
        docker:
81
            - image: circleci/python:3.6
82
83
        environment:
            RUN_CUSTOM_TOKENIZERS: yes
84
85
        steps:
            - checkout
86
87
88
89
90
91
92
93
94
95
            - restore_cache:
                  keys:
                      - v0.3-custom_tokenizers-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
            - run: pip install .[ja,testing]
            - save_cache:
                  key: v0.3-custom_tokenizers-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
96
97
98
99
            - run: python -m pytest -s ./tests/test_tokenization_bert_japanese.py | tee output.txt
            - store_artifacts:
                path: ~/transformers/output.txt
                destination: test_output.txt
Aymeric Augustin's avatar
Aymeric Augustin committed
100
    run_examples_torch:
101
102
        working_directory: ~/transformers
        docker:
103
            - image: circleci/python:3.6
104
105
106
107
108
109
        environment:
            OMP_NUM_THREADS: 1
        resource_class: xlarge
        parallelism: 1
        steps:
            - checkout
110
111
112
113
114
115
116
117
118
119
120
            - restore_cache:
                  keys:
                      - v0.3-torch_examples-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
            - run: pip install .[sklearn,torch,testing]
            - run: pip install -r examples/requirements.txt
            - save_cache:
                  key: v0.3-torch_examples-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
121
            - run: python -m pytest -n 8 --dist=loadfile -rA -s ./examples/ | tee output.txt
122
123
124
            - store_artifacts:
                  path: ~/transformers/output.txt
                  destination: test_output.txt
125
126
127
128
129
130
    build_doc:
        working_directory: ~/transformers
        docker:
            - image: circleci/python:3.6
        steps:
            - checkout
131
132
133
134
135
136
137
138
139
140
            - restore_cache:
                  keys:
                      - v0.3-build_doc-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
            - run: pip install .[tf,torch,docs]
            - save_cache:
                  key: v0.3-build_doc-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
141
            - run: cd docs && make html SPHINXOPTS="-W"
142
143
            - store_artifacts:
                path: ./docs/_build
LysandreJik's avatar
LysandreJik committed
144
    deploy_doc:
145
        working_directory: ~/transformers
LysandreJik's avatar
LysandreJik committed
146
        docker:
147
            - image: circleci/python:3.6
LysandreJik's avatar
LysandreJik committed
148
149
        steps:
            - add_ssh_keys:
150
151
                fingerprints:
                    - "5b:7a:95:18:07:8c:aa:76:4c:60:35:88:ad:60:56:71"
LysandreJik's avatar
LysandreJik committed
152
            - checkout
153
154
155
156
157
158
159
160
161
            - restore_cache:
                  keys:
                      - v0.3-deploy_doc-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install .[tf,torch,docs]
            - save_cache:
                  key: v0.3-deploy_doc-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
Lysandre's avatar
Lysandre committed
162
            - run: ./.circleci/deploy.sh
Aymeric Augustin's avatar
Aymeric Augustin committed
163
164
165
166
    check_code_quality:
        working_directory: ~/transformers
        docker:
            - image: circleci/python:3.6
Aymeric Augustin's avatar
Aymeric Augustin committed
167
        resource_class: medium
Aymeric Augustin's avatar
Aymeric Augustin committed
168
169
170
        parallelism: 1
        steps:
            - checkout
171
172
173
174
175
            - restore_cache:
                  keys:
                      - v0.3-code_quality-{{ checksum "setup.py" }}
                      - v0.3-{{ checksum "setup.py" }}
            - run: pip install --upgrade pip
176
            # we need a version of isort with https://github.com/timothycrosley/isort/pull/1000
177
178
179
180
181
182
            - run: pip install git+git://github.com/timothycrosley/isort.git@e63ae06ec7d70b06df9e528357650281a3d3ec22#egg=isort
            - run: pip install .[tf,torch,quality]
            - save_cache:
                  key: v0.3-code_quality-{{ checksum "setup.py" }}
                  paths:
                      - '~/.cache/pip'
183
            - run: black --check --line-length 119 --target-version py35 examples templates tests src utils
184
185
            - run: isort --check-only --recursive examples templates tests src utils
            - run: flake8 examples templates tests src utils
186
    check_repository_consistency:
R茅mi Louf's avatar
R茅mi Louf committed
187
188
        working_directory: ~/transformers
        docker:
189
            - image: circleci/python:3.6
R茅mi Louf's avatar
R茅mi Louf committed
190
191
192
193
        resource_class: small
        parallelism: 1
        steps:
            - checkout
194
            - run: pip install requests
R茅mi Louf's avatar
R茅mi Louf committed
195
            - run: python ./utils/link_tester.py
LysandreJik's avatar
LysandreJik committed
196
197
198
199
workflow_filters: &workflow_filters
    filters:
        branches:
            only:
Lysandre's avatar
Lysandre committed
200
                - master
201
workflows:
LysandreJik's avatar
LysandreJik committed
202
203
204
    version: 2
    build_and_test:
        jobs:
Aymeric Augustin's avatar
Aymeric Augustin committed
205
            - check_code_quality
206
            - check_repository_consistency
Aymeric Augustin's avatar
Aymeric Augustin committed
207
208
209
210
211
            - run_examples_torch
            - run_tests_custom_tokenizers
            - run_tests_torch_and_tf
            - run_tests_torch
            - run_tests_tf
212
            - build_doc
Lysandre's avatar
Lysandre committed
213
            - deploy_doc: *workflow_filters