Skip to content

Commit 0db034d

Browse files
committed
Make the GitHub Actions workflow reusable so that we can test pytorch
1 parent 1ffcb15 commit 0db034d

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Array API Tests (NumPy)
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
call-workflow-passing-data:
7+
uses: ./github/workflows/array-api-tests.yml
8+
with:
9+
package-name: numpy
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Array API Tests (PyTorch)
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
call-workflow-passing-data:
7+
uses: ./github/workflows/array-api-tests.yml
8+
with:
9+
package-name: torch

.github/workflows/array-api-tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Array API Tests
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_call:
5+
inputs:
6+
package-name:
7+
required: true
8+
type: string
49

510
env:
611
PYTEST_ARGS: "--max-examples 200 -v -rxXfE --ci"
@@ -34,15 +39,15 @@ jobs:
3439
- name: Install dependencies
3540
run: |
3641
python -m pip install --upgrade pip
37-
python -m pip install numpy
42+
python -m pip install {{ inputs.package-name }}
3843
python -m pip install -r ${GITHUB_WORKSPACE}/array-api-tests/requirements.txt
39-
- name: Run the array API testsuite (NumPy)
44+
- name: Run the array API testsuite ({{ inputs.package-name }})
4045
env:
41-
ARRAY_API_TESTS_MODULE: array_api_compat.numpy
46+
ARRAY_API_TESTS_MODULE: array_api_compat.{{ inputs.package-name }}
4247
# This enables the NEP 50 type promotion behavior (without it a lot of
4348
# tests fail on bad scalar type promotion behavior)
4449
NPY_PROMOTION_STATE: weak
4550
run: |
4651
export PYTHONPATH="${GITHUB_WORKSPACE}/array-api-compat"
4752
cd ${GITHUB_WORKSPACE}/array-api-tests
48-
pytest ${PYTEST_ARGS} --xfails-file ${GITHUB_WORKSPACE}/array-api-compat/numpy-xfails.txt array_api_tests/
53+
pytest ${PYTEST_ARGS} --xfails-file ${GITHUB_WORKSPACE}/array-api-compat/{{ inputs.package-name }}-xfails.txt array_api_tests/
File renamed without changes.

0 commit comments

Comments
 (0)