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/*.msi

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
161 changes: 156 additions & 5 deletions beeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<name>Hive Beeline</name>
<properties>
<hive.path.to.root>..</hive.path.to.root>
<jpackage.plugin.version>4.3.0</jpackage.plugin.version>
</properties>
<dependencies>
<!-- dependencies are always listed in sorted order by groupId, artifactId -->
Expand Down Expand Up @@ -68,10 +69,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 +148,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 +243,156 @@
</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>${jpackage.plugin.version}</installer.app.version>
<!-- Default architecture label; overridden to arm64 by the macos-arm64 profile -->
<installer.arch>x64</installer.arch>
<jpackage.platform.args></jpackage.platform.args>
</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}"/>
<arg line="${jpackage.platform.args}"/>
<!--
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>
<!--
Auto-activates on Windows.

Flags jpackage supports natively:
win-console Launcher uses the CUI (console) subsystem so
stdout/stderr, pipes and exit codes work in
cmd/PowerShell. Without this beeline.exe is
built as a GUI-subsystem binary and produces
no output.
type msi Force MSI output instead of the default EXE
(WiX Burn bundle). MSI is what enterprise
deployment tooling (Group Policy, Intune,
SCCM, Ansible win_package) consumes directly,
and its WiX customization surface is easier
to extend later (e.g. a PATH environment
fragment via resource-dir).
win-dir-chooser Adds a wizard page letting the user pick the
install directory instead of the silent default.
win-menu Create a Start menu shortcut.
win-menu-group Group the Start menu shortcut under this folder.
win-shortcut-prompt Adds checkboxes on the last wizard page so users
can opt in / out of Start menu and desktop
shortcuts.
win-help-url Adds a "Help" link to the Add/Remove Programs
entry so users can reach hive.apache.org.
license-file Shows the ASL 2.0 as a license-agreement wizard
page (jpackage auto-converts to RTF for the MSI).
resource-dir Points at src/main/jpackage/windows/. jpackage
picks up main.wxs from that directory and uses it
in place of its own built-in WiX template. Our
override adds a public ADD_TO_PATH property
(default 1) and a Component whose Environment
element appends INSTALLDIR to the system PATH.
Users can opt out at silent install time with
msiexec /i beeline-x.y.z.msi /qn ADD_TO_PATH=0

Deliberately NOT set:
win-shortcut Desktop shortcut on by default is pushy for a
CLI tool. win-shortcut-prompt above lets the
user add one if they want it.
win-per-user-install Would skip UAC by installing under
%LOCALAPPDATA%, but breaks multi-user machines.
-->
<profile>
<id>windows-installer</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<jpackage.platform.args>--win-console --type msi --win-dir-chooser --win-menu --win-menu-group "Apache Hive" --win-shortcut-prompt --win-help-url https://hive.apache.org/ --license-file ${project.basedir}/../LICENSE --resource-dir ${project.basedir}/src/main/jpackage/windows</jpackage.platform.args>
</properties>
</profile>
<profile>
<id>sources</id>
<build>
Expand Down
Loading
Loading