@@ -414,6 +414,155 @@ jobs:
414414 env :
415415 ANACONDA_TOKEN : ${{ secrets.ANACONDA_TOKEN }}
416416
417+ array-api-conformity :
418+ name : Array API conformity
419+
420+ needs : build
421+
422+ permissions :
423+ # Needed to add a comment to a pull request's issue
424+ pull-requests : write
425+
426+ strategy :
427+ matrix :
428+ python : ['3.12']
429+ os : [ubuntu-22.04]
430+
431+ runs-on : ${{ matrix.os }}
432+
433+ defaults :
434+ run :
435+ shell : bash -el {0}
436+
437+ continue-on-error : true
438+
439+ env :
440+ array-api-tests-path : ' ${{ github.workspace }}/array-api-tests/'
441+ channel-path : ' ${{ github.workspace }}/channel/'
442+ pkg-path-in-channel : ' ${{ github.workspace }}/channel/linux-64/'
443+ extracted-pkg-path : ' ${{ github.workspace }}/pkg/'
444+ ver-json-path : ' ${{ github.workspace }}/version.json'
445+
446+ steps :
447+ - name : Checkout DPNP repo
448+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
449+ with :
450+ fetch-depth : 0
451+
452+ - name : Clone array API tests repo
453+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
454+ with :
455+ repository : ' data-apis/array-api-tests'
456+ path : ${{ env.array-api-tests-path }}
457+ fetch-depth : 0
458+ submodules : ' recursive'
459+
460+ - name : Download artifact
461+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
462+ with :
463+ name : ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
464+ path : ${{ env.pkg-path-in-channel }}
465+
466+ - name : Extract package archive
467+ run : |
468+ mkdir -p ${{ env.extracted-pkg-path }}
469+ tar -xvf ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.tar.bz2 -C ${{ env.extracted-pkg-path }}
470+
471+ - name : Setup miniconda
472+ uses : conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
473+ with :
474+ miniforge-version : latest
475+ use-mamba : ' true'
476+ channels : conda-forge
477+ conda-remove-defaults : ' true'
478+ python-version : ${{ matrix.python }}
479+ activate-environment : ' array-api-conformity'
480+
481+ - name : Install conda-index
482+ run : mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
483+
484+ - name : Create conda channel
485+ run : |
486+ python -m conda_index ${{ env.channel-path }}
487+
488+ - name : Test conda channel
489+ run : |
490+ conda search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
491+ cat ${{ env.ver-json-path }}
492+
493+ - name : Get package version
494+ run : |
495+ export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}")
496+
497+ echo PACKAGE_VERSION=${PACKAGE_VERSION}
498+ echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
499+
500+ - name : Install dpnp
501+ run : |
502+ mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
503+ env :
504+ TEST_CHANNELS : ' -c ${{ env.channel-path }} ${{ env.CHANNELS }}'
505+ MAMBA_NO_LOW_SPEED_LIMIT : 1
506+
507+ - name : Install array API test dependencies
508+ run : |
509+ ls -la ${{ env.array-api-tests-path }}
510+ ls -la .
511+ pip install -r requirements.txt
512+ working-directory : ${{ env.array-api-tests-path }}
513+
514+ - name : Install jq
515+ run : |
516+ sudo apt-get install jq
517+
518+ - name : Smoke test
519+ run : |
520+ python -c "import dpnp, dpctl; dpctl.lsplatform()"
521+ python -c "import dpnp; print(dpnp.__version__)"
522+
523+ - name : List installed packages
524+ run : mamba list
525+
526+ - name : Run array API conformance tests
527+ id : run-array-api-tests
528+ env :
529+ ARRAY_API_TESTS_MODULE : ' dpnp'
530+ SYCL_CACHE_PERSISTENT : 1
531+ run : |
532+ FILE=/home/runner/work/.report.json
533+ python -m pytest --json-report --json-report-file=$FILE --disable-deadline --skips-file ${GITHUB_WORKSPACE}/.github/workflows/array-api-skips.txt array_api_tests/ || true
534+ working-directory : ${{ env.array-api-tests-path }}
535+
536+ - name : Set Github environment variables
537+ run : |
538+ FILE=/home/runner/work/.report.json
539+ if test -f "$FILE"; then
540+ PASSED_TESTS=$(jq '.summary | .passed // 0' $FILE)
541+ FAILED_TESTS=$(jq '.summary | .failed // 0' $FILE)
542+ SKIPPED_TESTS=$(jq '.summary | .skipped // 0' $FILE)
543+ MESSAGE="Array API standard conformance tests for dpctl=$PACKAGE_VERSION ran successfully.
544+ Passed: $PASSED_TESTS
545+ Failed: $FAILED_TESTS
546+ Skipped: $SKIPPED_TESTS"
547+ echo "MESSAGE<<EOF" >> $GITHUB_ENV
548+ echo "$MESSAGE" >> $GITHUB_ENV
549+ echo "EOF" >> $GITHUB_ENV
550+ else
551+ echo "Array API standard conformance tests failed to run for dpctl=$PACKAGE_VERSION."
552+ exit 1
553+ fi
554+
555+ - name : Output API summary
556+ run : echo "::notice ${{ env.MESSAGE }}"
557+
558+ - name : Post result to PR
559+ if : ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
560+ uses : mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
561+ with :
562+ message : |
563+ ${{ env.MESSAGE }}
564+ allow-repeats : false
565+
417566 cleanup_packages :
418567 name : Clean up anaconda packages
419568
0 commit comments