Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.git
.task
.cache
build
**/target
packages
packages-*
7 changes: 5 additions & 2 deletions .github/workflows/build-dependency-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
- "taskfiles/**"
- "tools/build-packages/build-dependency-image.sh"
- "tools/build-packages/dependency-image/**"
- "tools/build-packages/internal/ca-trust/container.sh"
- "tools/build-packages/internal/ca-trust/host.sh"
- "tools/build-packages/internal/host/**"
- "tools/yscope-dev-utils"
workflow_call:
outputs:
Expand Down Expand Up @@ -51,7 +54,7 @@ jobs:
- name: "Resolve dependency image"
id: "image"
run: |-
source tools/build-packages/dependency-image/utils.sh
source tools/build-packages/internal/host/build-env.sh
build_env_hash=$(derive_build_env_hash)
image_repo="ghcr.io/$(printf '%s' "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')"
image=$(image_ref "${image_repo}" "${IMAGE_NAME}" "${build_env_hash}")
Expand Down Expand Up @@ -121,7 +124,7 @@ jobs:
IMAGE: "${{needs.plan.outputs.image}}"
ARCH: "${{matrix.arch}}"
run: |-
source tools/build-packages/dependency-image/utils.sh
source tools/build-packages/internal/host/build-env.sh
output="--push"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
output="--load"
Expand Down
150 changes: 150 additions & 0 deletions .github/workflows/build-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Builds CLP Presto connector packages for amd64 and arm64.
#
# Flow:
# resolve-version use the input version or derive it from pom.xml
# build-dependency-image ensure the hash-tagged build-env image exists
# build build .deb / .rpm / .tar.gz artifacts per architecture
#
# See tools/build-packages/README.md for package-build details.

name: "build-packages"

on:
workflow_dispatch:
inputs:
version:
description: "Package version override (derived from presto-connector/pom.xml when blank)"
required: false
default: ""
push:
paths:
- ".dockerignore"
- ".github/workflows/build-packages.yaml"
- ".github/workflows/build-dependency-image.yaml"
- "presto-connector/**"
- "taskfile.yaml"
- "taskfiles/**"
- "tools/build-packages/**"
- "tools/yscope-dev-utils"
- "velox-connector/**"
# Markdown files don't change the artifact, so skip rebuilds on documentation-only changes.
- "!**/*.md"

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true

permissions:
contents: "read"

jobs:
resolve-version:
runs-on: "ubuntu-24.04"
outputs:
version: "${{steps.version.outputs.version}}"
steps:
- name: "Check out repository"
uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0

- name: "Resolve package version"
id: "version"
env:
INPUT_VERSION: "${{inputs.version || ''}}"
run: |-
version="${INPUT_VERSION}"
if [[ -z "${version}" ]]; then
if ! version=$(
mvn --quiet --file presto-connector/pom.xml \
help:evaluate \
-Dexpression=project.version \
-DforceStdout
); then
echo "::error::Failed to derive project.version with Maven"
exit 1
fi
if [[ -z "${version}" ]]; then
echo "::error::Maven returned an empty project.version"
exit 1
fi
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "::notice::Package version: ${version}"

build-dependency-image:
uses: "./.github/workflows/build-dependency-image.yaml"
permissions:
contents: "read"
packages: "write"

build:
needs: ["build-dependency-image", "resolve-version"]
permissions:
contents: "read"
packages: "read"
strategy:
# Build both architectures so one failure does not hide the other result.
fail-fast: false
matrix:
include:
- arch: "amd64"
runner: "ubuntu-24.04"
- arch: "arm64"
runner: "ubuntu-24.04-arm"
runs-on: "${{matrix.runner}}"
timeout-minutes: 120
env:
VERSION: "${{needs.resolve-version.outputs.version}}"
# Run package steps inside the build-env image, which provides Velox deps,
# JDK 17, go-task, and packaging tools.
container:
image: "${{needs.build-dependency-image.outputs.image}}"
Comment thread
jackluo923 marked this conversation as resolved.
credentials:
username: "${{github.actor}}"
password: "${{secrets.GITHUB_TOKEN}}"
steps:
- name: "Check out repository"
uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0
with:
# Required because taskfiles include shared utilities from the submodule.
submodules: true

- name: "Build packages"
id: "packages"
shell: "bash"
run: |-
bash tools/build-packages/internal/container/build-artifacts.sh --version "${VERSION}"

shopt -s nullglob
for extension in deb rpm tar.gz; do
artifact_files=(packages/clp-plugin-presto-connector*."${extension}")
if (( ${#artifact_files[@]} != 1 )); then
echo "::error::Expected exactly one .${extension} artifact, found ${#artifact_files[@]}"
exit 1
fi
printf '%s_filename=%s\n' \
"${extension//./_}" "${artifact_files[0]##*/}" >> "$GITHUB_OUTPUT"
done

- name: "Upload deb package"
uses: "actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f" # v6.0.0
with:
name: "${{steps.packages.outputs.deb_filename}}"
path: "packages/${{steps.packages.outputs.deb_filename}}"
if-no-files-found: "error"
retention-days: 14

- name: "Upload rpm package"
uses: "actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f" # v6.0.0
with:
name: "${{steps.packages.outputs.rpm_filename}}"
path: "packages/${{steps.packages.outputs.rpm_filename}}"
if-no-files-found: "error"
retention-days: 14

- name: "Upload tarball"
uses: "actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f" # v6.0.0
with:
name: "${{steps.packages.outputs.tar_gz_filename}}"
path: "packages/${{steps.packages.outputs.tar_gz_filename}}"
if-no-files-found: "error"
retention-days: 14
Comment thread
coderabbitai[bot] marked this conversation as resolved.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.task/
/.cache/
/build/
/packages/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ one of the tasks in the table below.
| `lint:check-yaml` | Runs the YAML linters. |
| `lint:fix-yaml` | Runs the YAML linters and fixes issues. |

## Building installable packages

To build `.deb`, `.rpm`, and `.tar.gz` artifacts of the plugin locally, see [tools/build-packages/README.md](tools/build-packages/README.md).

[Task]: https://taskfile.dev
3 changes: 3 additions & 0 deletions presto-connector/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Build artifacts
/dependency-reduced-pom.xml
/target/
16 changes: 13 additions & 3 deletions taskfiles/velox-connector/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@ includes:
vars:
G_VELOX_CONNECTOR_BUILD_DIR: "{{.G_BUILD_DIR}}/velox-connector"
G_DEPS_CPP_DIR: "{{.G_VELOX_CONNECTOR_BUILD_DIR}}/deps/cpp"
DEFAULT_FETCHCONTENT_BASE_DIR: "{{.G_VELOX_CONNECTOR_BUILD_DIR}}/_deps"
G_FETCHCONTENT_BASE_DIR: '{{env "FETCHCONTENT_BASE_DIR" | default .DEFAULT_FETCHCONTENT_BASE_DIR}}'

tasks:
build:
deps:
- "generate"
- "deps:install-all"
cmds:
- task: "build-with-installed-deps"

build-with-installed-deps:
desc: Builds the connector using dependencies already installed in G_DEPS_CPP_DIR.
preconditions:
- sh: "test -f '{{.G_DEPS_CPP_CMAKE_SETTINGS_DIR}}/all-deps.cmake'"
msg: "Installed dependency settings not found; run velox-connector:deps:install-all first."
cmds:
- task: "generate"
- task: "utils:cmake:build"
vars:
BUILD_DIR: "{{.G_VELOX_CONNECTOR_BUILD_DIR}}"
Expand All @@ -25,14 +36,13 @@ tasks:

generate:
internal: true
deps:
- "deps:install-all"
cmds:
- task: "utils:cmake:generate"
vars:
BUILD_DIR: "{{.G_VELOX_CONNECTOR_BUILD_DIR}}"
EXTRA_ARGS:
- "-DLIBCLP_PLUGIN_VELOX_CONNECTOR_DEPS_CMAKE_SETTINGS=\
{{.G_DEPS_CPP_CMAKE_SETTINGS_DIR}}/all-deps.cmake"
- "-DFETCHCONTENT_BASE_DIR={{.G_FETCHCONTENT_BASE_DIR}}"
- "-DPRESTO_GIT_TAG={{.G_PRESTO_GIT_TAG}}"
SOURCE_DIR: "{{.ROOT_DIR}}/velox-connector"
Loading
Loading