Skip to content

Some PyTorch fixes

Some PyTorch fixes #47

Workflow file for this run

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'
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: 'Extra environment variables to set during the test run'
env:
PYTEST_ARGS: "--max-examples 200 -v -rxXfE --ci ${{ inputs.pytest-extra-args }} --hypothesis-disable-deadline"
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
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: Install dependencies
# NumPy 1.21 doesn't support Python 3.11. There doesn't seem to be a way
# to put this in the numpy 1.21 config file.
if: "! ((matrix.python-version == '3.11' || matrix.python-version == '3.12') && inputs.package-name == 'numpy' && contains(inputs.package-version, '1.21'))"
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: Run the array API testsuite (${{ inputs.package-name }})
if: "! ((matrix.python-version == '3.11' || matrix.python-version == '3.12') && inputs.package-name == 'numpy' && contains(inputs.package-version, '1.21'))"
env:
ARRAY_API_TESTS_MODULE: array_api_compat.${{ inputs.module-name || inputs.package-name }}
# 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
${{ inputs.extra-env-vars }}

Check failure on line 74 in .github/workflows/array-api-tests.yml

View workflow run for this annotation

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

Invalid workflow file

You have an error in your yaml syntax on line 74
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}