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