Skip to content

Commit 067649b

Browse files
committed
Add workflow for python release.
1 parent 2afaa97 commit 067649b

File tree

14 files changed

+406
-169
lines changed

14 files changed

+406
-169
lines changed

.github/workflows/unit-test-cpp.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,16 @@ jobs:
104104
core.setOutput('platform_suffix', ``)
105105
}
106106
107-
- name: Install clang-format
107+
- name: Install dependencies
108108
shell: bash
109109
run: |
110110
if [[ "$RUNNER_OS" == "Linux" ]]; then
111+
if command -v apt-get >/dev/null 2>&1; then
112+
sudo apt-get update
113+
sudo apt-get install -y uuid-dev
114+
elif command -v yum >/dev/null 2>&1; then
115+
sudo yum install -y libuuid-devel
116+
fi
111117
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100
112118
sudo update-alternatives --set clang-format /usr/bin/clang-format-17
113119
elif [[ "$RUNNER_OS" == "Windows" ]]; then

.github/workflows/unit-test-python.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ jobs:
6060
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
6161
restore-keys: ${{ runner.os }}-m2-
6262

63+
- name: Install dependencies
64+
shell: bash
65+
run: |
66+
if [[ "$RUNNER_OS" == "Linux" ]]; then
67+
if command -v apt-get >/dev/null 2>&1; then
68+
sudo apt-get update
69+
sudo apt-get install -y uuid-dev
70+
elif command -v yum >/dev/null 2>&1; then
71+
sudo yum install -y libuuid-devel
72+
fi
73+
fi
6374
# On Windows systems the 'mvnw' script needs an additional ".cmd" appended.
6475
- name: Calculate platform suffix
6576
id: platform_suffix

.github/workflows/wheels.yml

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

cpp/pom.xml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -151,39 +151,6 @@
151151
</plugins>
152152
</build>
153153
<profiles>
154-
<profile>
155-
<id>linux-install-uuid-dev</id>
156-
<activation>
157-
<os>
158-
<family>unix</family>
159-
<name>Linux</name>
160-
</os>
161-
</activation>
162-
<build>
163-
<plugins>
164-
<plugin>
165-
<groupId>org.codehaus.mojo</groupId>
166-
<artifactId>exec-maven-plugin</artifactId>
167-
<executions>
168-
<execution>
169-
<id>install-uuid-dev</id>
170-
<phase>validate</phase>
171-
<goals>
172-
<goal>exec</goal>
173-
</goals>
174-
</execution>
175-
</executions>
176-
<configuration>
177-
<executable>bash</executable>
178-
<arguments>
179-
<argument>-c</argument>
180-
<argument>sudo apt-get update &amp;&amp; sudo apt-get install -y uuid-dev</argument>
181-
</arguments>
182-
</configuration>
183-
</plugin>
184-
</plugins>
185-
</build>
186-
</profile>
187154
<!-- When running on jenkins, download the sonar build-wrapper, so we can do a code analysis -->
188155
<profile>
189156
<id>jenkins-build</id>

cpp/src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ set(ANTLR4_WITH_STATIC_CRT OFF)
3636
set(PROJECT_INCLUDE_DIR
3737
${CMAKE_SOURCE_DIR}/src
3838
${THIRD_PARTY_INCLUDE}/google_snappy
39+
${THIRD_PARTY_INCLUDE}/zlib-1.2.13
3940
${CMAKE_SOURCE_DIR}/third_party/lz4
4041
${CMAKE_SOURCE_DIR}/third_party/lzokay
4142
${CMAKE_SOURCE_DIR}/third_party/zlib-1.2.13

cpp/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ include_directories(
8080
${LIBRARY_INCLUDE_DIR}
8181
${THIRD_PARTY_INCLUDE}
8282
${THIRD_PARTY_INCLUDE}/google_snappy
83+
${THIRD_PARTY_INCLUDE}/zlib-1.2.13
8384
${CMAKE_SOURCE_DIR}/third_party/lz4
8485
${CMAKE_SOURCE_DIR}/third_party/google_snappy
8586
${CMAKE_SOURCE_DIR}/third_party/lzokay

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@
135135
<exclude>**/tsfile.egg-info/**</exclude>
136136
<!-- Exclude third_party-->
137137
<exclude>**/third_party/**</exclude>
138+
<exclude>**/.python-version</exclude>
139+
<exclude>**/**venv-py**/**</exclude>
138140
</excludes>
139141
</configuration>
140142
</plugin>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
20+
-->
21+
22+
## Build on local
23+
24+
## Build on docker
25+
26+
## Build for release
27+
28+
## Release TsFile to Pypi and Conda

python/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@
9090
</arguments>
9191
</configuration>
9292
</execution>
93+
<execution>
94+
<id>python-install-wheel</id>
95+
<phase>validate</phase>
96+
<goals>
97+
<goal>exec</goal>
98+
</goals>
99+
<configuration>
100+
<executable>${python.venv.bin}${python.exe.bin}</executable>
101+
<arguments>
102+
<argument>-m</argument>
103+
<argument>pip</argument>
104+
<argument>install</argument>
105+
<argument>--only-binary=:all:</argument>
106+
<argument>--no-deps</argument>
107+
<argument>${project.basedir}/dist/tsfile-*.whl</argument>
108+
</arguments>
109+
</configuration>
110+
</execution>
93111
<execution>
94112
<id>compile-python-code</id>
95113
<phase>compile</phase>

python/pyproject.toml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
19+
[build-system]
20+
requires = [
21+
"setuptools>=69",
22+
"wheel",
23+
"Cython>=3",
24+
"numpy>=1.20"
25+
]
26+
27+
build-backend = "setuptools.build_meta"
28+
29+
[project]
30+
name = "tsfile"
31+
version = "2.1.2"
32+
requires-python = ">=3.9"
33+
description = "TsFile Python"
34+
readme = {file = "README.md", content-type = "text/markdown"}
35+
maintainers = [
36+
{name = "Apache TsFile Developers", email = "[email protected]"}
37+
]
38+
dependencies = [
39+
"numpy>=1.20",
40+
"pandas>=2.0"
41+
]
42+
43+
[project.urls]
44+
Homepage = "https://tsfile.apache.org/"
45+
Documentation = "https://tsfile.apache.org/zh/UserGuide/latest/QuickStart/Navigating_Time_Series_Data.html"
46+
Repository = "https://github.com/apache/tsfile"
47+
Issues = "https://github.com/apache/tsfile/issues"
48+
49+
[tool.setuptools]
50+
package-dir = {"" = "."}
51+
52+
[tool.setuptools.packages.find]
53+
where = ["."]
54+
include = ["tsfile*"]
55+
56+
[tool.setuptools.package-data]
57+
tsfile = [
58+
"*.pxd",
59+
"*.pxi",
60+
"*.so",
61+
"*.so.*",
62+
"*.dylib",
63+
"*.dylib.*",
64+
"*.dll",
65+
"*.dll.a",
66+
"*.lib",
67+
"*.lib.a",
68+
"include/**/*"
69+
]

0 commit comments

Comments
 (0)