Skip to content

Commit fd3a0cb

Browse files
authored
Enable PYPI upload workflow without Windows packages (#239)
* Enable pypi upload in CI/CD
1 parent 9d51439 commit fd3a0cb

File tree

2 files changed

+75
-29
lines changed

2 files changed

+75
-29
lines changed

.github/workflows/build-wheels.yml

Lines changed: 74 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
push:
66
branches:
77
- release-*
8-
- "*wheel*" # must quote since "*" is a YAML reserved character; we want a string
8+
- '*wheel*' # must quote since "*" is a YAML reserved character; we want a string
99
tags:
10-
- "*"
10+
- '*'
1111
pull_request:
1212
branches:
13-
- "*wheel*" # must quote since "*" is a YAML reserved character; we want a string
13+
- '*wheel*' # must quote since "*" is a YAML reserved character; we want a string
1414

1515
jobs:
1616
generate_backwards_compatibility_data:
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Checkout code
2121
uses: actions/checkout@v3
22-
22+
2323
# Based on https://github.com/TileDB-Inc/conda-forge-nightly-controller/blob/51519a0f8340b32cf737fcb59b76c6a91c42dc47/.github/workflows/activity.yml#L19C10-L19C10
2424
- name: Setup git
2525
run: |
@@ -62,48 +62,93 @@ jobs:
6262
GH_TOKEN: ${{ github.token }}
6363

6464
build_wheels:
65-
name: Build wheels on ${{ matrix.os }}
65+
name: Wheel ${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }}
6666
# TODO(paris): Add this back once generate_backwards_compatibility_data is confirmed to work.
6767
# needs: generate_backwards_compatibility_data
68-
runs-on: ${{ matrix.os }}
68+
runs-on: ${{ matrix.buildplat[0] }}
6969
strategy:
7070
matrix:
71-
os: [ubuntu-22.04, macos-12, windows-2022]
72-
# `windows-2022, ` blocked by https://github.com/pybind/pybind11/issues/3445#issuecomment-1525500927
71+
buildplat:
72+
- [ ubuntu-22.04, manylinux_x86_64 ]
73+
- [ macos-13, macosx_x86_64 ]
74+
- [ macos-13, macosx_arm64 ]
75+
# Windows build is currently disabled since the C++ build fails on multiple errors e.g. file manipulation
76+
# and std::filesystem::path implicit to string conversion.
77+
# Follow up task https://app.shortcut.com/tiledb-inc/story/41119/enable-windows-build-for-vector-search-repository
78+
python: [ "cp39", "cp310", "cp311", "cp312", "pp39" ]
79+
exclude:
80+
- buildplat: [ macos-13, macosx_arm64 ]
81+
python: "pp39"
7382

7483
steps:
7584
- uses: actions/checkout@v3
7685

77-
- name: "Brew setup on macOS" # x-ref c8e49ba8f8b9ce
86+
- name: 'Brew setup on macOS' # x-ref c8e49ba8f8b9ce
7887
if: ${{ startsWith(matrix.os, 'macos-') == true }}
7988
run: |
8089
set -e pipefail
81-
brew install automake pkg-config ninja
90+
brew update
91+
brew install automake pkg-config ninja llvm
8292
8393
- name: Build wheels
84-
uses: pypa/[email protected].2
94+
uses: pypa/[email protected].5
8595
env:
86-
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
87-
CIBW_SKIP: "*-win32 cp27-* cp35-* cp36-* cp37-* pp* *_i686 *musllinux*"
88-
CIBW_ARCHS_MACOS: "x86_64 arm64"
8996
CIBW_BUILD_VERBOSITY: 3
97+
CIBW_ENVIRONMENT_MACOS: >
98+
CC=clang
99+
CXX=clang++
90100
MACOSX_DEPLOYMENT_TARGET: "12.0"
101+
CIBW_ARCHS: all
102+
CIBW_PRERELEASE_PYTHONS: True
103+
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
91104
with:
92105
output-dir: wheelhouse
93106

94-
- uses: actions/upload-artifact@v3
107+
- uses: actions/upload-artifact@v4
108+
with:
109+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
110+
path: './wheelhouse/*.whl'
111+
112+
build_sdist:
113+
name: Build source distribution
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v3
117+
118+
- name: Build sdist
119+
run: pipx run build --sdist
120+
121+
- uses: actions/upload-artifact@v4
122+
with:
123+
path: dist/*.tar.gz
124+
125+
126+
upload_pypi:
127+
needs: [build_wheels, build_sdist]
128+
runs-on: ubuntu-latest
129+
environment: pypi
130+
permissions:
131+
id-token: write
132+
outputs:
133+
package_version: ${{ steps.get_package_version.outputs.package_version }}
134+
steps:
135+
- uses: actions/download-artifact@v4
95136
with:
96-
path: ./wheelhouse/*.whl
97-
# TODO: Needs support for pulling in the root directory
98-
# build_sdist:
99-
# name: Build source distribution
100-
# runs-on: ubuntu-latest
101-
# steps:
102-
# - uses: actions/checkout@v3
103-
#
104-
# - name: Build sdist
105-
# run: pipx run build --sdist
106-
#
107-
# - uses: actions/upload-artifact@v3
108-
# with:
109-
# path: dist/*.tar.gz
137+
# unpacks all CIBW artifacts into dist/
138+
pattern: 'cibw-*'
139+
path: dist
140+
merge-multiple: true
141+
142+
- id: get_package_version
143+
run: |
144+
echo "package_version=$(ls dist/ | head -n 1 | cut -d - -f 2)" >> "$GITHUB_OUTPUT"
145+
146+
- name: Upload to test-pypi
147+
if: ${{ github.event_name == 'workflow_dispatch' }}
148+
uses: pypa/gh-action-pypi-publish@release/v1
149+
with:
150+
repository-url: https://test.pypi.org/legacy/
151+
152+
- name: Upload to pypi
153+
if: ${{ github.event_name != 'workflow_dispatch' }}
154+
uses: pypa/gh-action-pypi-publish@release/v1

apis/python/requirements-py.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
numpy==1.24.3
22
tiledb-cloud==0.10.24
33
tiledb==0.25.0
4+
scikit-learn==1.3.2

0 commit comments

Comments
 (0)