-
Notifications
You must be signed in to change notification settings - Fork 69
209 lines (179 loc) · 7.17 KB
/
macOS_test.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Test on macOS
on:
push:
branches:
- main
pull_request_target:
types: [opened, synchronize, labeled, reopened]
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.id || github.ref }}
cancel-in-progress: true
env:
POETRY_VERSION: "1.8.3"
PYTHON_VERSION: "3.10.9"
jobs:
macos-basic_tests:
if: |
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.pull_request.title, '[skip ci]')
runs-on: macos-13
steps:
- name: Check for required label
if: github.event_name == 'pull_request_target'
run: |
echo " Wait for lint "
sleep 10
LABEL=$(curl -s -X GET \
-H "Authorization: Bearer ${{ secrets.PERSONAL_GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels" | \
jq -r '.[].name' | grep -q 'lint_pass' && echo "true" || echo "false")
if [ "$LABEL" == "false" ]; then
echo "The 'lint_pass' label is missing. Skipping CI process."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Fetch PR source branch
if: github.event_name == 'pull_request_target'
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
echo ${{ github.event.pull_request.head.repo.clone_url }}
echo ${{ github.event.pull_request.head.ref }}
git remote add external_repo ${{ github.event.pull_request.head.repo.clone_url }}
git fetch external_repo ${{ github.event.pull_request.head.ref }}:pr_branch
else
echo ${{ github.event.pull_request.head.ref }}
git fetch origin ${{ github.event.pull_request.head.ref }}:pr_branch
fi
- name: Merge PR branch into main
if: github.event_name == 'pull_request_target'
run: |
git checkout main
git merge --no-ff pr_branch
git submodule update --init
- name: Copy poetry.lock to root directory
run: |
git branch
cd LazyLLM-Env &&git branch
cd ..
cp LazyLLM-Env/poetry.lock .
- name: Set up python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Download model
run: |
pip install modelscope
mkdir -p /Users/runner/.lazyllm
mkdir -p /Users/runner/.cache/modelscope/hub
ln -s /Users/runner/.cache/modelscope/hub /Users/runner/.lazyllm/model
modelscope download Shanghai_AI_Laboratory/internlm2-chat-7b &
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- name: Build project with Poetry
run: |
poetry build
- name: List dist directory
run: ls dist
- name: Install the built package
run: |
pip install dist/lazyllm*.whl
- name: basic_tests
run : |
git clone https://$GITHUB_TOKEN@github.com/LazyAGI/LazyLLM-Data.git /tmp/lazyllm/data
brew install ffmpeg
pip install -r tests/requirements.txt
export LAZYLLM_DATA_PATH=/tmp/lazyllm/data
python -m pytest -v --reruns=2 tests/basic_tests/
timeout-minutes: 30
env :
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
macos-charge_tests:
if: |
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.pull_request.title, '[skip ci]')
runs-on: macos-13
steps:
- name: Check for required label
if: github.event_name == 'pull_request_target'
run: |
echo " Wait for lint "
sleep 10
LABEL=$(curl -s -X GET \
-H "Authorization: Bearer ${{ secrets.PERSONAL_GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels" | \
jq -r '.[].name' | grep -q 'lint_pass' && echo "true" || echo "false")
if [ "$LABEL" == "false" ]; then
echo "The 'lint_pass' label is missing. Skipping CI process."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Merge PR branch into main
if: github.event_name == 'pull_request_target'
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
echo ${{ github.event.pull_request.head.repo.clone_url }}
echo ${{ github.event.pull_request.head.ref }}
git remote add external_repo ${{ github.event.pull_request.head.repo.clone_url }}
git fetch external_repo ${{ github.event.pull_request.head.ref }}:pr_branch
else
echo ${{ github.event.pull_request.head.ref }}
git fetch origin ${{ github.event.pull_request.head.ref }}:pr_branch
fi
- name: Merge PR branch into main
if: github.event_name == 'pull_request_target'
run: |
git checkout main
git merge --no-ff pr_branch
git submodule update --init
- name: Copy poetry.lock to root directory
run: |
git branch
cd LazyLLM-Env &&git branch
cd ..
cp LazyLLM-Env/poetry.lock .
- name: Set up python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- name: Build project with Poetry
run: |
poetry build
- name: List dist directory
run: ls dist
- name: Install the built package
run: |
pip install dist/lazyllm*.whl
- name: charge_tests
run : |
git clone https://$GITHUB_TOKEN@github.com/LazyAGI/LazyLLM-Data.git /tmp/lazyllm/data
pip install -r tests/requirements.txt
export LAZYLLM_DATA_PATH=/tmp/lazyllm/data
python -m pytest -v --reruns=2 tests/charge_tests
env :
LAZYLLM_KIMI_API_KEY: ${{ secrets.LAZYLLM_KIMI_API_KEY }}
LAZYLLM_GLM_API_KEY: ${{ secrets.LAZYLLM_GLM_API_KEY }}
LAZYLLM_QWEN_API_KEY: ${{ secrets.LAZYLLM_QWEN_API_KEY }}
LAZYLLM_SENSENOVA_API_KEY: ${{ secrets.LAZYLLM_SENSENOVA_API_KEY }}
LAZYLLM_SENSENOVA_SECRET_KEY: ${{ secrets.LAZYLLM_SENSENOVA_SECRET_KEY }}
LAZYLLM_PostgreSQL_URL: ${{ secrets.LAZYLLM_PostgreSQL_URL }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
timeout-minutes: 25