Skip to content

Commit 37980dd

Browse files
committed
add CI for eudsl-python-extras
1 parent 87f45a0 commit 37980dd

File tree

4 files changed

+160
-9
lines changed

4 files changed

+160
-9
lines changed

.github/workflows/build_mlir_python_bindings_wheel.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ on:
2222
paths:
2323
- ".github/workflows/build_mlir_python_bindings_wheel.yml"
2424
- "projects/mlir-python-bindings/**"
25+
- "projects/eudsl-python-extras/**"
2526
- "third_party/llvm-project"
2627
push:
2728
branches:
2829
- main
2930
paths:
3031
- ".github/workflows/build_mlir_python_bindings_wheel.yml"
3132
- "projects/mlir-python-bindings/**"
33+
- "projects/eudsl-python-extras/**"
3234
- "third_party/llvm-project"
3335

3436
concurrency:
@@ -377,3 +379,139 @@ jobs:
377379
replacesArtifacts: true
378380
makeLatest: true
379381
omitBody: true
382+
383+
build-eudsl-python-extras:
384+
385+
runs-on: ubuntu-22.04
386+
387+
name: "Build eudsl-python-extras sdist"
388+
389+
defaults:
390+
run:
391+
shell: bash
392+
393+
steps:
394+
- name: "Check out repository"
395+
uses: actions/[email protected]
396+
with:
397+
submodules: false
398+
399+
- name: "Install Python"
400+
uses: actions/[email protected]
401+
with:
402+
python-version: "3.12"
403+
404+
- name: "Install prereqs"
405+
run: python -m pip install setuptools
406+
407+
- name: "Build eudsl-python-extras sdist"
408+
run: pushd projects/eudsl-python-extras && python setup.py sdist && popd
409+
410+
- name: Upload eudsl-python-extras sdist
411+
uses: actions/upload-artifact@v4
412+
with:
413+
path: projects/eudsl-python-extras/dist/*.tar.gz
414+
name: eudsl_python_extras_sdist_artifact
415+
416+
test-eudsl-python-extras:
417+
418+
needs: [build-eudsl-python-extras, build-mlir-python-bindings]
419+
420+
strategy:
421+
fail-fast: false
422+
matrix:
423+
runs-on: [
424+
"ubuntu-22.04",
425+
"ubuntu-22.04-arm",
426+
"macos-13",
427+
"macos-14",
428+
"windows-2022"
429+
]
430+
python-version: [
431+
# "3.10", "3.11", "3.12",
432+
"3.13", "3.14", "3.14t"
433+
]
434+
include: [
435+
{runs-on: "ubuntu-22.04", name: "ubuntu_x86_64", os: "ubuntu"},
436+
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
437+
{runs-on: "windows-2022", name: "windows_x86_64", os: "windows"},
438+
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
439+
{runs-on: "macos-13", name: "macos_x86_64", os: "macos"}
440+
]
441+
exclude:
442+
# <frozen importlib._bootstrap>:491: Warning: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for testing. You are advised not to use it for production.
443+
- runs-on: windows-2022
444+
python-version: "3.14"
445+
446+
- runs-on: windows-2022
447+
python-version: "3.14t"
448+
449+
runs-on: ${{ matrix.runs-on }}
450+
451+
name: "Test eudsl-python-extras ${{ matrix.name }} ${{ matrix.python-version }}"
452+
453+
defaults:
454+
run:
455+
shell: bash
456+
457+
steps:
458+
- name: "Check out repository"
459+
uses: actions/[email protected]
460+
with:
461+
submodules: false
462+
463+
- name: "Install Python"
464+
uses: actions/[email protected]
465+
with:
466+
python-version: "${{ matrix.python-version }}"
467+
468+
- uses: actions/download-artifact@v4
469+
with:
470+
name: mlir_python_bindings_${{ matrix.name }}_artifact
471+
path: wheelhouse
472+
473+
- uses: actions/download-artifact@v4
474+
with:
475+
name: eudsl_python_extras_sdist_artifact
476+
path: dist
477+
478+
- name: "Install mlir-python-bindings"
479+
run: python -m pip install mlir-python-bindings -f wheelhouse
480+
481+
- name: "Install eudsl-python-extras"
482+
run: python -m pip install dist/eudsl_python_extras*.tar.gz
483+
484+
- name: "Test eudsl-python-extras"
485+
run: python -m pytest projects/eudsl-python-extras/tests
486+
487+
release-eudsl-python-extras:
488+
489+
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
490+
needs: [test-eudsl-python-extras]
491+
runs-on: "ubuntu-22.04"
492+
493+
permissions:
494+
id-token: write
495+
contents: write
496+
497+
name: "Release eudsl-python-extras"
498+
499+
steps:
500+
501+
- uses: actions/download-artifact@v4
502+
with:
503+
name: eudsl_python_extras_sdist_artifact
504+
path: dist
505+
506+
- name: Release current commit
507+
uses: ncipollo/[email protected]
508+
with:
509+
artifacts: "dist/eudsl_python_extras*.tar.gz"
510+
token: "${{ secrets.GITHUB_TOKEN }}"
511+
tag: eudsl-python-extras
512+
name: eudsl-python-extras
513+
removeArtifacts: false
514+
allowUpdates: true
515+
replacesArtifacts: true
516+
makeLatest: true
517+
omitBody: true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# So that it's included in the sdist and can be found by setup.py
2+
# when users install the sdist.
3+
include requirements.txt
4+
prune tests
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PyYAML>=5.4.0
2+
bytecode @ git+https://github.com/MatthieuDartiailh/bytecode
3+
cloudpickle>=3.0.0
4+
numpy>=1.19.5, <=2.1.2

projects/eudsl-python-extras/setup.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,32 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
import os
6+
from pathlib import Path
67

78
from pip._internal.req import parse_requirements
89
from setuptools import find_namespace_packages, find_packages
910
from setuptools import setup
1011

1112
# By setting this env variable during install, this package (a namespace package)
12-
# can "squat" in some host bindings namespace.
13-
HOST_MLIR_PYTHON_PACKAGE_PREFIX = os.environ.get(
14-
"HOST_MLIR_PYTHON_PACKAGE_PREFIX", "mlir"
13+
# can "squat" in some host bindings namespace. Note, this DOES work even for nested
14+
# packages like EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=foo.bar (extras will be installed into foo/bar/extras).
15+
EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX = os.environ.get(
16+
"EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX", "mlir"
1517
)
1618

19+
HERE = Path(__file__).parent
20+
1721

1822
def load_requirements(fname):
1923
reqs = parse_requirements(fname, session="hack")
2024
return [str(ir.requirement) for ir in reqs]
2125

2226

2327
packages = (
24-
[HOST_MLIR_PYTHON_PACKAGE_PREFIX]
25-
+ [f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}.extras"]
28+
[EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX]
29+
+ [f"{EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX}.extras"]
2630
+ [
27-
f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}.extras.{p}"
31+
f"{EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX}.extras.{p}"
2832
for p in find_namespace_packages(where="mlir/extras")
2933
+ find_packages(where="mlir/extras")
3034
]
@@ -35,15 +39,16 @@ def load_requirements(fname):
3539
version="0.1.0",
3640
description="The missing pieces (as far as boilerplate reduction goes) of the upstream MLIR python bindings.",
3741
license="LICENSE",
38-
install_requires=load_requirements("requirements.txt"),
42+
install_requires=load_requirements(str(HERE / "requirements.txt")),
3943
extras_require={
4044
"test": ["pytest", "mlir-native-tools", "astpretty"],
4145
"mlir": ["mlir-python-bindings"],
4246
},
4347
python_requires=">=3.8",
48+
include_package_data=True,
4449
packages=packages, # lhs is package namespace, rhs is path (relative to this setup.py)
4550
package_dir={
46-
f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}": "mlir",
47-
f"{HOST_MLIR_PYTHON_PACKAGE_PREFIX}.extras": "mlir/extras",
51+
f"{EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX}": "mlir",
52+
f"{EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX}.extras": "mlir/extras",
4853
},
4954
)

0 commit comments

Comments
 (0)