@@ -476,3 +476,134 @@ jobs:
476
476
echo "Executing ${script}"
477
477
python ${script} || exit 1
478
478
done
479
+
480
+ array-api-conformity :
481
+ needs : test_linux
482
+ runs-on : ${{ matrix.runner }}
483
+
484
+ strategy :
485
+ matrix :
486
+ python : ['3.10']
487
+ experimental : [false]
488
+ runner : [ubuntu-latest]
489
+ continue-on-error : ${{ matrix.experimental }}
490
+ env :
491
+ CHANNELS : -c intel -c defaults --override-channels
492
+ steps :
493
+ - name : Cache array API tests
494
+ id : cache-array-api-tests
495
+ uses : actions/cache@v3
496
+ env :
497
+ ARRAY_CACHE : 3
498
+ with :
499
+ path : |
500
+ /home/runner/work/array-api-tests/
501
+ key : ${{ runner.os }}-array-api-${{ env.cache-name }}-{{ env.ARRAY_CACHE }}-${{ hashFiles('/home/runner/work/array-api-tests/requirements.txt') }}
502
+ restore-keys : |
503
+ ${{ runner.os }}-build-${{ env.cache-name }}-
504
+ ${{ runner.os }}-build-
505
+ ${{ runner.os }}-
506
+ - name : Clone array API tests repo
507
+ if : steps.cache-array-api-tests.outputs.cache-hit != 'true'
508
+ shell : bash -l {0}
509
+ run : |
510
+ cd /home/runner/work
511
+ git clone --recurse-submodules https://github.com/data-apis/array-api-tests array-api-tests
512
+ cd array-api-tests
513
+ - name : Download artifact
514
+ uses : actions/download-artifact@v2
515
+ with :
516
+ name : ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
517
+ - name : Add conda to system path
518
+ run : echo $CONDA/bin >> $GITHUB_PATH
519
+ - name : Install conda-build
520
+ # Needed to be able to run conda index
521
+ run : conda install conda-build
522
+ - name : Create conda channel
523
+ run : |
524
+ mkdir -p $GITHUB_WORKSPACE/channel/linux-64
525
+ conda index $GITHUB_WORKSPACE/channel || exit 1
526
+ mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 || exit 1
527
+ conda index $GITHUB_WORKSPACE/channel || exit 1
528
+ # Test channel
529
+ conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
530
+ cat ver.json
531
+ - name : Collect dependencies
532
+ run : |
533
+ CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
534
+ export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
535
+ conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
536
+ cat lockfile
537
+ - name : Set pkgs_dirs
538
+ run : |
539
+ echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
540
+ - name : Cache conda packages
541
+ uses : actions/cache@v3
542
+ env :
543
+ CACHE_NUMBER : 3 # Increase to reset cache
544
+ with :
545
+ path : ~/.conda/pkgs
546
+ key :
547
+ ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
548
+ restore-keys : |
549
+ ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
550
+ ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
551
+ - name : Install dpctl
552
+ run : |
553
+ CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
554
+ export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
555
+ conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
556
+ # Test installed packages
557
+ conda list
558
+ - name : Install array API test dependencies
559
+ shell : bash -l {0}
560
+ run : |
561
+ . $CONDA/etc/profile.d/conda.sh
562
+ conda activate test_dpctl
563
+ cd /home/runner/work/array-api-tests
564
+ pip install -r requirements.txt
565
+ - name : Install jq
566
+ shell : bash -l {0}
567
+ run : |
568
+ sudo apt-get install jq
569
+ - name : Run array API conformance tests
570
+ id : run-array-api-tests
571
+ shell : bash -l {0}
572
+ run : |
573
+ FILE=/home/runner/work/.report.json
574
+ . $CONDA/etc/profile.d/conda.sh
575
+ conda activate test_dpctl
576
+ # echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
577
+ export OCL_ICD_FILENAMES=libintelocl.so
578
+ export SYCL_ENABLE_HOST_DEVICE=1
579
+ python -c "import dpctl; dpctl.lsplatform()"
580
+ export ARRAY_API_TESTS_MODULE=dpctl.tensor
581
+ cd /home/runner/work/array-api-tests
582
+ pytest --ci --json-report --json-report-file=$FILE array_api_tests/ || true
583
+ - name : Set Github environment variables
584
+ shell : bash -l {0}
585
+ run : |
586
+ FILE=/home/runner/work/.report.json
587
+ if test -f "$FILE"; then
588
+ PASSED_TESTS=$(jq '.summary | .passed // 0' $FILE)
589
+ FAILED_TESTS=$(jq '.summary | .failed // 0' $FILE)
590
+ SKIPPED_TESTS=$(jq '.summary | .skipped // 0' $FILE)
591
+ MESSAGE="Array API standard conformance tests ran successfully.
592
+ Passed: $PASSED_TESTS
593
+ Failed: $FAILED_TESTS
594
+ Skipped: $SKIPPED_TESTS"
595
+ echo "MESSAGE<<EOF" >> $GITHUB_ENV
596
+ echo "$MESSAGE" >> $GITHUB_ENV
597
+ echo "EOF" >> $GITHUB_ENV
598
+ else
599
+ MESSAGE=$'Array API standard conformance tests failed to run.'
600
+ echo "MESSAGE=$MESSAGE" >> $GITHUB_ENV
601
+ fi
602
+ - name : Post result to PR
603
+ uses : mshick/add-pr-comment@v1
604
+ with :
605
+ message : |
606
+ ${{ env.MESSAGE }}
607
+ allow-repeats : true
608
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
609
+ repo-token-user-login : ' github-actions[bot]'
0 commit comments