Skip to content

Commit 9d465d2

Browse files
authored
Merge pull request #7 from ndgrigorian/array-api-conformity-test
Array API tests reworked
2 parents 2bb2e08 + 8a2989b commit 9d465d2

File tree

1 file changed

+40
-23
lines changed

1 file changed

+40
-23
lines changed

.github/workflows/conda-package.yml

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,12 @@ jobs:
493493
- name: Cache array API tests
494494
id: cache-array-api-tests
495495
uses: actions/cache@v3
496+
env:
497+
ARRAY_CACHE: 3
496498
with:
497499
path: |
498-
/home/runner/work/array-api-tests-08-19-22/
499-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/array-api-tests-08-19-22/requirements.txt') }}
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') }}
500502
restore-keys: |
501503
${{ runner.os }}-build-${{ env.cache-name }}-
502504
${{ runner.os }}-build-
@@ -506,16 +508,16 @@ jobs:
506508
shell: bash -l {0}
507509
run: |
508510
cd /home/runner/work
509-
git clone --recurse-submodules https://github.com/data-apis/array-api-tests array-api-tests-08-19-22
510-
cd array-api-tests-08-19-22
511-
git checkout 66ab89c097d98f876e3c62f72e854ddb7d327f2e
511+
git clone --recurse-submodules https://github.com/data-apis/array-api-tests array-api-tests
512+
cd array-api-tests
512513
- name: Download artifact
513514
uses: actions/download-artifact@v2
514515
with:
515516
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
516517
- name: Add conda to system path
517518
run: echo $CONDA/bin >> $GITHUB_PATH
518519
- name: Install conda-build
520+
# Needed to be able to run conda index
519521
run: conda install conda-build
520522
- name: Create conda channel
521523
run: |
@@ -530,15 +532,15 @@ jobs:
530532
run: |
531533
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
532534
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
533-
conda install $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
535+
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
534536
cat lockfile
535537
- name: Set pkgs_dirs
536538
run: |
537539
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
538540
- name: Cache conda packages
539541
uses: actions/cache@v3
540542
env:
541-
CACHE_NUMBER: 1 # Increase to reset cache
543+
CACHE_NUMBER: 3 # Increase to reset cache
542544
with:
543545
path: ~/.conda/pkgs
544546
key:
@@ -550,43 +552,58 @@ jobs:
550552
run: |
551553
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
552554
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
553-
conda install $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
555+
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
554556
# Test installed packages
555557
conda list
556558
- name: Install array API test dependencies
557559
shell: bash -l {0}
558560
run: |
559-
cd /home/runner/work/array-api-tests-08-19-22
561+
. $CONDA/etc/profile.d/conda.sh
562+
conda activate test_dpctl
563+
cd /home/runner/work/array-api-tests
560564
pip install -r requirements.txt
561565
- name: Install jq
562566
shell: bash -l {0}
563567
run: |
564568
sudo apt-get install jq
565-
- name: Array API conformity tests
569+
- name: Run array API conformance tests
570+
id: run-array-api-tests
566571
shell: bash -l {0}
567572
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
568578
export SYCL_ENABLE_HOST_DEVICE=1
569579
python -c "import dpctl; dpctl.lsplatform()"
570580
export ARRAY_API_TESTS_MODULE=dpctl.tensor
571-
cd /home/runner/work/array-api-tests-08-19-22
572-
pytest --ci --json-report array_api_tests/
581+
cd /home/runner/work/array-api-tests
582+
pytest --ci --json-report --json-report-file=$FILE array_api_tests/ || true
573583
- name: Set Github environment variables
574584
shell: bash -l {0}
575585
run: |
576-
PASSED_TESTS=$(jq '.summary | .passed // 0' ~/array-api-tests-08-19-22/.report.json)
577-
echo "PASSED=$PASSED_TESTS" >> $
578-
FAILED_TESTS=$(jq '.summary | .failed // 0' ~/array-api-tests-08-19-22/.report.json)
579-
echo "FAILED=$FAILED_TESTS" >> $GITHUB_ENV
580-
SKIPPED_TESTS=$(jq '.summary | .skipped // 0' ~/array-api-tests-08-19-22/.report.json)
581-
echo "SKIPPED=$SKIPPED_TESTS" >> $GITHUB_ENV
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
582602
- name: Post result to PR
583603
uses: mshick/add-pr-comment@v1
584604
with:
585605
message: |
586-
Array API standard conformance test ran successfully.
587-
Passed: ${{ env.PASSED }}
588-
Failed: ${{ env.FAILED }}
589-
Skipped: ${{ env.SKIPPED }}
590-
allow-repeats: false
606+
${{ env.MESSAGE }}
607+
allow-repeats: true
591608
repo-token: ${{ secrets.GITHUB_TOKEN }}
592609
repo-token-user-login: 'github-actions[bot]'

0 commit comments

Comments
 (0)