This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
136 lines (120 loc) · 3.35 KB
/
api_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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: API CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- 'api/**'
pull_request:
branches:
- main
paths:
- 'api/**'
jobs:
api_checks:
name: API Checks
runs-on: ubuntu-latest
# Don't run nightly builds for forks.
if: github.repository == 'allenai/allennlp-demo' || github.event_name != 'schedule'
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pydeps-${{ env.pythonLocation }}-${{ hashFiles('api/requirements.txt') }}-${{ hashFiles('api/dev-requirements.txt') }}-v2
- name: Install requirements
working-directory: api
env:
ALLENNLP_VERSION_OVERRIDE: allennlp
run: |
pip install -r requirements.txt -r dev-requirements.txt
- name: Debug info
run: |
pip freeze
- name: Format
working-directory: api
if: '! cancelled()'
run: |
make format
- name: Lint
working-directory: api
if: '! cancelled()'
run: |
make lint
- name: Type check
working-directory: api
if: '! cancelled()'
run: |
make typecheck
endpoint_test:
name: Endpoint Test
runs-on: [self-hosted]
# self-hosted runner only available on main repo
if: github.repository == 'allenai/allennlp-demo'
strategy:
fail-fast: false
matrix:
# This should be all of the directory names in api/allennlp_demo that correspond
# to demo model endpoints.
model: [
"atis_parser",
"bidaf",
"bidaf_elmo",
"constituency_parser",
"coref",
"dependency_parser",
"elmo_snli",
"fine_grained_ner",
"glove_sentiment_analysis",
"lerc",
"masked_lm",
"named_entity_recognition",
"naqanet",
"next_token_lm",
"nlvr_parser",
"nmn_drop",
"open_information_extraction",
"roberta_mnli",
"roberta_sentiment_analysis",
"roberta_snli",
"binary_gender_bias_mitigated_roberta_snli",
"adversarial_binary_gender_bias_mitigated_roberta_snli",
"semantic_role_labeling",
"transformer_qa",
"vilbert_vqa",
"wikitables_parser",
"tasks",
"model_cards"
]
steps:
- uses: actions/checkout@v2
- name: Build and test endpoint
working-directory: api
run: |
make ${{ matrix.model }}-test DOCKER_TAG=$GITHUB_SHA
validate_ci:
name: Validate CI Config
runs-on: ubuntu-latest
# Don't run nightly builds for forks.
if: github.repository == 'allenai/allennlp-demo' || github.event_name != 'schedule'
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install requirements
run: |
pip install PyYAML
- name: Validate GitHub Actions config
run: |
# If this step fails, this means the model matrix in the 'endpoint_test' GitHub Actions
# job needs to be updated.
python dev/check_models_ci.py