-
Notifications
You must be signed in to change notification settings - Fork 1
296 lines (250 loc) · 11.8 KB
/
python-sdk-tests.yml
File metadata and controls
296 lines (250 loc) · 11.8 KB
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: Python SDK Tests
on:
workflow_dispatch:
inputs:
artifact_id:
description: 'Artifact ID to download the libraries from'
required: true
type: string
permissions:
checks: write
actions: write
jobs:
download-artifacts:
name: Download Build Artifacts for Python SDK Tests
runs-on: ubuntu-latest
env:
JOB_DISPLAY_NAME: Download Build Artifacts for Python SDK Tests
steps:
- name: Create Check
id: create_check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const checkRun = await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, name: process.env.JOB_DISPLAY_NAME, head_sha: context.sha, status: "in_progress" });
core.setOutput("check_run_id", checkRun.data.id);
- name: Create artifacts directory
run: mkdir -p ${{ github.workspace }}/build_artifacts
- name: Download artifacts using GitHub API
working-directory: ${{ github.workspace }}/build_artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
# Download artifact using GitHub CLI
gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/actions/artifacts/${{ inputs.artifact_id }}/zip \
> artifacts.zip
unzip artifacts.zip
ls -la
- name: Upload artifacts for test jobs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: test-artifacts
path: ${{ github.workspace }}/build_artifacts
retention-days: 1
- name: Update Check
if: always()
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
await github.rest.checks.update({ owner: context.repo.owner, repo: context.repo.repo, check_run_id: parseInt("${{ steps.create_check.outputs.check_run_id }}"), status: "completed", conclusion: "${{ job.status }}" === "success" ? "success" : "failure" });
linux-amd64-test-docker:
name: Run Python SDK Tests on Linux AMD64 with Docker
needs: download-artifacts
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdks/python/test-optimization-sdk
env:
TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH: ${{ github.workspace }}/build_artifacts
JOB_DISPLAY_NAME: Run Python SDK Tests on Linux AMD64 with Docker
steps:
- name: Create Check
id: create_check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const checkRun = await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, name: process.env.JOB_DISPLAY_NAME, head_sha: context.sha, status: "in_progress" });
core.setOutput("check_run_id", checkRun.data.id);
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download test artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: test-artifacts
path: ${{ github.workspace }}/build_artifacts
- name: Build and run tests
run: |
docker build -t python-test-optimization-sdk-test .
docker run -v ${{ github.workspace }}/build_artifacts:/build_artifacts -e TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH=/build_artifacts python-test-optimization-sdk-test
- name: Update Check
if: always()
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
await github.rest.checks.update({ owner: context.repo.owner, repo: context.repo.repo, check_run_id: parseInt("${{ steps.create_check.outputs.check_run_id }}"), status: "completed", conclusion: "${{ job.status }}" === "success" ? "success" : "failure" });
linux-amd64-test:
name: Run Python SDK Tests on Linux AMD64
needs: download-artifacts
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdks/python/test-optimization-sdk
env:
TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH: ${{ github.workspace }}/build_artifacts
JOB_DISPLAY_NAME: Run Python SDK Tests on Linux AMD64
steps:
- name: Create Check
id: create_check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const checkRun = await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, name: process.env.JOB_DISPLAY_NAME, head_sha: context.sha, status: "in_progress" });
core.setOutput("check_run_id", checkRun.data.id);
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download test artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: test-artifacts
path: ${{ github.workspace }}/build_artifacts
- name: Set up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e . --no-deps
- name: Run tests
run: pytest --capture=no
- name: Update Check
if: always()
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
await github.rest.checks.update({ owner: context.repo.owner, repo: context.repo.repo, check_run_id: parseInt("${{ steps.create_check.outputs.check_run_id }}"), status: "completed", conclusion: "${{ job.status }}" === "success" ? "success" : "failure" });
linux-arm64-test:
name: Run Python SDK Tests on Linux ARM64
needs: download-artifacts
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdks/python/test-optimization-sdk
env:
TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH: ${{ github.workspace }}/build_artifacts
JOB_DISPLAY_NAME: Run Python SDK Tests on Linux ARM64
steps:
- name: Create Check
id: create_check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const checkRun = await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, name: process.env.JOB_DISPLAY_NAME, head_sha: context.sha, status: "in_progress" });
core.setOutput("check_run_id", checkRun.data.id);
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download test artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: test-artifacts
path: ${{ github.workspace }}/build_artifacts
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Build and run tests
run: |
docker buildx build --platform linux/arm64 -t python-test-optimization-sdk-test . --load
docker run -v ${{ github.workspace }}/build_artifacts:/build_artifacts -e TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH=/build_artifacts python-test-optimization-sdk-test
- name: Update Check
if: always()
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
await github.rest.checks.update({ owner: context.repo.owner, repo: context.repo.repo, check_run_id: parseInt("${{ steps.create_check.outputs.check_run_id }}"), status: "completed", conclusion: "${{ job.status }}" === "success" ? "success" : "failure" });
macos-test:
name: Run Python SDK Tests on macOS
needs: download-artifacts
runs-on: macos-latest
defaults:
run:
working-directory: sdks/python/test-optimization-sdk
env:
TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH: ${{ github.workspace }}/build_artifacts
JOB_DISPLAY_NAME: Run Python SDK Tests on macOS
steps:
- name: Create Check
id: create_check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const checkRun = await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, name: process.env.JOB_DISPLAY_NAME, head_sha: context.sha, status: "in_progress" });
core.setOutput("check_run_id", checkRun.data.id);
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download test artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: test-artifacts
path: ${{ github.workspace }}/build_artifacts
- name: Set up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e . --no-deps
- name: Run tests
run: pytest --capture=no
- name: Update Check
if: always()
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
await github.rest.checks.update({ owner: context.repo.owner, repo: context.repo.repo, check_run_id: parseInt("${{ steps.create_check.outputs.check_run_id }}"), status: "completed", conclusion: "${{ job.status }}" === "success" ? "success" : "failure" });
windows-test:
name: Run Python SDK Tests on Windows
needs: download-artifacts
runs-on: windows-latest
defaults:
run:
working-directory: sdks/python/test-optimization-sdk
env:
TEST_OPTIMIZATION_SDK_NATIVE_SEARCH_PATH: ${{ github.workspace }}/build_artifacts
JOB_DISPLAY_NAME: Run Python SDK Tests on Windows
steps:
- name: Create Check
id: create_check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
const checkRun = await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, name: process.env.JOB_DISPLAY_NAME, head_sha: context.sha, status: "in_progress" });
core.setOutput("check_run_id", checkRun.data.id);
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download test artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: test-artifacts
path: ${{ github.workspace }}/build_artifacts
- name: Set up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e . --no-deps
- name: Run tests
run: pytest --capture=no
- name: Update Check
if: always()
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
script: |
await github.rest.checks.update({ owner: context.repo.owner, repo: context.repo.repo, check_run_id: parseInt("${{ steps.create_check.outputs.check_run_id }}"), status: "completed", conclusion: "${{ job.status }}" === "success" ? "success" : "failure" });