|
| 1 | +name: Build TsFile wheels(multi-platform) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "release_v*.*.*" |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - "cpp/**" |
| 10 | + - "python/**" |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build wheels on ${{ matrix.name }} |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - name: linux-x86_64 |
| 22 | + os: ubuntu-22.04 |
| 23 | + platform: linux |
| 24 | + cibw_archs_linux: "x86_64" |
| 25 | + |
| 26 | + - name: linux-aarch64 |
| 27 | + os: ubuntu-22.04-arm |
| 28 | + platform: linux |
| 29 | + cibw_archs_linux: "aarch64" |
| 30 | + |
| 31 | + - name: macos-x86_64 |
| 32 | + os: macos-13 |
| 33 | + platform: macos |
| 34 | + cibw_archs_macos: "x86_64" |
| 35 | + |
| 36 | + - name: macos-arm64 |
| 37 | + os: macos-14 |
| 38 | + platform: macos |
| 39 | + cibw_archs_macos: "arm64" |
| 40 | +# currently, compile on windows is not supported for cibuildwheel |
| 41 | +# - name: windows-amd64 |
| 42 | +# os: windows-2022 |
| 43 | +# platform: windows |
| 44 | +# cibw_archs_windows: "AMD64" |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + submodules: false |
| 51 | + fetch-depth: 0 |
| 52 | + |
| 53 | + - name: Set up Python |
| 54 | + uses: actions/setup-python@v4 |
| 55 | + with: |
| 56 | + python-version: "3.11" |
| 57 | + |
| 58 | + - name: Set up Java 17 |
| 59 | + uses: actions/setup-java@v4 |
| 60 | + with: |
| 61 | + distribution: temurin |
| 62 | + java-version: "17" |
| 63 | + |
| 64 | + - name: Install system deps (macOS) |
| 65 | + if: matrix.platform == 'macos' |
| 66 | + run: | |
| 67 | + set -eux |
| 68 | + brew update |
| 69 | + brew install pkg-config || true |
| 70 | +
|
| 71 | + - name: Install build tools |
| 72 | + run: | |
| 73 | + python -m pip install -U pip wheel |
| 74 | + python -m pip install cibuildwheel==2.21.3 |
| 75 | +
|
| 76 | +# - name: Build C++ core via Maven(win) |
| 77 | +# if: matrix.platform == 'windows' |
| 78 | +# shell: bash |
| 79 | +# run: | |
| 80 | +# set -euxo pipefail |
| 81 | +# chmod +x mvnw || true |
| 82 | +# ./mvnw -Pwith-cpp clean verify package \ |
| 83 | +# -DskipTests -Dspotless.check.skip=true -Dspotless.apply.skip=true |
| 84 | +# test -d cpp/target/build/lib |
| 85 | +# test -d cpp/target/build/include |
| 86 | + |
| 87 | + - name: Build C++ core via Maven (macOS) |
| 88 | + if: matrix.platform == 'macos' |
| 89 | + shell: bash |
| 90 | + env: |
| 91 | + MACOSX_DEPLOYMENT_TARGET: "12.0" |
| 92 | + CFLAGS: "-mmacosx-version-min=12.0" |
| 93 | + CXXFLAGS: "-mmacosx-version-min=12.0" |
| 94 | + LDFLAGS: "-mmacosx-version-min=12.0" |
| 95 | + run: | |
| 96 | + set -euxo pipefail |
| 97 | + chmod +x mvnw || true |
| 98 | + ./mvnw -Pwith-cpp clean verify package \ |
| 99 | + -DskipTests -Dspotless.check.skip=true -Dspotless.apply.skip=true \ |
| 100 | + -Dcmake.args="-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0" |
| 101 | + otool -l cpp/target/build/lib/libtsfile*.dylib | grep -A2 LC_VERSION_MIN_MACOSX || true |
| 102 | + |
| 103 | + - name: Build wheels via cibuildwheel |
| 104 | + if: matrix.platform != 'macos' |
| 105 | + env: |
| 106 | + CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} |
| 107 | +# CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }} |
| 108 | + |
| 109 | + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*" |
| 110 | + CIBW_SKIP: "pp* *-musllinux*" |
| 111 | + |
| 112 | + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" |
| 113 | + CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014" |
| 114 | + |
| 115 | + MACOSX_DEPLOYMENT_TARGET: "12.0" |
| 116 | + |
| 117 | + CIBW_BEFORE_ALL_LINUX: | |
| 118 | + set -euxo pipefail |
| 119 | + if command -v yum >/dev/null 2>&1; then |
| 120 | + yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel |
| 121 | + else |
| 122 | + echo "Not a yum-based image?" ; exit 1 |
| 123 | + fi |
| 124 | + ARCH="$(uname -m)" |
| 125 | + mkdir -p /opt/java |
| 126 | + if [ "$ARCH" = "x86_64" ]; then |
| 127 | + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" |
| 128 | + else |
| 129 | + # aarch64 |
| 130 | + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" |
| 131 | + fi |
| 132 | + curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" |
| 133 | + tar -xzf /tmp/jdk17.tar.gz -C /opt/java |
| 134 | + export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) |
| 135 | + export PATH="$JAVA_HOME/bin:$PATH" |
| 136 | + java -version |
| 137 | +
|
| 138 | + chmod +x mvnw || true |
| 139 | + ./mvnw -Pwith-cpp clean verify package \ |
| 140 | + -DskipTests -Dspotless.check.skip=true -Dspotless.apply.skip=true |
| 141 | + test -d cpp/target/build/lib && test -d cpp/target/build/include |
| 142 | + |
| 143 | + CIBW_TEST_COMMAND: > |
| 144 | + python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" |
| 145 | + CIBW_BUILD_VERBOSITY: "1" |
| 146 | + run: cibuildwheel --output-dir wheelhouse python |
| 147 | + |
| 148 | + - name: Build wheels via cibuildwheel (macOS) |
| 149 | + if: matrix.platform == 'macos' |
| 150 | + env: |
| 151 | + CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs_macos }} |
| 152 | + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*" |
| 153 | +# CIBW_BUILD: "cp313-*" |
| 154 | + CIBW_SKIP: "pp*" |
| 155 | + CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=12.0" |
| 156 | + MACOSX_DEPLOYMENT_TARGET: "12.0" |
| 157 | + CIBW_TEST_COMMAND: > |
| 158 | + python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" |
| 159 | + CIBW_BUILD_VERBOSITY: "1" |
| 160 | + run: cibuildwheel --output-dir wheelhouse python |
| 161 | + |
| 162 | + - name: Upload wheels as artifact |
| 163 | + uses: actions/upload-artifact@v4 |
| 164 | + with: |
| 165 | + name: tsfile-wheels-${{ matrix.name }} |
| 166 | + path: wheelhouse/*.whl |
| 167 | + |
| 168 | + |
0 commit comments