-
Notifications
You must be signed in to change notification settings - Fork 33
93 lines (83 loc) · 3.04 KB
/
array-api-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Array API Tests
on:
workflow_call:
inputs:
package-name:
required: true
type: string
module-name:
required: false
type: string
extra-requires:
required: false
type: string
package-version:
required: false
type: string
default: '>= 0'
python-versions:
required: true
type: string
description: JSON array of Python versions to test against.
pytest-extra-args:
required: false
type: string
# This is not how I would prefer to implement this but it's the only way
# that seems possible with GitHub Actions' limited expressions syntax
xfails-file-extra:
required: false
type: string
skips-file-extra:
required: false
type: string
extra-env-vars:
required: false
type: string
description: Multiline string of environment variables to set for the test run.
env:
PYTEST_ARGS: "--max-examples 200 -v -rxXfE --ci ${{ inputs.pytest-extra-args }} --hypothesis-disable-deadline --durations 10"
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(inputs.python-versions) }}
steps:
- name: Checkout array-api-compat
uses: actions/checkout@v4
with:
path: array-api-compat
- name: Checkout array-api-tests
uses: actions/checkout@v4
with:
repository: data-apis/array-api-tests
submodules: 'true'
path: array-api-tests
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set Extra Environment Variables
# Set additional environment variables if provided
if: inputs.extra-env-vars
run: |
echo "${{ inputs.extra-env-vars }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '${{ inputs.package-name }} ${{ inputs.package-version }}' ${{ inputs.extra-requires }}
python -m pip install -r ${GITHUB_WORKSPACE}/array-api-tests/requirements.txt
- name: Dump pip environment
run: pip freeze
- name: Run the array API testsuite (${{ inputs.package-name }})
env:
ARRAY_API_TESTS_MODULE: array_api_compat.${{ inputs.module-name || inputs.package-name }}
ARRAY_API_TESTS_VERSION: 2024.12
# This enables the NEP 50 type promotion behavior (without it a lot of
# tests fail on bad scalar type promotion behavior)
NPY_PROMOTION_STATE: weak
run: |
export PYTHONPATH="${GITHUB_WORKSPACE}/array-api-compat"
cd ${GITHUB_WORKSPACE}/array-api-tests
pytest array_api_tests/ --xfails-file ${GITHUB_WORKSPACE}/array-api-compat/${{ inputs.package-name }}${{ inputs.xfails-file-extra }}-xfails.txt --skips-file ${GITHUB_WORKSPACE}/array-api-compat/${{ inputs.package-name }}${{ inputs.skips-file-extra}}-skips.txt ${PYTEST_ARGS}