Skip to content

Commit b8b7d23

Browse files
A step added to build/run examples
1 parent b7a15ed commit b8b7d23

File tree

1 file changed

+90
-4
lines changed

1 file changed

+90
-4
lines changed

.github/workflows/conda-package.yml

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ jobs:
114114
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
115115
- name: Add conda to system path
116116
run: echo $CONDA/bin >> $GITHUB_PATH
117-
- name: Install conda-build
118-
run: conda install conda-build
119117
- name: Create conda channel
120118
run: |
121119
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
@@ -177,8 +175,6 @@ jobs:
177175
with:
178176
auto-activate-base: true
179177
activate-environment: ""
180-
- name: Install conda-build
181-
run: conda install conda-build
182178
- name: Create conda channel
183179
run: |
184180
mkdir -p $GITHUB_WORKSPACE/channel/win-64
@@ -263,3 +259,93 @@ jobs:
263259
run: |
264260
conda install anaconda-client
265261
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
262+
263+
test_examples_linux:
264+
needs: build_linux
265+
runs-on: ${{ matrix.runner }}
266+
267+
strategy:
268+
matrix:
269+
python: [3.8, 3.9]
270+
experimental: [false]
271+
runner: [ubuntu-latest]
272+
# include:
273+
# - python: 3.8
274+
# experimental: true
275+
# runner: [self-hosted, gen9]
276+
continue-on-error: ${{ matrix.experimental }}
277+
env:
278+
CHANNELS: -c intel -c defaults --override-channels
279+
steps:
280+
- name: Checkout dpctl repo
281+
uses: actions/checkout@v2
282+
with:
283+
fetch-depth: 0
284+
- name: Download artifact
285+
uses: actions/download-artifact@v2
286+
with:
287+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
288+
- name: Add conda to system path
289+
run: echo $CONDA/bin >> $GITHUB_PATH
290+
- name: Install example requirements
291+
run: |
292+
conda install pybind11 cython
293+
conda install -c intel mkl-dpcpp mkl-dpcpp-devel
294+
conda install -c dppy/label/dev numba-dppy
295+
- name: Create conda channel
296+
run: |
297+
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
298+
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64
299+
conda index $GITHUB_WORKSPACE/channel
300+
# Test channel
301+
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
302+
- name: Collect dependencies
303+
run: |
304+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
305+
conda install $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
306+
- name: Set pkgs_dirs
307+
run: |
308+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
309+
- name: Cache conda packages
310+
uses: actions/cache@v2
311+
env:
312+
CACHE_NUMBER: 0 # Increase to reset cache
313+
with:
314+
path: ~/.conda/pkgs
315+
key:
316+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
317+
restore-keys: |
318+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
319+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
320+
- name: Install dpctl
321+
run: |
322+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
323+
conda install $PACKAGE_NAME pytest python=${{ matrix.python }} $CHANNELS
324+
# Test installed packages
325+
conda list
326+
- name: Build and run examples with native extensions
327+
run: |
328+
cd examples/pybind11
329+
for d in $(ls)
330+
do
331+
pushd $d
332+
python setup.py build_ext --inplace || exit 1
333+
python example.py
334+
popd
335+
done
336+
cd ../cython
337+
for d in $(ls)
338+
do
339+
pushd $d
340+
python setup.py build_ext --inplace || exit 1
341+
python run.py
342+
popd
343+
done
344+
- name: Run Python examples
345+
run: |
346+
cd examples/python
347+
for script in $(find . \( -not -name "_*" -and -name "*.py" \))
348+
do
349+
echo "Executing ${script}"
350+
python ${script} || exit 1
351+
done

0 commit comments

Comments
 (0)