Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
223 changes: 223 additions & 0 deletions .github/workflows/iotdb-tools-thrift-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

name: Build IoTDB Tools Thrift Artifacts

on:
workflow_dispatch:
inputs:
git_ref:
description: Optional branch, tag, or commit SHA to build
required: false
type: string
pull_request:
paths:
- .github/workflows/iotdb-tools-thrift-artifacts.yml
- iotdb-tools-thrift/**

permissions:
contents: read

concurrency:
group: iotdb-tools-thrift-artifacts-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
name: Build ${{ matrix.classifier }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- classifier: linux-x86_64
runner: ubuntu-24.04
platform: linux
maven: ./mvnw
- classifier: linux-aarch64
runner: ubuntu-24.04-arm
platform: linux
maven: ./mvnw
- classifier: mac-x86_64
runner: macos-15-intel
platform: macos
maven: ./mvnw
- classifier: mac-aarch64
runner: macos-15
platform: macos
maven: ./mvnw
- classifier: windows-x86_64
runner: windows-2022
platform: windows
maven: .\mvnw.cmd
- classifier: windows-aarch64
runner: windows-11-arm
platform: windows
maven: .\mvnw.cmd

steps:
- name: Check out source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.git_ref || github.ref }}

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven

- name: Install Linux build prerequisites
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y flex bison g++ make

- name: Install macOS build prerequisites
if: matrix.platform == 'macos'
run: brew install bison

- name: Install Windows build prerequisites
if: matrix.platform == 'windows'
shell: pwsh
run: choco install winflexbison3 -y --no-progress

- name: Verify active Maven classifier
working-directory: iotdb-tools-thrift
shell: pwsh
run: |
$expected = "${{ matrix.classifier }}"
$actual = & "${{ matrix.maven }}" -q help:evaluate "-Dexpression=os.classifier" "-DforceStdout"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$actual = ($actual | Select-Object -Last 1).Trim()
Write-Host "Expected classifier: $expected"
Write-Host "Maven classifier: $actual"
if ($actual -ne $expected) {
throw "Maven activated classifier '$actual', expected '$expected'"
}

- name: Build artifact
working-directory: iotdb-tools-thrift
shell: pwsh
run: |
& "${{ matrix.maven }}" clean package -DskipTests
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

- name: Verify archive contents
working-directory: iotdb-tools-thrift
shell: pwsh
run: |
$classifier = "${{ matrix.classifier }}"
$zip = Get-ChildItem -Path target -Filter "*-$classifier.zip" | Select-Object -First 1
if (-not $zip) {
throw "No zip file found for classifier $classifier"
}

Add-Type -AssemblyName System.IO.Compression.FileSystem
$archive = [System.IO.Compression.ZipFile]::OpenRead($zip.FullName)
try {
$files = $archive.Entries | Where-Object { $_.Name } | ForEach-Object { $_.FullName }
} finally {
$archive.Dispose()
}

$expectedBinary = if ($classifier.StartsWith("windows")) { "bin/Release/thrift.exe" } else { "bin/thrift" }
Write-Host "Archive: $($zip.Name)"
$files | ForEach-Object { Write-Host " - $_" }

if ($files.Count -ne 1) {
throw "Expected exactly one file in the archive, found $($files.Count)"
}
if ($files -notcontains $expectedBinary) {
throw "Expected archive to contain $expectedBinary"
}

$extractDir = Join-Path $env:RUNNER_TEMP "thrift-$classifier"
Remove-Item -Recurse -Force $extractDir -ErrorAction SilentlyContinue
Expand-Archive -Path $zip.FullName -DestinationPath $extractDir
$binary = Join-Path $extractDir $expectedBinary
if (-not (Test-Path $binary)) {
throw "Expected binary not found after extraction: $expectedBinary"
}
if (-not $classifier.StartsWith("windows")) {
chmod +x $binary
}

$version = & $binary --version
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$version = ($version | Select-Object -Last 1).Trim()
Write-Host "Thrift version output: $version"
if ($version -ne "Thrift version 0.23.0") {
throw "Unexpected thrift version output: $version"
}

if ($classifier.StartsWith("linux")) {
$fileInfo = & file $binary
Write-Host "file output: $fileInfo"
if ($fileInfo -notmatch "statically linked") {
throw "Expected Linux thrift binary to be statically linked"
}
}

- name: Upload platform artifact
uses: actions/upload-artifact@v4
with:
name: iotdb-tools-thrift-${{ matrix.classifier }}
path: iotdb-tools-thrift/target/*-${{ matrix.classifier }}.zip
if-no-files-found: error
compression-level: 0
retention-days: 14

bundle:
name: Bundle all platform artifacts
runs-on: ubuntu-24.04
needs: build
steps:
- name: Download platform artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: iotdb-tools-thrift-*
merge-multiple: true

- name: Verify bundled artifacts
shell: bash
run: |
set -euo pipefail
ls -lah dist
test "$(find dist -maxdepth 1 -name '*.zip' | wc -l)" -eq 6
for classifier in linux-x86_64 linux-aarch64 mac-x86_64 mac-aarch64 windows-x86_64 windows-aarch64; do
test "$(find dist -maxdepth 1 -name "*-${classifier}.zip" | wc -l)" -eq 1
done

- name: Upload bundled artifact
uses: actions/upload-artifact@v4
with:
name: iotdb-tools-thrift-all-platforms
path: dist/*.zip
if-no-files-found: error
compression-level: 0
retention-days: 14
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
**/.DS_Store
derby-tsfile-db
/iotdb-tools-thrift/target/
/iotdb-tools-thrift/prebuilt-artifacts/
/iotdb-tools-thrift/.mvn/wrapper/maven-wrapper.jar
117 changes: 101 additions & 16 deletions iotdb-tools-thrift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,116 @@

# Releasing the IoTDB Tools: Thrift

./mvnw clean deploy -P apache-release
This module publishes platform-specific Apache Thrift compiler archives used by
IoTDB builds. The archives contain the `thrift` executable only.

## Prerequisites

Install the following software before building this module:

- JDK
- Flex
- Bison
- A C/C++ build toolchain supported by CMake
- GPG configured for Apache release signing
- Apache Nexus credentials configured as `apache.releases.https` in Maven `settings.xml`

Linux profiles build the `thrift` executable with `-static`, so the build host
needs the static runtime libraries required by its C/C++ toolchain.

Use `mvnw.cmd` instead of `./mvnw` on Windows.

## Build Locally

Run the following command from this directory:

./mvnw clean package -DskipTests

The archive is generated under `target/`. Check that it contains `bin/thrift`
and that the binary reports the expected Apache Thrift version.

## Build Release Artifacts With GitHub Actions

The `Build IoTDB Tools Thrift Artifacts` workflow builds the six platform zip
artifacts without signing or deploying them. Trigger it manually from GitHub
Actions, optionally passing a branch, tag, or commit SHA in the `git_ref` input.
The workflow verifies that each generated compiler reports the expected Apache
Thrift version, and that Linux compilers are statically linked.

The workflow uploads one bundled artifact named
`iotdb-tools-thrift-all-platforms`. Download and extract that artifact into this
directory:

iotdb-tools-thrift/prebuilt-artifacts/

On the first run, comment out the "stagingRepositoryId" property.
This will make the build deploy the rc in a new staging repository in nexus.
If you use the GitHub CLI, run:

As soon as the build is finished, go to https://repository.apache.org/#stagingRepositories and take the new repository id from there and comment in the property again and update the value to that of the staging repository and commit that.
gh run download <run-id> --name iotdb-tools-thrift-all-platforms --dir prebuilt-artifacts

This will make it easy for the other platform deployment.
The directory must contain these files:

Then checkout the repo on the other platforms and run the following on each of the other platforms:
- `iotdb-tools-thrift-${project.version}-linux-x86_64.zip`
- `iotdb-tools-thrift-${project.version}-linux-aarch64.zip`
- `iotdb-tools-thrift-${project.version}-mac-x86_64.zip`
- `iotdb-tools-thrift-${project.version}-mac-aarch64.zip`
- `iotdb-tools-thrift-${project.version}-windows-x86_64.zip`
- `iotdb-tools-thrift-${project.version}-windows-aarch64.zip`

`${project.version}` is the Maven project version, for example `0.23.0.0`.

Verify the archives before deploying them. Each archive should contain only the
`bin/thrift` executable, or `bin/Release/thrift.exe` on Windows, and the
executable should report the expected Apache Thrift version.

## Deploy Prebuilt Artifacts to Nexus

Run the deploy locally from this directory. This signs and deploys the six
prebuilt platform artifacts from `prebuilt-artifacts/`:

./mvnw clean deploy -P apache-release,prebuilt-artifacts

Use `prebuilt.artifacts.dir` if the downloaded artifacts are in another
directory:

./mvnw clean deploy -P apache-release,prebuilt-artifacts -Dprebuilt.artifacts.dir=/path/to/prebuilt-artifacts

This creates a new staging repository in Nexus. After the deploy completes, open
https://repository.apache.org/#stagingRepositories and verify the uploaded
artifacts.

If you need to re-run the local deploy into an existing staging repository, pass
that exact staging repository id:

./mvnw clean deploy -P apache-release,prebuilt-artifacts -DstagingRepositoryId=orgapacheiotdb-1234

The `stagingRepositoryId` value must be an existing Nexus staging repository id.
Do not use a made-up id.

## Deploy by Building on Each Platform

If you do not use the prebuilt artifacts workflow, you can still deploy by
building on each platform.

Run the first deploy on one platform without `stagingRepositoryId`:

./mvnw clean deploy -P apache-release

> Note: For some reason you will see errors a the end when deploying the other artifacts, however in all cases I did see the artifacts deployed correctly.
This creates a new staging repository in Nexus. After the deploy completes, open
https://repository.apache.org/#stagingRepositories and copy the generated staging
repository id, for example `orgapacheiotdb-1234`.

Once this has been run on each of the supported platforms, go back to Nexus and close the staging repository.
Run the deploy on each remaining platform with that exact staging repository id:

## Prerequisites
./mvnw clean deploy -P apache-release -DstagingRepositoryId=orgapacheiotdb-1234

The following software needs to be installed in order to build the thrift module:
Supported classifiers are:

- Java
- Flex
- Bison
- Boost
- Ssl
- `linux-x86_64`
- `linux-aarch64`
- `mac-x86_64`
- `mac-aarch64`
- `windows-x86_64`
- `windows-aarch64`

Please look in the IoTDB documentation for information on how to install them on your particular OS.
After all platform archives have been deployed, verify the staging repository in
Nexus, close it, and continue with the Apache release vote and release process.
Loading
Loading