@@ -112,10 +112,11 @@ jobs:
112
112
uses : actions/download-artifact@v2
113
113
with :
114
114
name : ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
115
- - name : Add conda to system path
116
- run : echo $CONDA/bin >> $GITHUB_PATH
117
115
- name : Install conda-build
116
+ # Needed to be able to run conda index
118
117
run : conda install conda-build
118
+ - name : Add conda to system path
119
+ run : echo $CONDA/bin >> $GITHUB_PATH
119
120
- name : Create conda channel
120
121
run : |
121
122
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
@@ -178,6 +179,7 @@ jobs:
178
179
auto-activate-base : true
179
180
activate-environment : " "
180
181
- name : Install conda-build
182
+ # Needed to be able to run conda index
181
183
run : conda install conda-build
182
184
- name : Create conda channel
183
185
run : |
@@ -263,3 +265,103 @@ jobs:
263
265
run : |
264
266
conda install anaconda-client
265
267
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
268
+
269
+ test_examples_linux :
270
+ needs : build_linux
271
+ if : ${{ github.event.pull_request }}
272
+ runs-on : ${{ matrix.runner }}
273
+ strategy :
274
+ matrix :
275
+ python : [3.8]
276
+ experimental : [false]
277
+ runner : [ubuntu-latest]
278
+ continue-on-error : ${{ matrix.experimental }}
279
+ env :
280
+ CHANNELS : -c intel -c defaults --override-channels
281
+
282
+ steps :
283
+ - name : Install conda-build
284
+ # Needed to be able to run conda index
285
+ run : conda install conda-build python=${{ matrix.python }}
286
+ - name : Checkout dpctl repo
287
+ uses : actions/checkout@v2
288
+ with :
289
+ fetch-depth : 0
290
+ - name : Download artifact
291
+ uses : actions/download-artifact@v2
292
+ with :
293
+ name : ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
294
+ - name : Add conda to system path
295
+ run : echo $CONDA/bin >> $GITHUB_PATH
296
+ - name : Create conda channel
297
+ run : |
298
+ mkdir -p $GITHUB_WORKSPACE/channel/linux-64
299
+ mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64
300
+ conda index $GITHUB_WORKSPACE/channel
301
+ # Test channel
302
+ conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
303
+ - name : Collect dependencies
304
+ run : |
305
+ CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
306
+ conda install $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
307
+ - name : Set pkgs_dirs
308
+ run : |
309
+ echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
310
+ - name : Cache conda packages
311
+ uses : actions/cache@v2
312
+ env :
313
+ CACHE_NUMBER : 0 # Increase to reset cache
314
+ with :
315
+ path : ~/.conda/pkgs
316
+ key :
317
+ ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
318
+ restore-keys : |
319
+ ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
320
+ ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
321
+ - name : Install dpctl
322
+ shell : bash -l {0}
323
+ run : |
324
+ source $CONDA/etc/profile.d/conda.sh
325
+ conda activate
326
+ CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
327
+ conda install -y $PACKAGE_NAME pytest python=${{ matrix.python }} $CHANNELS
328
+ # Test installed packages
329
+ conda list
330
+ - name : Install example requirements
331
+ shell : bash -l {0}
332
+ run : |
333
+ source $CONDA/etc/profile.d/conda.sh
334
+ conda install -y pybind11 cython
335
+ conda install -y -c intel mkl-dpcpp mkl-devel-dpcpp numba-dppy
336
+ conda create -y -n build_env -c intel dpcpp_linux-64
337
+ conda activate --stack build_env
338
+ - name : Build and run examples with native extensions
339
+ shell : bash -l {0}
340
+ run : |
341
+ cd examples/pybind11
342
+ export CC=dpcpp
343
+ export CXX=dpcpp
344
+ for d in $(ls)
345
+ do
346
+ pushd $d
347
+ python setup.py build_ext --inplace || exit 1
348
+ python example.py
349
+ popd
350
+ done
351
+ cd ../cython
352
+ for d in $(ls)
353
+ do
354
+ pushd $d
355
+ python setup.py build_ext --inplace || exit 1
356
+ python run.py
357
+ popd
358
+ done
359
+ - name : Run Python examples
360
+ shell : bash -l {0}
361
+ run : |
362
+ cd examples/python
363
+ for script in $(find . \( -not -name "_*" -and -name "*.py" \))
364
+ do
365
+ echo "Executing ${script}"
366
+ python ${script} || exit 1
367
+ done
0 commit comments