@@ -12,83 +12,98 @@ concurrency:
1212 cancel-in-progress : true
1313
1414env :
15+ UV_LOCKED : 1
1516 # Many color libraries just need this to be set to any value, but at least
1617 # one distinguishes color depth, where "3" -> "256-bit color".
1718 FORCE_COLOR : 3
1819
1920jobs :
20- format :
21- name : Format
21+ lint :
22+ name : lint
2223 runs-on : ubuntu-latest
2324 steps :
24- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
25+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2526
2627 - name : Install uv
27- uses : astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba
28+ uses : astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
2829
29- - name : Install the project
30- run : uv sync --locked --group test
30+ - name : ruff
31+ run : |
32+ uv run ruff check --output-format=github
33+ uv run ruff format --check
3134
32- - name : Run lefthook hooks
33- run : uv run --frozen lefthook run pre-commit
35+ # TODO: Fail if lefthook changes any files:
36+ # https://github.com/data-apis/array-api-typing/pull/35/files#r2179941334
37+ - name : lefthook
38+ run : uv run lefthook run pre-commit
3439
35- checks :
36- name : Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
40+ - name : mypy
41+ run : uv run mypy --tb --no-incremental --cache-dir=/dev/null src
42+
43+ # TODO: (based)pyright
44+
45+ test_runtime :
46+ name : runtime tests
3747 runs-on : ${{ matrix.runs-on }}
38- needs : [format]
3948 strategy :
4049 fail-fast : false
4150 matrix :
4251 python-version : ["3.11", "3.12", "3.13"]
4352 runs-on : [ubuntu-latest, macos-latest, windows-latest]
4453
4554 steps :
46- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
55+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4756
4857 - name : Install uv
49- uses : astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba
58+ uses : astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
5059 with :
5160 python-version : ${{ matrix.python-version }}
5261
53- - name : Install the project
54- run : uv sync --locked --group test
55-
5662 - name : Test package
5763 run : >-
58- uv run --frozen pytest
59- --cov --cov-report=xml --cov-report=term --durations=20
64+ uv run --group=test_runtime
65+ pytest --cov --cov-report=xml --cov-report=term --durations=20
6066
6167 - name : Upload coverage report
62- uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
68+ uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
6369 with :
6470 token : ${{ secrets.CODECOV_TOKEN }}
6571
66- check_oldest :
67- name : Check Oldest Dependencies
68- runs-on : ${{ matrix.runs-on }}
69- needs : [format]
72+ test_integration_numpy :
73+ name : integration tests (numpy)
74+ runs-on : ubuntu-latest
7075 strategy :
7176 fail-fast : false
7277 matrix :
73- python-version : ["3.11"]
74- runs-on : [ubuntu-latest]
78+ numpy-version : ["1.25.0", "1.26.4", "2.0.2", "2.1.3", "2.2.6", "2.3.1"]
7579
7680 steps :
77- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
78-
79- - name : Install uv
80- uses : astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba
81- with :
82- python-version : ${{ matrix.python-version }}
83- - name : Install the project
84- run : uv sync --group test --resolution lowest-direct
81+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8582
86- - name : Test package
87- run : >-
88- uv run --frozen pytest
89- --cov --cov-report=xml --cov-report=term --durations=20
90-
91- - name : Upload coverage report
92- uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
83+ - uses : astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6.3.1
9384 with :
94- token : ${{ secrets.CODECOV_TOKEN }}
85+ python-version : " 3.11"
86+ activate-environment : true
87+
88+ - name : get major numpy version
89+ id : numpy-major
90+ run : |
91+ version=$(echo ${{ matrix.numpy-version }} | cut -c 1)
92+ echo "::set-output name=version::$version"
93+
94+ - name : install deps
95+ run : |
96+ uv sync --no-editable --group=mypy
97+ uv pip install numpy==${{ matrix.numpy-version }}
98+
99+ # NOTE: `uv run --with=...` will be ignored by mypy (and `--isolated` does not help)
100+ - name : mypy
101+ run : >
102+ uv run --no-sync --active
103+ mypy --tb --no-incremental --cache-dir=/dev/null
104+ tests/integration/test_numpy${{ steps.numpy-major.outputs.version }}.pyi
105+
106+ # TODO: (based)pyright
107+
108+ # TODO: integration tests for array-api-strict
109+ # TODO: integration tests for 3rd party libs such as cupy, pytorch, tensorflow, dask, etc.
0 commit comments