Skip to content

Commit

Permalink
Add wheel test step
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsokol committed Oct 28, 2024
1 parent f1a7d2f commit 4e71cdc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 93 deletions.
53 changes: 6 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
build-wheel:
strategy:
matrix:
os: ['ubuntu-24.04', 'macos-12', 'macos-14'] #'macos-13', 'windows-2022'
os: ['ubuntu-24.04', 'macos-12', 'macos-14'] # TODO: 'windows-2022'
arch: ['x86_64', 'aarch64']
python: ['3.10'] # , '3.11', '3.12'
python: ['3.10']
exclude:
- os: 'ubuntu-24.04' # needs qemu setup
- os: 'ubuntu-24.04' # TODO: needs qemu setup
arch: 'aarch64'
- os: 'macos-12'
arch: 'aarch64'
Expand Down Expand Up @@ -57,15 +57,14 @@ jobs:
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }}
max-size: "1G"
max-size: "2G"
verbose: 2
variant: ccache

- name: Configure ccache
- name: Configure ccache - ubuntu & macos
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
shell: bash
run: |
if [ x"${{ contains(matrix.os, 'macos') }}" == x"true" ]; then
echo "/usr/local/opt/ccache/libexec:/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
else
Expand All @@ -75,25 +74,12 @@ jobs:
- name: Configure ccache
shell: bash
run: |
ccache -p
ccache -z
# See https://github.com/hendrikmuhs/ccache-action/issues/146
ccache --set-config=compiler_check=content
ccache --set-config=sloppiness=locale,time_macros
# - name: Setup env
# uses: mamba-org/setup-micromamba@v2
# with:
# environment-file: Finch-mlir/ci/environment.yml
# init-shell: >-
# bash
# cache-environment: true
# cache-downloads: true
# post-cleanup: 'all'
# create-args: >-
# python=${{ matrix.python }}

- name: pip install standard tools
shell: bash
run: pip install cibuildwheel wheel
Expand All @@ -102,47 +88,24 @@ jobs:
run: |
echo "HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"" >> $GITHUB_ENV
- name: set ENV macos
- name: set env variables - macos
if: contains(matrix.os, 'macos')
shell: bash
run: |
echo "MACOSX_DEPLOYMENT_TARGET=11.0" | tee -a $GITHUB_ENV
# - name: Build wheel
# run: |
# cp Finch-mlir/setup.py .
# python -m build --wheel

# - name: Install cross-compilation toolchain
# shell: bash
# if: ${{ inputs.MATRIX_OS == 'ubuntu-24.04' && inputs.MATRIX_ARCH == 'aarch64' }}
# run: |

# sudo apt-get update
# sudo apt-get install -y binutils-aarch64-linux-gnu \
# g++-aarch64-linux-gnu gcc-aarch64-linux-gnu

# - name: Set up QEMU
# if: ${{ matrix.os == 'ubuntu-24.04' && matrix.arch == 'aarch64' }}
# uses: docker/setup-qemu-action@v2
# with:
# platforms: ${{ matrix.arch }}

- name: cibuildwheel run
run: |
mv ./Finch-mlir/setup.py .
mv ./Finch-mlir/requirements.txt .
mv ./Finch-mlir/pyproject.toml .
cibuildwheel --output-dir ./wheelhouse
- name: Download cache from container ubuntu
if: (matrix.os == 'ubuntu-24.04' && matrix.arch == 'x86_64') && (success() || failure())
#working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}
run: |
ccache -s
rm -rf $HOST_CCACHE_DIR
mv ./wheelhouse/.ccache $HOST_CCACHE_DIR
# shouldn't be /output/.ccache?
ls -la $HOST_CCACHE_DIR
ccache -s
Expand All @@ -152,10 +115,6 @@ jobs:
path: wheelhouse/*.whl
name: artifact_finch_mlir-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }}

# TODO: run pydata/sparse MLIR tests
# run-tests:
# ...

release-wheel:
runs-on: 'ubuntu-latest'
needs: build-wheel
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)

set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")

# https://github.com/iree-org/iree/blob/c96372348654eea8548509d38df5c8e8b179aef3/CMakeLists.txt#L275-L280
find_package(Python3 COMPONENTS Interpreter Development)
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)

Expand Down
12 changes: 0 additions & 12 deletions ci/environment.yml

This file was deleted.

46 changes: 12 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,33 @@ requires = [
"numpy",
"PyYAML",
]
#build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build-verbosity = 1
# manylinux-aarch64-image = "manylinux_2_28"
# manylinux-x86_64-image = "sameli/manylinux_2_28_x86_64_cuda_12.3"
test-requires = [
"pytest",
"pytest-cov",
"PyYAML",
"scipy",
"sparse@git+https://github.com/pydata/sparse@updated-llvm-nightly-test"
]
test-command = "SPARSE_BACKEND=MLIR pytest --pyargs sparse.mlir_backend"

[tool.cibuildwheel.linux]
build = "cp310-* cp311-* cp312-*"
skip = ["*-manylinux_i686", "*-musllinux*"]
environment = { PATH = "/usr/lib/ccache:/usr/lib64/ccache:/usr/lib/ccache/bin:$PATH" }
before-build = [
"pip install -r requirements.txt",
"pip install -r {project}/Finch-mlir/requirements/requirements.txt",
"{project}/Finch-mlir/scripts/docker_prepare_ccache.sh"
]
environment-pass = [
# "CIBW_ARCHS",
"HOST_CCACHE_DIR",
]
# environment-pass = [
# "APPLY_PATCHES",
# "BUILD_CUDA",
# "BUILD_AMDGPU",
# "BUILD_OPENMP",
# "BUILD_VULKAN",
# "CIBW_ARCHS",
# "CMAKE_ARGS",
# "CMAKE_GENERATOR",
# "DATETIME",
# "DEBUG_CI_FAST_BUILD",
# "HOST_CCACHE_DIR",
# "LLVM_PROJECT_COMMIT",
# "MATRIX_OS",
# "MLIR_LIT_PYTHONPATH",
# "PARALLEL_LEVEL",
# "PIP_FIND_LINKS",
# "PIP_NO_BUILD_ISOLATION",
# "RUN_TESTS",
# "USE_CMAKE_NAMESPACES",
# ]
# repair-wheel-command = [
# "auditwheel repair -w {dest_dir} {wheel} --exclude libcuda.so.1 --exclude libvulkan.so.1 --exclude libomp.so --exclude libompd.so"
# ]
environment-pass = ["HOST_CCACHE_DIR"]

[tool.cibuildwheel.macos]
build = "cp310-* cp311-* cp312-*"
environment = { PATH = "/usr/local/opt/ccache/libexec:$PATH" }
before-build = [
"pip install -r requirements.txt",
"pip install -r {project}/Finch-mlir/requirements/requirements.txt",
]
repair-wheel-command = [
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --ignore-missing-dependencies"
Expand All @@ -66,5 +44,5 @@ repair-wheel-command = [
build = "cp310-* cp311-* cp312-*"
before-build = [
"pip install delvewheel",
"pip install -r requirements.txt",
"pip install -r {project}/Finch-mlir/requirements/requirements.txt",
]
File renamed without changes.
5 changes: 5 additions & 0 deletions requirements/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pytest
pytest-cov
PyYAML
scipy
sparse @ git+https://github.com/pydata/sparse@updated-llvm-nightly-test

0 comments on commit 4e71cdc

Please sign in to comment.