name: Build and test wheels on: workflow_dispatch: inputs: version: description: Version to use are release version required: true type: string test_pypi: description: Upload packages to test.pypi.org required: false type: boolean default: false push: tags: - "*" env: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB: ${{ inputs.version }} S3_BUCKET: ${{ vars.S3_BUCKET }} TILEDB_NAMESPACE: ${{ vars.TILEDB_NAMESPACE }} TILEDB_TOKEN: ${{ secrets.TILEDB_TOKEN }} jobs: build_wheels: name: Wheel ${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }} runs-on: ${{ matrix.buildplat[0] }} strategy: matrix: buildplat: - [ubuntu-22.04, manylinux_x86_64] - [macos-13, macosx_x86_64] - [macos-14, macosx_arm64] - [windows-2022, win_amd64] python: ["cp39", "cp310", "cp311", "cp312", "cp313"] steps: - uses: actions/checkout@v4 - name: "Brew setup on macOS" # x-ref c8e49ba8f8b9ce if: ${{ startsWith(matrix.os, 'macos-') == true }} run: | set -e pipefail brew update brew install automake pkg-config ninja llvm - name: Build wheels uses: pypa/cibuildwheel@v2.21.3 env: CIBW_BUILD_VERBOSITY: 3 CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB S3_BUCKET TILEDB_TOKEN TILEDB_NAMESPACE CIBW_ENVIRONMENT_MACOS: > CC=clang CXX=clang++ MACOSX_DEPLOYMENT_TARGET: "11.0" CIBW_ARCHS: all CIBW_PRERELEASE_PYTHONS: True CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} # __init__.py interferes with the tests and is included as local file instead of # used from wheels. To be honest, tests should not be in the source folder at all. CIBW_BEFORE_TEST: rm {project}/tiledb/__init__.py with: output-dir: wheelhouse - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }} path: "./wheelhouse/*.whl" build_sdist: name: Build source distribution runs-on: ubuntu-latest outputs: sdist_name: ${{ steps.get_sdist_name.outputs.sdist_name }} steps: - uses: actions/checkout@v4 - name: Build sdist run: pipx run build --sdist - name: Get sdist package name id: get_sdist_name run: | echo "sdist_name=$(ls dist/ | head -n 1)" >> "$GITHUB_OUTPUT" - uses: actions/upload-artifact@v4 with: name: sdist path: dist/*.tar.gz test_sdist: name: Test source distribution package needs: [build_sdist] strategy: matrix: os: - macos-13 - macos-14 - windows-2022 - ubuntu-22.04 python: ["3.9", "3.10", "3.11", "3.12", "3.13"] runs-on: ${{ matrix.os }} steps: - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Download sdist artifact uses: actions/download-artifact@v4 with: name: sdist path: dist - name: Install sdist artifact run: pip install --verbose dist/${{ needs.build_sdist.outputs.sdist_name }} - uses: actions/checkout@v4 - name: Install test dependencies run: pip install pytest hypothesis psutil pyarrow - name: Run tests shell: bash run: | PROJECT_CWD=$PWD rm tiledb/__init__.py cd .. pytest -vv --showlocals $PROJECT_CWD - name: "Re-run tests without pandas" run: | pip uninstall -y pandas pytest -vv --showlocals $PROJECT_CWD upload_pypi: needs: [build_wheels, test_sdist] runs-on: ubuntu-latest environment: pypi permissions: id-token: write outputs: package_version: ${{ steps.get_package_version.outputs.package_version }} steps: - uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - id: get_package_version run: | echo "package_version=$(ls dist/ | head -n 1 | cut -d - -f 2)" >> "$GITHUB_OUTPUT" - name: Upload to test-pypi if: inputs.test_pypi uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ - name: Upload to pypi if: startsWith(github.ref, 'refs/tags/') uses: pypa/gh-action-pypi-publish@release/v1