Skip to content
Open
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
97 changes: 97 additions & 0 deletions .github/workflows/beeline-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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: Beeline Native Installer Release

on:
workflow_dispatch:
inputs:
release_tag:
description: 'GitHub release tag to upload artifacts to. Leave empty to skip release upload.'
required: false
default: ''
type: string

permissions:
contents: write

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
label: macos-x64
artifact_glob: beeline/target/installer/x64/*.dmg
- os: macos-latest
label: macos-arm64
artifact_glob: beeline/target/installer/arm64/*.dmg
- os: ubuntu-latest
label: linux-x64
artifact_glob: beeline/target/installer/x64/*.deb
- os: windows-latest
label: windows-x64
artifact_glob: beeline/target/installer/x64/*.exe

runs-on: ${{ matrix.os }}
# Bounds total job time (queue + execution). Notably guards against macos-13
# runner-pool starvation as GitHub drains its capacity ahead of deprecation.
timeout-minutes: 60
steps:
- uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
cache: maven

- name: Disable WSL bash stub so Git Bash wins (Windows only)
if: runner.os == 'Windows'
shell: pwsh
run: |
$stub = "C:\Windows\System32\bash.exe"
if (Test-Path $stub) {
Write-Host "Taking ownership of $stub"
takeown.exe /F $stub /A | Out-Null
icacls.exe $stub /grant "*S-1-5-32-544:F" | Out-Null # Administrators group SID
Rename-Item -Path $stub -NewName "bash.exe.disabled" -Force
}
"C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Host "bash now resolves to:"
where.exe bash
bash --version

- name: Build Beeline installer
run: mvn package -pl beeline -am -DskipTests -P native-installer

- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: beeline-${{ matrix.label }}
path: ${{ matrix.artifact_glob }}
if-no-files-found: error

- name: Upload installer to GitHub release
if: ${{ inputs.release_tag != '' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.release_tag }}
files: ${{ matrix.artifact_glob }}
allow_updates: true
fail_on_unmatched_files: true
104 changes: 99 additions & 5 deletions beeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
</dependency>
<dependency>
<!--
Since the compile-time hive-jdbc dependency contains Utils.java,
which directly imports HiveSQLException from hive-service,
hive-service is also required at runtime and should therefore be declared as a compile-time dependency.
-->
Since the compile-time hive-jdbc dependency contains Utils.java,
which directly imports HiveSQLException from hive-service,
hive-service is also required at runtime and should therefore be declared as a compile-time dependency.
-->
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>${project.version}</version>
Expand Down Expand Up @@ -147,7 +147,7 @@
<!--
hive-exec, hive-llap-server, and hive-hplsql are declared test scope here so that
are all needed to run BeelineCli test to manage the embedded HS2 session.
-->
-->
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
Expand Down Expand Up @@ -242,6 +242,100 @@
</dependency>
</dependencies>
<profiles>
<!--
Build a native installer (dmg on macOS, exe/msi on Windows, deb/rpm on Linux).
The installer bundles a JRE — end-users need no Java pre-installed.

Usage:
mvn package -pl beeline -am -DskipTests -P native-installer

Output (arch sub-directory so x64 and arm64 artifacts coexist):
beeline/target/installer/x64/beeline-4.3.0.dmg (Intel Mac)
beeline/target/installer/arm64/beeline-4.3.0.dmg (Apple Silicon — macos-arm64 auto-activates)
beeline/target/installer/x64/beeline-4.3.0.exe (Windows)
beeline/target/installer/x64/beeline_4.3.0_amd64.deb (Linux)

installer.arch defaults to x64 and is overridden to arm64 by the
macos-arm64 profile below when running on Apple Silicon.
-->
<profile>
<id>native-installer</id>
<properties>
<!-- jpackage requires version as 1-3 integers separated by dots -->
<installer.app.version>4.3.0</installer.app.version>
<!-- Default architecture label; overridden to arm64 by the macos-arm64 profile -->
<installer.arch>x64</installer.arch>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>jpackage</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${project.build.directory}/installer/${installer.arch}"/>
<exec executable="jpackage" failonerror="true">
<!-- Application identity -->
<arg value="--name"/>
<arg value="beeline"/>
<arg value="--app-version"/>
<arg value="${installer.app.version}"/>
<arg value="--vendor"/>
<arg value="Apache Software Foundation"/>
<arg value="--description"/>
<arg value="Apache Hive Beeline SQL client"/>
<!-- Input: the self-contained fat jar -->
<arg value="--input"/>
<arg value="${project.build.directory}"/>
<arg value="--main-jar"/>
<arg value="beeline-standalone.jar"/>
<arg value="--main-class"/>
<arg value="org.apache.hive.beeline.BeeLine"/>
<!-- Output: arch-specific subdirectory so x64 and arm64 coexist -->
<arg value="--dest"/>
<arg value="${project.build.directory}/installer/${installer.arch}"/>
<!--
jpackage picks the native format automatically:
macOS → dmg (x64 on Intel, arm64 on Apple Silicon)
Windows → exe
Linux → deb
To force a specific type, add:
<arg value="- -type"/> <arg value="pkg"/>
-->
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!--
Auto-detects Apple Silicon and sets installer.arch=arm64.
Declared AFTER native-installer so its property value wins over the x64
default when both profiles are active simultaneously on Apple Silicon.
No -P flag needed — activates automatically via os.name=Mac OS X + os.arch=aarch64.
-->
<profile>
<id>macos-arm64-installer</id>
<activation>
<os>
<name>Mac OS X</name>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<installer.arch>arm64</installer.arch>
</properties>
</profile>
<profile>
<id>sources</id>
<build>
Expand Down
Loading
Loading