@@ -397,6 +397,152 @@ 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+ fetch-depth : 0
440+ submodules : ' recursive'
441+
442+ - name : Download artifact
443+ uses : actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
444+ with :
445+ name : ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
446+ path : ${{ env.pkg-path-in-channel }}
447+
448+ - name : Extract package archive
449+ run : |
450+ mkdir -p ${{ env.extracted-pkg-path }}
451+ tar -xvf ${{ env.pkg-path-in-channel }}/${{ env.PACKAGE_NAME }}-*.tar.bz2 -C ${{ env.extracted-pkg-path }}
452+
453+ - name : Setup miniconda
454+ uses : conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
455+ with :
456+ miniforge-version : latest
457+ use-mamba : ' true'
458+ channels : conda-forge
459+ conda-remove-defaults : ' true'
460+ python-version : ${{ matrix.python }}
461+ activate-environment : ' array-api-conformity'
462+
463+ - name : Install conda-index
464+ run : mamba install conda-index=${{ env.CONDA_INDEX_VERSION }}
465+
466+ - name : Create conda channel
467+ run : |
468+ python -m conda_index ${{ env.channel-path }}
469+
470+ - name : Test conda channel
471+ run : |
472+ conda search ${{ env.PACKAGE_NAME }} -c ${{ env.channel-path }} --override-channels --info --json > ${{ env.ver-json-path }}
473+ cat ${{ env.ver-json-path }}
474+
475+ - name : Get package version
476+ run : |
477+ export PACKAGE_VERSION=$(python -c "${{ env.VER_SCRIPT1 }} ${{ env.VER_SCRIPT2 }}")
478+
479+ echo PACKAGE_VERSION=${PACKAGE_VERSION}
480+ echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
481+
482+ - name : Install dpnp
483+ run : |
484+ mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest python=${{ matrix.python }} ${{ env.TEST_CHANNELS }}
485+ env :
486+ TEST_CHANNELS : ' -c ${{ env.channel-path }} ${{ env.CHANNELS }}'
487+ MAMBA_NO_LOW_SPEED_LIMIT : 1
488+
489+ - name : Install array API test dependencies
490+ run : |
491+ pip install -r $requirements.txt
492+ working-directory : ${{ env.array-api-tests-path }}
493+
494+ - name : Install jq
495+ run : |
496+ sudo apt-get install jq
497+
498+ - name : Smoke test
499+ run : |
500+ python -c "import dpnp, dpctl; dpctl.lsplatform()"
501+ python -c "import dpnp; print(dpnp.__version__)"
502+
503+ - name : List installed packages
504+ run : mamba list
505+
506+ - name : Run array API conformance tests
507+ id : run-array-api-tests
508+ env :
509+ ARRAY_API_TESTS_MODULE : ' dpnp'
510+ SYCL_CACHE_PERSISTENT : 1
511+ run : |
512+ FILE=/home/runner/work/.report.json
513+ 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
514+ working-directory : ${{ env.array-api-tests-path }}
515+
516+ - name : Set Github environment variables
517+ run : |
518+ FILE=/home/runner/work/.report.json
519+ if test -f "$FILE"; then
520+ PASSED_TESTS=$(jq '.summary | .passed // 0' $FILE)
521+ FAILED_TESTS=$(jq '.summary | .failed // 0' $FILE)
522+ SKIPPED_TESTS=$(jq '.summary | .skipped // 0' $FILE)
523+ MESSAGE="Array API standard conformance tests for dpctl=$PACKAGE_VERSION ran successfully.
524+ Passed: $PASSED_TESTS
525+ Failed: $FAILED_TESTS
526+ Skipped: $SKIPPED_TESTS"
527+ echo "MESSAGE<<EOF" >> $GITHUB_ENV
528+ echo "$MESSAGE" >> $GITHUB_ENV
529+ echo "EOF" >> $GITHUB_ENV
530+ else
531+ echo "Array API standard conformance tests failed to run for dpctl=$PACKAGE_VERSION."
532+ exit 1
533+ fi
534+
535+ - name : Output API summary
536+ run : echo "::notice ${{ env.MESSAGE }}"
537+
538+ - name : Post result to PR
539+ if : ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
540+ uses : mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
541+ with :
542+ message : |
543+ ${{ env.MESSAGE }}
544+ allow-repeats : false
545+
400546 cleanup_packages :
401547 name : Clean up anaconda packages
402548
0 commit comments