-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (141 loc) · 4.12 KB
/
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
jobs:
lint-ruff:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Lint with ruff
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
# stop the build if there are Python syntax errors or undefined names
poetry run ruff .
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run ruff .
check-black:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: check black
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --only dev
poetry run black --check .
env:
CHANGED_FILES: ${{ steps.file_changes.outputs.added_modified }}
check-mypy:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: check mypy
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --all-extras
poetry run mypy textbook
# run all tests
run-training-test:
needs: [check-black, lint-ruff]
runs-on: [self-hosted, x64, gpu, linux]
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Prepare environment
run: |
python -m pip install --upgrade pip
python -m pip install -U poetry
poetry install
poetry run pip install torch
poetry run huggingface-cli login --token $HF_AUTH_TOKEN
- name: Test
id: test
run: |
poetry run pytest tests/training -m "not slow"
timeout-minutes: 30
env:
HF_AUTH_TOKEN: ${{ secrets.HF_AUTH_TOKEN }}
run-dataset-gen-test:
needs: [check-black, lint-ruff]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Prepare environment
run: |
python -m pip install --upgrade pip
python -m pip install -U poetry
poetry install
poetry run pip install torch
- name: Test
id: test
run: |
poetry run pytest tests/dataset_gen -m "not slow and not openai"
timeout-minutes: 30
run-evaluation-test:
needs: [check-black, lint-ruff]
runs-on: [self-hosted, x64, gpu, linux]
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Prepare environment
run: |
python -m pip install --upgrade pip
python -m pip install -U poetry
poetry install
poetry run pip install torch
poetry run huggingface-cli login --token $HF_AUTH_TOKEN
- name: Test
id: test
run: |
poetry run pytest tests/eval
timeout-minutes: 10
env:
HF_AUTH_TOKEN: ${{ secrets.HF_AUTH_TOKEN }}
# just for blocking the merge until all parallel core-test are successful
success-all-test:
needs: [check-mypy, run-training-test, run-dataset-gen-test, check-black, lint-ruff]
if: always()
runs-on: ubuntu-20.04
steps:
- uses: technote-space/workflow-conclusion-action@v2
- name: Check Failure
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1
- name: Success
if: ${{ success() }}
run: echo "All Done"