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
41 changes: 41 additions & 0 deletions .github/composite-actions/find-visual-studio/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Find Visual Studio'
description: >-
Finds the C++ tools of Visual Studio 2026 or, when it is not installed, of Visual Studio 2022 and sets
the VCVARS_PATH environment variable to the path of the script that sets up their environment.
inputs:
vcvars:
description: >-
Name of the environment script of the tools, for example vcvars64.bat (amd64 tools for amd64)
or vcvarsamd64_arm64.bat (amd64 tools for arm64)
required: true

runs:
using: "composite"
steps:
- name: Find Visual Studio
shell: pwsh
env:
VCVARS_NAME: ${{ inputs.vcvars }}
run: |
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
if (-not (Test-Path $vswhere)) {
throw "vswhere is not found: $vswhere"
}
# Visual Studio 2026 (18.x) and Visual Studio 2022 (17.x) of any edition, the newest version is the first one
$installations = @(& $vswhere -products * -version '[17.0,19.0)' -sort -property installationPath)
Write-Output 'Visual Studio installations:'
$installations | ForEach-Object { Write-Output " $_" }
# the first installation that has the requested tools is used
$vcvars = $null
foreach ($installation in $installations) {
$candidate = Join-Path $installation (Join-Path 'VC\Auxiliary\Build' $env:VCVARS_NAME)
if (Test-Path $candidate) {
$vcvars = $candidate
break
}
}
if (-not $vcvars) {
throw "Visual Studio 2026 or 2022 with $($env:VCVARS_NAME) is not found"
}
Write-Output "VCVARS_PATH=$vcvars"
"VCVARS_PATH=$vcvars" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
14 changes: 11 additions & 3 deletions .github/composite-actions/linux-build-docker/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: 'Linux Build Docker'
description: 'Linux build in Docker'
description: >-
Linux build in Docker. The JDKs of the JAVA_JNI_HOME and JAVA_FFM_HOME environment variables
(see setup-jdk-corretto) are mounted into the container.
inputs:
docker_image:
description: 'Docker image name'
Expand All @@ -12,23 +14,29 @@ runs:
- name: Build
shell: bash
run: |
: "${JAVA_JNI_HOME:?JAVA_JNI_HOME is not set}"
: "${JAVA_FFM_HOME:?JAVA_FFM_HOME is not set}"
python ./scripts/retry.py --timeout 1m -- \
docker pull ${{ inputs.docker_image }}
docker run \
-v.:/duckdb \
-v "${JAVA_JNI_HOME}:/jdk-jni" \
-v "${JAVA_FFM_HOME}:/jdk-ffm" \
-e GEN=ninja \
-e CC='ccache gcc' \
-e CXX='ccache g++' \
-e CCACHE_DIR=/duckdb/ccache \
-e JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk \
-e JAVA_JNI_HOME=/jdk-jni \
-e JAVA_FFM_HOME=/jdk-ffm \
${{ inputs.docker_image }} \
bash -c "
set -e
cat /etc/os-release
/jdk-jni/bin/java -version
/jdk-ffm/bin/java -version
python3 /duckdb/scripts/retry.py --timeout 2m -- \
dnf install -y \
ccache \
java-1.8.0-openjdk-devel \
ninja-build
make -C /duckdb release
"
16 changes: 12 additions & 4 deletions .github/composite-actions/linux-build-musl-docker/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: 'Linux Build Musl Docker'
description: 'Linux build with musl libc in Docker'
description: >-
Linux build with musl libc in Docker. The JDKs of the JAVA_JNI_HOME and JAVA_FFM_HOME environment
variables (see setup-jdk-corretto, the JDKs for Alpine Linux) are mounted into the container.
inputs:
docker_image:
description: 'Docker image name'
Expand All @@ -12,15 +14,20 @@ runs:
- name: Build
shell: bash
run: |
: "${JAVA_JNI_HOME:?JAVA_JNI_HOME is not set}"
: "${JAVA_FFM_HOME:?JAVA_FFM_HOME is not set}"
python ./scripts/retry.py --timeout 1m -- \
docker pull ${{ inputs.docker_image }}
docker run \
-v.:/duckdb \
-v "${JAVA_JNI_HOME}:/jdk-jni" \
-v "${JAVA_FFM_HOME}:/jdk-ffm" \
-e GEN=ninja \
-e CC='ccache gcc' \
-e CXX='ccache g++' \
-e CCACHE_DIR=/duckdb/ccache \
-e JAVA_HOME=/usr/lib/jvm/java-8-openjdk \
-e JAVA_JNI_HOME=/jdk-jni \
-e JAVA_FFM_HOME=/jdk-ffm \
${{ inputs.docker_image }} \
sh -c "
set -e
Expand All @@ -31,7 +38,8 @@ runs:
cmake \
g++ \
make \
openjdk8-jdk \
samurai
/jdk-jni/bin/java -version
/jdk-ffm/bin/java -version
make -C /duckdb release
"
"
21 changes: 12 additions & 9 deletions .github/composite-actions/linux-tests-docker/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: 'Linux Tests Docker'
description: 'Linux test run in Docker'
description: >-
Linux test run in Docker. The JDK of the JAVA_JNI_HOME environment variable (see setup-jdk-corretto)
is mounted into the container and runs the tests.
inputs:
docker_image:
description: 'Docker image name'
Expand All @@ -12,20 +14,21 @@ runs:
- name: Tests Docker
shell: bash
run: |
: "${JAVA_JNI_HOME:?JAVA_JNI_HOME is not set}"
python ./scripts/retry.py --timeout 1m -- \
docker pull ${{ inputs.docker_image }}
docker run \
-v.:/duckdb \
${{ inputs.docker_image }} \
docker run \
-v.:/duckdb \
-v "${JAVA_JNI_HOME}:/jdk-jni" \
${{ inputs.docker_image }} \
bash -c "
set -e
cat /etc/os-release
python3 /duckdb/scripts/retry.py --timeout 2m -- \
dnf install -y \
java-1.8.0-openjdk
/usr/lib/jvm/jre-1.8.0-openjdk/bin/java -version
export PATH=/jdk-jni/bin:\$PATH
which java
java -version
cd /duckdb
/usr/lib/jvm/jre-1.8.0-openjdk/bin/java \
java \
-cp ./build/release/duckdb_jdbc_tests.jar:./build/release/duckdb_jdbc.jar \
org.duckdb.TestDuckDBJDBC
rm ./test1.db
Expand Down
47 changes: 37 additions & 10 deletions .github/composite-actions/linux-tests-host/action.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,52 @@
name: 'Linux Tests Host'
description: 'Linux test run in host OS'
description: >-
Linux test run in host OS. The JDK of the JAVA_LATEST_HOME environment variable (see setup-jdk-corretto)
runs the tests two times: with the JNI bindings and with the FFM bindings of the multi-release jar.

runs:
using: "composite"
steps:
- name: Setup JDK
uses: actions/setup-java@v6
with:
distribution: 'corretto'
java-version: '27'

- name: Tests Host
- name: Tests Host (JNI)
shell: bash
run: |
: "${JAVA_LATEST_HOME:?JAVA_LATEST_HOME is not set}"
cat /etc/os-release
export PATH="${JAVA_LATEST_HOME}/bin:${PATH}"
which java
java -version
# the FFM classes of the multi-release jar are not used
java -Djdk.util.jar.enableMultiRelease=false \
-cp ./build/release/duckdb_jdbc_tests.jar:./build/release/duckdb_jdbc.jar \
org.duckdb.TestDuckDBJDBC

- name: Tests Host (FFM)
shell: bash
run: |
export PATH="${JAVA_LATEST_HOME}/bin:${PATH}"
which java
java -version
java \
java --enable-native-access=ALL-UNNAMED \
-cp ./build/release/duckdb_jdbc_tests.jar:./build/release/duckdb_jdbc.jar \
org.duckdb.TestDuckDBJDBC

- name: Arrow Tests Host
- name: Arrow Tests Host (JNI)
shell: bash
env:
JDK_JAVA_OPTIONS: '-Djdk.util.jar.enableMultiRelease=false'
run: |
export JAVA_HOME="${JAVA_LATEST_HOME}"
export PATH="${JAVA_LATEST_HOME}/bin:${PATH}"
which java
java -version
./src/test/external/test_arrow.sh

- name: Arrow Tests Host (FFM)
shell: bash
env:
JDK_JAVA_OPTIONS: '--enable-native-access=ALL-UNNAMED'
run: |
export JAVA_HOME="${JAVA_LATEST_HOME}"
export PATH="${JAVA_LATEST_HOME}/bin:${PATH}"
which java
java -version
./src/test/external/test_arrow.sh
11 changes: 8 additions & 3 deletions .github/composite-actions/linux-tests-musl-docker/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: 'Linux Tests Musl Docker'
description: 'Linux test run with musl libc in Docker'
description: >-
Linux test run with musl libc in Docker. The JDK of the JAVA_JNI_HOME environment variable
(see setup-jdk-corretto, the JDK for Alpine Linux) is mounted into the container and runs the tests.
inputs:
docker_image:
description: 'Docker image name'
Expand All @@ -12,12 +14,13 @@ runs:
- name: Tests Musl Docker
shell: bash
run: |
: "${JAVA_JNI_HOME:?JAVA_JNI_HOME is not set}"
python ./scripts/retry.py --timeout 1m -- \
docker pull ${{ inputs.docker_image }}
docker run \
-v.:/duckdb \
-v "${JAVA_JNI_HOME}:/jdk-jni" \
-e GEN=ninja \
-e JAVA_HOME=/usr/lib/jvm/java-8-openjdk \
${{ inputs.docker_image }} \
sh -c "
set -e
Expand All @@ -27,7 +30,9 @@ runs:
cmake \
g++ \
make \
openjdk8-jdk \
samurai
export PATH=/jdk-jni/bin:\$PATH
which java
java -version
make -C /duckdb test || true
"
123 changes: 123 additions & 0 deletions .github/composite-actions/setup-jdk-corretto/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: 'Setup JDK Corretto'
description: >-
Downloads Amazon Corretto JDK from its permanent URL, checks the SHA-256 checksum of the download and sets
the environment variable to the home directory of the JDK. PATH is not changed.
inputs:
version:
description: 'Major version of the JDK, for example 8 or 25'
required: true
env_name:
description: 'Name of the environment variable that is set to the home directory of the JDK'
required: false
default: 'JAVA_HOME'
arch:
description: >-
Architecture and OS of the JDK as they are named in the Corretto downloads, for example
x64-linux, aarch64-linux, x64-alpine, aarch64-alpine, x64-macos, aarch64-macos or x64-windows
required: true

runs:
using: "composite"
steps:
- name: Setup JDK Corretto
shell: bash
env:
JDK_VERSION: ${{ inputs.version }}
JDK_ENV_NAME: ${{ inputs.env_name }}
JDK_ARCH: ${{ inputs.arch }}
run: |
set -euo pipefail

if ! [[ "${JDK_VERSION}" =~ ^[0-9]+$ ]]; then
echo "Invalid JDK version: '${JDK_VERSION}'" >&2
exit 1
fi
if ! [[ "${JDK_ARCH}" =~ ^[a-z0-9]+-[a-z]+$ ]]; then
echo "Invalid JDK arch: '${JDK_ARCH}'" >&2
exit 1
fi
if ! [[ "${JDK_ENV_NAME}" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
echo "Invalid environment variable name: '${JDK_ENV_NAME}'" >&2
exit 1
fi

# Windows downloads are ZIP archives, all the other ones are tarballs
if [[ "${JDK_ARCH}" == *-windows ]]; then
EXT=zip
else
EXT=tar.gz
fi
FILE="amazon-corretto-${JDK_VERSION}-${JDK_ARCH}-jdk.${EXT}"
URL="https://corretto.aws/downloads/latest/${FILE}"
CHECKSUM_URL="https://corretto.aws/downloads/latest_sha256/${FILE}"

# RUNNER_TEMP is a Windows path on Windows
TEMP_DIR="${RUNNER_TEMP}"
if command -v cygpath > /dev/null; then
TEMP_DIR="$(cygpath -u "${RUNNER_TEMP}")"
fi
DIR="${TEMP_DIR}/setup-jdk-corretto/${JDK_VERSION}-${JDK_ARCH}"
rm -rf "${DIR}"
mkdir -p "${DIR}"

# only HTTPS is allowed (redirects included), the certificates are verified
download() {
curl --fail --silent --show-error --location \
--proto '=https' --proto-redir '=https' --tlsv1.2 \
--retry 3 --retry-delay 5 \
--output "$2" "$1"
}

echo "Downloading ${URL}"
download "${URL}" "${DIR}/${FILE}"
download "${CHECKSUM_URL}" "${DIR}/${FILE}.sha256"

# the checksum file has the hex digest only
EXPECTED="$(tr -d '[:space:]' < "${DIR}/${FILE}.sha256" | tr 'A-F' 'a-f')"
if ! [[ "${EXPECTED}" =~ ^[0-9a-f]{64}$ ]]; then
echo "Invalid checksum file: ${CHECKSUM_URL}" >&2
exit 1
fi
if command -v sha256sum > /dev/null; then
ACTUAL="$(sha256sum "${DIR}/${FILE}" | cut -d ' ' -f 1)"
else
ACTUAL="$(shasum -a 256 "${DIR}/${FILE}" | cut -d ' ' -f 1)"
fi
# sha256sum of Git Bash marks binary files with a leading backslash in some cases
ACTUAL="${ACTUAL#\\}"
if [[ "${ACTUAL}" != "${EXPECTED}" ]]; then
echo "Checksum mismatch for ${FILE}: expected ${EXPECTED}, actual ${ACTUAL}" >&2
exit 1
fi
echo "SHA-256 checksum is correct: ${ACTUAL}"

mkdir "${DIR}/jdk"
if [[ "${EXT}" == zip ]]; then
unzip -q "${DIR}/${FILE}" -d "${DIR}/jdk"
else
tar -xzf "${DIR}/${FILE}" -C "${DIR}/jdk"
fi
rm "${DIR}/${FILE}" "${DIR}/${FILE}.sha256"

# the home directory is the one that has bin/javac, it is Contents/Home on macOS
JAVAC="$(find "${DIR}/jdk" -maxdepth 6 -type f \( -name javac -o -name javac.exe \) -path '*/bin/*' -print -quit)"
if [[ -z "${JAVAC}" ]]; then
echo "JDK home directory is not found in ${FILE}" >&2
exit 1
fi
JDK_HOME="$(cd "$(dirname "${JAVAC}")/.." && pwd)"

# the variable has a Windows path on Windows
JDK_HOME_ENV="${JDK_HOME}"
if [[ "${JDK_ARCH}" == *-windows ]] && command -v cygpath > /dev/null; then
JDK_HOME_ENV="$(cygpath -w "${JDK_HOME}")"
fi
echo "${JDK_ENV_NAME}=${JDK_HOME_ENV}" >> "${GITHUB_ENV}"
echo "${JDK_ENV_NAME}=${JDK_HOME_ENV}"

# a JDK for musl libc cannot be run on a host with glibc, it is run in an Alpine container
if [[ "${JDK_ARCH}" == *-alpine ]] && ! (ldd --version 2>&1 | grep -qi musl); then
echo "JDK for Alpine Linux is not run on this host, 'java -version' is skipped"
else
"${JDK_HOME}/bin/java" -version 2>&1
fi
Loading
Loading