Compare commits
27 Commits
yl/debug-c
...
yl/format-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
539762231b | ||
|
|
32fcf7e620 | ||
|
|
ccaf92e99d | ||
|
|
22721d7edd | ||
|
|
e06cd347fb | ||
|
|
fb016137ee | ||
|
|
ab5f005bce | ||
|
|
9c05c83412 | ||
|
|
c63b39fb62 | ||
|
|
0d72926508 | ||
|
|
bffad99acc | ||
|
|
c7d73dcb8d | ||
|
|
6145a1b4a9 | ||
|
|
17be068d61 | ||
|
|
c9d93eee2e | ||
|
|
763e521a99 | ||
|
|
875fa2161c | ||
|
|
fda5caf296 | ||
|
|
183422172c | ||
|
|
c6f57c2f9c | ||
|
|
6cbef80577 | ||
|
|
277b48c4c9 | ||
|
|
ec5334099f | ||
|
|
37c738af28 | ||
|
|
07ed1ea806 | ||
|
|
8f35729d11 | ||
|
|
2715fb15c1 |
61
.github/workflows/MainDistributionPipeline.yml
vendored
61
.github/workflows/MainDistributionPipeline.yml
vendored
@@ -3,8 +3,14 @@
|
|||||||
#
|
#
|
||||||
name: Main Extension Distribution Pipeline
|
name: Main Extension Distribution Pipeline
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- "ts/**"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
paths-ignore:
|
||||||
|
- "ts/**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -12,11 +18,54 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
duckdb-stable-build:
|
duckdb-main-build:
|
||||||
name: Build stable extension binaries
|
name: Build main extension binaries
|
||||||
uses: ./.github/workflows/_extension_distribution.yml
|
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
|
||||||
with:
|
with:
|
||||||
ci_tools_version: v1.2.1
|
ci_tools_version: main
|
||||||
duckdb_version: v1.2.1
|
duckdb_version: main
|
||||||
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads'
|
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads'
|
||||||
extension_name: ui
|
extension_name: ui
|
||||||
|
|
||||||
|
duckdb-next-patch-build:
|
||||||
|
name: Build next patch extension binaries
|
||||||
|
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.0
|
||||||
|
with:
|
||||||
|
ci_tools_version: v1.3.0
|
||||||
|
duckdb_version: v1.3-ossivalis
|
||||||
|
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads'
|
||||||
|
extension_name: ui
|
||||||
|
|
||||||
|
duckdb-stable-build:
|
||||||
|
name: Build stable extension binaries
|
||||||
|
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.0
|
||||||
|
with:
|
||||||
|
ci_tools_version: v1.3.0
|
||||||
|
duckdb_version: v1.3.0
|
||||||
|
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads'
|
||||||
|
extension_name: ui
|
||||||
|
|
||||||
|
duckdb-stable-deploy:
|
||||||
|
if: ${{ github.repository == 'duckdb/duckdb-ui' && ( startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' ) }}
|
||||||
|
name: Deploy stable extension binaries
|
||||||
|
needs: duckdb-stable-build
|
||||||
|
uses: duckdb/extension-ci-tools/.github/workflows/_extension_deploy.yml@v1.3.0
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
extension_name: ui
|
||||||
|
ci_tools_version: v1.3.0
|
||||||
|
duckdb_version: v1.3.0
|
||||||
|
exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads'
|
||||||
|
deploy_latest: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }}
|
||||||
|
|
||||||
|
format-check:
|
||||||
|
name: Check formatting
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
run: make format-check
|
||||||
738
.github/workflows/_extension_distribution.yml
vendored
738
.github/workflows/_extension_distribution.yml
vendored
@@ -1,738 +0,0 @@
|
|||||||
# Reusable workflow for building DuckDB extensions using a standardized environment
|
|
||||||
#
|
|
||||||
# The workflow:
|
|
||||||
# - builds the extension using the CI workflow from the corresponding DuckDB version
|
|
||||||
# - uploads the extensions as gh actions artifacts in the following format:
|
|
||||||
# <ext_name>-<duckdb_version>-extension-<arch><optional_postfix>
|
|
||||||
#
|
|
||||||
# note: extensions are simply uploaded to GitHub actions, deploying the extensions is done a separate step. More info on
|
|
||||||
# this can be found in https://github.com/duckdb/extension-template
|
|
||||||
|
|
||||||
name: Extension distribution
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
# The name with which the extension will be built
|
|
||||||
extension_name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
# DuckDB version to build against, should in most cases be identical to
|
|
||||||
duckdb_version:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
# The version of the https://github.com/duckdb/extension-ci-tools submodule of the extension. In most cases will be identical to `duckdb_version`.
|
|
||||||
# Passing this explicitly is required because of https://github.com/actions/toolkit/issues/1264
|
|
||||||
ci_tools_version:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
# ';' separated list of architectures to exclude, for example: 'linux_amd64;osx_arm64'
|
|
||||||
exclude_archs:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
# Postfix added to artifact names. Can be used to guarantee unique names when this workflow is called multiple times
|
|
||||||
artifact_postfix:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
# Override the default vcpkg repository
|
|
||||||
vcpkg_url:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "https://github.com/microsoft/vcpkg.git"
|
|
||||||
# Override the default vcpkg commit used by this version of DuckDB
|
|
||||||
vcpkg_commit:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "5e5d0e1cd7785623065e77eff011afdeec1a3574"
|
|
||||||
# Override the default script producing the matrices. Allows specifying custom matrices.
|
|
||||||
matrix_parse_script:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "./extension-ci-tools/scripts/modify_distribution_matrix.py"
|
|
||||||
# Enable building the DuckDB Shell
|
|
||||||
build_duckdb_shell:
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
# Supply an override repository to build, instead of using the current one
|
|
||||||
override_repository:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
# The git ref used for the override_repository
|
|
||||||
override_ref:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
# Override the repo for the CI tools (for testing CI tools itself)
|
|
||||||
override_ci_tools_repository:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "duckdb/extension-ci-tools"
|
|
||||||
# Pass extra toolchains
|
|
||||||
# available: (parser_tools, rust, fortran, omp, python3)
|
|
||||||
extra_toolchains:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
rust_logs:
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
# Optional tag the build extension should have -- this is easy to misuse, and subject to change, for internal use only
|
|
||||||
extension_tag:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
# Optional tag the referenced duckdb should have -- this is a easy to misuse, and subject to change, for internal use only
|
|
||||||
duckdb_tag:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
# If set tot true, skip tests
|
|
||||||
skip_tests:
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
# DEPRECATED: use extra_toolchains instead
|
|
||||||
enable_rust:
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
generate_matrix:
|
|
||||||
name: Generate matrix
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
linux_matrix: ${{ steps.set-matrix-linux.outputs.linux_matrix }}
|
|
||||||
windows_matrix: ${{ steps.set-matrix-windows.outputs.windows_matrix }}
|
|
||||||
osx_matrix: ${{ steps.set-matrix-osx.outputs.osx_matrix }}
|
|
||||||
wasm_matrix: ${{ steps.set-matrix-wasm.outputs.wasm_matrix }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout Extension CI tools
|
|
||||||
with:
|
|
||||||
path: 'extension-ci-tools'
|
|
||||||
ref: ${{ inputs.ci_tools_version }}
|
|
||||||
repository: ${{ inputs.override_ci_tools_repository }}
|
|
||||||
|
|
||||||
- id: parse-matrices
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
python3 ${{ inputs.matrix_parse_script }} --input extension-ci-tools/config/distribution_matrix.json --select_os linux --output build/linux_matrix.json --exclude "${{ inputs.exclude_archs }}" --pretty
|
|
||||||
python3 ${{ inputs.matrix_parse_script }} --input extension-ci-tools/config/distribution_matrix.json --select_os osx --output build/osx_matrix.json --exclude "${{ inputs.exclude_archs }}" --pretty
|
|
||||||
python3 ${{ inputs.matrix_parse_script }} --input extension-ci-tools/config/distribution_matrix.json --select_os windows --output build/windows_matrix.json --exclude "${{ inputs.exclude_archs }}" --pretty
|
|
||||||
python3 ${{ inputs.matrix_parse_script }} --input extension-ci-tools/config/distribution_matrix.json --select_os wasm --output build/wasm_matrix.json --exclude "${{ inputs.exclude_archs }}" --pretty
|
|
||||||
|
|
||||||
- id: set-matrix-linux
|
|
||||||
run: |
|
|
||||||
linux_matrix="`cat build/linux_matrix.json`"
|
|
||||||
echo linux_matrix=$linux_matrix >> $GITHUB_OUTPUT
|
|
||||||
echo `cat $GITHUB_OUTPUT`
|
|
||||||
|
|
||||||
- id: set-matrix-osx
|
|
||||||
run: |
|
|
||||||
osx_matrix="`cat build/osx_matrix.json`"
|
|
||||||
echo osx_matrix=$osx_matrix >> $GITHUB_OUTPUT
|
|
||||||
echo `cat $GITHUB_OUTPUT`
|
|
||||||
|
|
||||||
- id: set-matrix-windows
|
|
||||||
run: |
|
|
||||||
windows_matrix="`cat build/windows_matrix.json`"
|
|
||||||
echo windows_matrix=$windows_matrix >> $GITHUB_OUTPUT
|
|
||||||
echo `cat $GITHUB_OUTPUT`
|
|
||||||
|
|
||||||
- id: set-matrix-wasm
|
|
||||||
run: |
|
|
||||||
wasm_matrix="`cat build/wasm_matrix.json`"
|
|
||||||
echo wasm_matrix=$wasm_matrix >> $GITHUB_OUTPUT
|
|
||||||
echo `cat $GITHUB_OUTPUT`
|
|
||||||
|
|
||||||
linux:
|
|
||||||
name: Linux
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: generate_matrix
|
|
||||||
if: ${{ needs.generate_matrix.outputs.linux_matrix != '{}' && needs.generate_matrix.outputs.linux_matrix != '' }}
|
|
||||||
strategy:
|
|
||||||
matrix: ${{fromJson(needs.generate_matrix.outputs.linux_matrix)}}
|
|
||||||
env:
|
|
||||||
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
|
||||||
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
GEN: ninja
|
|
||||||
BUILD_SHELL: ${{ inputs.build_duckdb_shell && '1' || '0' }}
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Free up some unused space
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
docker images -a -q > package.list
|
|
||||||
if [ -s package.list ]; then
|
|
||||||
echo "To be deleted"
|
|
||||||
cat package.list
|
|
||||||
echo "---"
|
|
||||||
docker rmi $(cat package.list)
|
|
||||||
fi
|
|
||||||
rm package.list
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout override repository
|
|
||||||
if: ${{inputs.override_repository != ''}}
|
|
||||||
with:
|
|
||||||
repository: ${{ inputs.override_repository }}
|
|
||||||
ref: ${{ inputs.override_ref }}
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout current repository
|
|
||||||
if: ${{inputs.override_repository == ''}}
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout Extension CI tools
|
|
||||||
with:
|
|
||||||
path: 'extension-ci-tools'
|
|
||||||
ref: ${{ inputs.ci_tools_version }}
|
|
||||||
repository: ${{ inputs.override_ci_tools_repository }}
|
|
||||||
|
|
||||||
- name: Checkout DuckDB to version
|
|
||||||
if: ${{inputs.duckdb_version != ''}}
|
|
||||||
run: |
|
|
||||||
DUCKDB_GIT_VERSION=${{ inputs.duckdb_version }} make set_duckdb_version
|
|
||||||
|
|
||||||
- name: Tag extension
|
|
||||||
if: ${{inputs.extension_tag != ''}}
|
|
||||||
run: |
|
|
||||||
git tag ${{ inputs.extension_tag }}
|
|
||||||
|
|
||||||
- name: Tag DuckDB extension
|
|
||||||
if: ${{inputs.duckdb_tag != ''}}
|
|
||||||
run: |
|
|
||||||
DUCKDB_TAG=${{ inputs.duckdb_tag }} make set_duckdb_tag
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout Extension CI tools
|
|
||||||
with:
|
|
||||||
path: 'extension-ci-tools'
|
|
||||||
ref: ${{ inputs.ci_tools_version }}
|
|
||||||
repository: ${{ inputs.override_ci_tools_repository }}
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--build-arg 'vcpkg_url=${{ inputs.vcpkg_url }}' \
|
|
||||||
--build-arg 'vcpkg_commit=${{ inputs.vcpkg_commit }}' \
|
|
||||||
--build-arg 'extra_toolchains=${{ inputs.enable_rust && format(';{0};rust;', inputs.extra_toolchains) || format(';{0};', inputs.extra_toolchains) }}' \
|
|
||||||
-t duckdb/${{ matrix.duckdb_arch }} \
|
|
||||||
./extension-ci-tools/docker/${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
- name: Create env file for docker
|
|
||||||
run: |
|
|
||||||
touch docker_env.txt
|
|
||||||
echo "VCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }}" >> docker_env.txt
|
|
||||||
echo "BUILD_SHELL=${{ inputs.build_duckdb_shell && '1' || '0' }}" >> docker_env.txt
|
|
||||||
echo "OPENSSL_ROOT_DIR=/duckdb_build_dir/build/release/vcpkg_installed/${{ matrix.vcpkg_triplet }}" >> docker_env.txt
|
|
||||||
echo "OPENSSL_DIR=/duckdb_build_dir/build/release/vcpkg_installed/${{ matrix.vcpkg_triplet }}" >> docker_env.txt
|
|
||||||
echo "OPENSSL_USE_STATIC_LIBS=true" >> docker_env.txt
|
|
||||||
echo "DUCKDB_PLATFORM=${{ matrix.duckdb_arch }}" >> docker_env.txt
|
|
||||||
echo "DUCKDB_GIT_VERSION=${{ inputs.duckdb_version }}" >> docker_env.txt
|
|
||||||
echo "LINUX_CI_IN_DOCKER=1" >> docker_env.txt
|
|
||||||
echo "TOOLCHAIN_FLAGS=${{ matrix.duckdb_arch == 'linux_arm64' && '-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_Fortran_COMPILER=aarch64-linux-gnu-gfortran' || '' }}" >> docker_env.txt
|
|
||||||
|
|
||||||
- name: Generate timestamp for Ccache entry
|
|
||||||
shell: cmake -P {0}
|
|
||||||
id: ccache_timestamp
|
|
||||||
run: |
|
|
||||||
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
|
||||||
message("::set-output name=timestamp::${current_date}")
|
|
||||||
|
|
||||||
- name: Create Ccache directory
|
|
||||||
run: |
|
|
||||||
mkdir ccache_dir
|
|
||||||
|
|
||||||
- name: Load Ccache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ./ccache_dir
|
|
||||||
key: ccache-extension-distribution-${{ matrix.duckdb_arch }}-${{ steps.ccache_timestamp.outputs.timestamp }}
|
|
||||||
restore-keys: |
|
|
||||||
ccache-extension-distribution-${{ matrix.duckdb_arch }}-
|
|
||||||
|
|
||||||
- name: Run configure (outside Docker)
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
DUCKDB_GIT_VERSION: ${{ inputs.duckdb_version }}
|
|
||||||
LINUX_CI_IN_DOCKER: 0
|
|
||||||
run: |
|
|
||||||
make configure_ci
|
|
||||||
|
|
||||||
- name: Run configure (inside Docker)
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker run --env-file=docker_env.txt -v `pwd`:/duckdb_build_dir -v `pwd`/ccache_dir:/ccache_dir duckdb/${{ matrix.duckdb_arch }} make configure_ci
|
|
||||||
|
|
||||||
- name: Build extension (inside Docker)
|
|
||||||
run: |
|
|
||||||
docker run --env-file=docker_env.txt -v `pwd`:/duckdb_build_dir -v `pwd`/ccache_dir:/ccache_dir duckdb/${{ matrix.duckdb_arch }} make release
|
|
||||||
|
|
||||||
- name: Test extension (inside docker)
|
|
||||||
if: ${{ matrix.duckdb_arch != 'linux_arm64' && inputs.skip_tests == false }}
|
|
||||||
run: |
|
|
||||||
docker run --env-file=docker_env.txt -v `pwd`:/duckdb_build_dir -v `pwd`/ccache_dir:/ccache_dir duckdb/${{ matrix.duckdb_arch }} make test_release
|
|
||||||
|
|
||||||
- name: Test extension (outside docker)
|
|
||||||
if: ${{ matrix.duckdb_arch != 'linux_arm64' && inputs.skip_tests == false }}
|
|
||||||
env:
|
|
||||||
DUCKDB_GIT_VERSION: ${{ inputs.duckdb_version }}
|
|
||||||
LINUX_CI_IN_DOCKER: 0
|
|
||||||
run: |
|
|
||||||
make test_release
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.extension_name }}-${{ inputs.duckdb_version }}-extension-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
path: |
|
|
||||||
build/release/extension/${{ inputs.extension_name }}/${{ inputs.extension_name }}.duckdb_extension
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
if-no-files-found: error
|
|
||||||
name: test-ssl-${{ inputs.duckdb_version }}-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
path: build/release/extension/ui/test-ssl/test_ssl
|
|
||||||
|
|
||||||
- name: Print Rust logs
|
|
||||||
if: ${{ inputs.rust_logs && (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;')) }}
|
|
||||||
run: |
|
|
||||||
for filename in build/release/rust/src/*/*build-*.log; do
|
|
||||||
echo Printing logs for file $filename
|
|
||||||
cat $filename;
|
|
||||||
echo Done printing logs for $filename
|
|
||||||
done
|
|
||||||
|
|
||||||
macos:
|
|
||||||
name: MacOS
|
|
||||||
runs-on: macos-latest
|
|
||||||
needs: generate_matrix
|
|
||||||
if: ${{ needs.generate_matrix.outputs.osx_matrix != '{}' && needs.generate_matrix.outputs.osx_matrix != '' }}
|
|
||||||
strategy:
|
|
||||||
matrix: ${{fromJson(needs.generate_matrix.outputs.osx_matrix)}}
|
|
||||||
env:
|
|
||||||
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
|
||||||
OSX_BUILD_ARCH: ${{ matrix.osx_build_arch }}
|
|
||||||
GEN: ninja
|
|
||||||
BUILD_SHELL: ${{ inputs.build_duckdb_shell && '1' || '0' }}
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout override repository
|
|
||||||
if: ${{inputs.override_repository != ''}}
|
|
||||||
with:
|
|
||||||
repository: ${{ inputs.override_repository }}
|
|
||||||
ref: ${{ inputs.override_ref }}
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout current repository
|
|
||||||
if: ${{inputs.override_repository == ''}}
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- name: Install Ninja
|
|
||||||
run: |
|
|
||||||
brew install ninja autoconf make libtool automake autoconf-archive
|
|
||||||
|
|
||||||
- name: Setup Ccache
|
|
||||||
uses: hendrikmuhs/ccache-action@main
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
key: extension-distribution-${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout Extension CI tools
|
|
||||||
with:
|
|
||||||
path: 'extension-ci-tools'
|
|
||||||
ref: ${{ inputs.ci_tools_version }}
|
|
||||||
repository: ${{ inputs.override_ci_tools_repository }}
|
|
||||||
|
|
||||||
- name: Checkout DuckDB to version
|
|
||||||
if: ${{inputs.duckdb_version != ''}}
|
|
||||||
run: |
|
|
||||||
DUCKDB_GIT_VERSION=${{ inputs.duckdb_version }} make set_duckdb_version
|
|
||||||
|
|
||||||
- name: Tag extension
|
|
||||||
if: ${{inputs.extension_tag != ''}}
|
|
||||||
run: |
|
|
||||||
git tag ${{ inputs.extension_tag }}
|
|
||||||
|
|
||||||
- name: Tag DuckDB extension
|
|
||||||
if: ${{inputs.duckdb_tag != ''}}
|
|
||||||
run: |
|
|
||||||
DUCKDB_TAG=${{ inputs.duckdb_tag }} make set_duckdb_tag
|
|
||||||
|
|
||||||
- name: Setup vcpkg
|
|
||||||
uses: lukka/run-vcpkg@v11.1
|
|
||||||
with:
|
|
||||||
vcpkgGitCommitId: ${{ inputs.vcpkg_commit }}
|
|
||||||
vcpkgGitURL: ${{ inputs.vcpkg_url }}
|
|
||||||
|
|
||||||
- name: Install Rust cross compile dependency
|
|
||||||
if: ${{ (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;')) && matrix.osx_build_arch == 'x86_64'}}
|
|
||||||
run: |
|
|
||||||
rustup target add x86_64-apple-darwin
|
|
||||||
|
|
||||||
- name: 'Setup go'
|
|
||||||
if: ${{ (inputs.enable_go || contains(format(';{0};', inputs.extra_toolchains), ';go;'))}}
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '1.23'
|
|
||||||
|
|
||||||
- name: Install parser tools
|
|
||||||
if: ${{ contains(format(';{0};', inputs.extra_toolchains), ';parser_tools;')}}
|
|
||||||
run: |
|
|
||||||
brew install bison flex
|
|
||||||
|
|
||||||
- name: install omp (x86)
|
|
||||||
if: ${{ contains(format(';{0};', inputs.extra_toolchains), ';omp;') && matrix.duckdb_arch == 'osx_amd64' }}
|
|
||||||
run: |
|
|
||||||
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
|
||||||
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/runner/.bash_profile
|
|
||||||
eval "$(/usr/local/bin/brew shellenv)"
|
|
||||||
arch -x86_64 brew install libomp
|
|
||||||
echo "LDFLAGS=-L/usr/local/opt/libomp/lib" >> $GITHUB_ENV
|
|
||||||
echo "CFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV
|
|
||||||
echo "CPPFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV
|
|
||||||
echo "CXXFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: install omp (arm)
|
|
||||||
if: ${{ contains(format(';{0};', inputs.extra_toolchains), ';omp;') && matrix.duckdb_arch == 'osx_arm64' }}
|
|
||||||
run: |
|
|
||||||
brew install libomp
|
|
||||||
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib" >> $GITHUB_ENV
|
|
||||||
echo "CFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
|
|
||||||
echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
|
|
||||||
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Run configure
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
DUCKDB_GIT_VERSION: ${{ inputs.duckdb_version }}
|
|
||||||
run: |
|
|
||||||
make configure_ci
|
|
||||||
|
|
||||||
- name: Build extension
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
make release
|
|
||||||
|
|
||||||
- name: Test Extension
|
|
||||||
if: ${{ matrix.osx_build_arch == 'arm64' && inputs.skip_tests == false }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
make test_release
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
if-no-files-found: error
|
|
||||||
name: ${{ inputs.extension_name }}-${{ inputs.duckdb_version }}-extension-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
path: |
|
|
||||||
build/release/extension/${{ inputs.extension_name }}/${{ inputs.extension_name }}.duckdb_extension
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
if-no-files-found: error
|
|
||||||
name: test-ssl-${{ inputs.duckdb_version }}-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
path: build/release/extension/ui/test-ssl/test_ssl
|
|
||||||
|
|
||||||
- name: Print Rust logs
|
|
||||||
if: ${{ inputs.rust_logs && (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;')) }}
|
|
||||||
run: |
|
|
||||||
for filename in build/release/rust/src/*/*build-*.log; do
|
|
||||||
echo Printing logs for file $filename
|
|
||||||
cat $filename;
|
|
||||||
echo Done printing logs for $filename
|
|
||||||
done
|
|
||||||
|
|
||||||
windows:
|
|
||||||
name: Windows
|
|
||||||
runs-on: windows-2019
|
|
||||||
needs: generate_matrix
|
|
||||||
if: ${{ needs.generate_matrix.outputs.windows_matrix != '{}' && needs.generate_matrix.outputs.windows_matrix != '' }}
|
|
||||||
strategy:
|
|
||||||
matrix: ${{fromJson(needs.generate_matrix.outputs.windows_matrix)}}
|
|
||||||
env:
|
|
||||||
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
|
||||||
BUILD_SHELL: ${{ inputs.build_duckdb_shell && '1' || '0' }}
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
CC: ${{ (matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw') && 'gcc' || '' }}
|
|
||||||
CXX: ${{ (matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw') && 'g++' || '' }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Keep \n line endings
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
git config --global core.autocrlf false
|
|
||||||
git config --global core.eol lf
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout override repository
|
|
||||||
if: ${{inputs.override_repository != ''}}
|
|
||||||
with:
|
|
||||||
repository: ${{ inputs.override_repository }}
|
|
||||||
ref: ${{ inputs.override_ref }}
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout current repository
|
|
||||||
if: ${{inputs.override_repository == ''}}
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
|
|
||||||
- name: Setup Rust
|
|
||||||
if: (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;'))
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: 'Setup go'
|
|
||||||
if: ${{ (inputs.enable_go || contains(format(';{0};', inputs.extra_toolchains), ';go;'))}}
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '1.23'
|
|
||||||
|
|
||||||
- name: Install parser tools
|
|
||||||
if: ${{ contains(format(';{0};', inputs.extra_toolchains), ';parser_tools;')}}
|
|
||||||
run: |
|
|
||||||
choco install winflexbison3
|
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-r@v2
|
|
||||||
if: matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw'
|
|
||||||
with:
|
|
||||||
r-version: 'devel'
|
|
||||||
update-rtools: true
|
|
||||||
rtools-version: '42' # linker bug in 43
|
|
||||||
|
|
||||||
- name: setup rtools gcc for vcpkg
|
|
||||||
if: matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw'
|
|
||||||
run: |
|
|
||||||
cp C:/rtools42/x86_64-w64-mingw32.static.posix/bin/gcc.exe C:/rtools42/x86_64-w64-mingw32.static.posix/bin/x86_64-w64-mingw32-gcc.exe
|
|
||||||
cp C:/rtools42/x86_64-w64-mingw32.static.posix/bin/g++.exe C:/rtools42/x86_64-w64-mingw32.static.posix/bin/x86_64-w64-mingw32-g++.exe
|
|
||||||
cp C:/rtools42/x86_64-w64-mingw32.static.posix/bin/gfortran.exe C:/rtools42/x86_64-w64-mingw32.static.posix/bin/x86_64-w64-mingw32-gfortran.exe
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout Extension CI tools
|
|
||||||
with:
|
|
||||||
path: 'extension-ci-tools'
|
|
||||||
ref: ${{ inputs.ci_tools_version }}
|
|
||||||
repository: ${{ inputs.override_ci_tools_repository }}
|
|
||||||
|
|
||||||
- name: Checkout DuckDB to version
|
|
||||||
if: ${{inputs.duckdb_version != ''}}
|
|
||||||
env:
|
|
||||||
DUCKDB_GIT_VERSION: ${{ inputs.duckdb_version }}
|
|
||||||
run: |
|
|
||||||
make set_duckdb_version
|
|
||||||
|
|
||||||
- name: Tag extension
|
|
||||||
if: ${{inputs.extension_tag != ''}}
|
|
||||||
run: |
|
|
||||||
git tag ${{ inputs.extension_tag }}
|
|
||||||
|
|
||||||
- name: Tag DuckDB extension
|
|
||||||
if: ${{inputs.duckdb_tag != ''}}
|
|
||||||
env:
|
|
||||||
DUCKDB_TAG: ${{ inputs.duckdb_tag }}
|
|
||||||
run: |
|
|
||||||
make set_duckdb_tag
|
|
||||||
|
|
||||||
- name: Setup Ccache
|
|
||||||
uses: hendrikmuhs/ccache-action@main
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
key: ${{ github.job }}-${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
- name: Setup vcpkg
|
|
||||||
uses: lukka/run-vcpkg@v11.1
|
|
||||||
with:
|
|
||||||
vcpkgGitCommitId: ${{ inputs.vcpkg_commit }}
|
|
||||||
vcpkgGitURL: ${{ inputs.vcpkg_url }}
|
|
||||||
|
|
||||||
- name: Run configure
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
DUCKDB_PLATFORM_RTOOLS: ${{ (matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw') && 1 || 0 }}
|
|
||||||
DUCKDB_GIT_VERSION: ${{ inputs.duckdb_version }}
|
|
||||||
run: |
|
|
||||||
make configure_ci
|
|
||||||
|
|
||||||
- name: Build extension
|
|
||||||
env:
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
DUCKDB_PLATFORM_RTOOLS: ${{ (matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw') && 1 || 0 }}
|
|
||||||
run: |
|
|
||||||
make release
|
|
||||||
|
|
||||||
- name: Test extension
|
|
||||||
if: ${{ inputs.skip_tests == false }}
|
|
||||||
env:
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
DUCKDB_PLATFORM_RTOOLS: ${{ (matrix.duckdb_arch == 'windows_amd64_rtools' || matrix.duckdb_arch == 'windows_amd64_mingw') && 1 || 0 }}
|
|
||||||
run: |
|
|
||||||
make test_release
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
if-no-files-found: error
|
|
||||||
name: ${{ inputs.extension_name }}-${{ inputs.duckdb_version }}-extension-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
path: |
|
|
||||||
build/release/extension/${{ inputs.extension_name }}/${{ inputs.extension_name }}.duckdb_extension
|
|
||||||
|
|
||||||
- name: Find test_ssl
|
|
||||||
shell: bash
|
|
||||||
run: find . -name 'test_ssl.exe'
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
if-no-files-found: error
|
|
||||||
name: test-ssl-${{ inputs.duckdb_version }}-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
# MinGW: build/release/extension/ui/test-ssl/test_ssl.exe
|
|
||||||
# Windows: build/release/extension/ui/test-ssl/Release/test_ssl.exe
|
|
||||||
path: build/release/extension/ui/test-ssl/**/test_ssl.exe
|
|
||||||
|
|
||||||
|
|
||||||
- name: Print Rust logs
|
|
||||||
if: ${{ inputs.rust_logs && (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;')) }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
for filename in build/release/rust/src/*/*build-*.log; do
|
|
||||||
echo Printing logs for file $filename
|
|
||||||
cat $filename;
|
|
||||||
echo Done printing logs for $filename
|
|
||||||
done
|
|
||||||
|
|
||||||
wasm:
|
|
||||||
name: DuckDB-Wasm
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: generate_matrix
|
|
||||||
if: ${{ needs.generate_matrix.outputs.wasm_matrix != '{}' && needs.generate_matrix.outputs.wasm_matrix != '' }}
|
|
||||||
strategy:
|
|
||||||
matrix: ${{fromJson(needs.generate_matrix.outputs.wasm_matrix)}}
|
|
||||||
env:
|
|
||||||
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
|
||||||
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
DUCKDB_PLATFORM: ${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout override repository
|
|
||||||
if: ${{inputs.override_repository != ''}}
|
|
||||||
with:
|
|
||||||
repository: ${{ inputs.override_repository }}
|
|
||||||
ref: ${{ inputs.override_ref }}
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout current repository
|
|
||||||
if: ${{inputs.override_repository == ''}}
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
submodules: 'true'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout Extension CI tools
|
|
||||||
with:
|
|
||||||
path: 'extension-ci-tools'
|
|
||||||
ref: ${{ inputs.ci_tools_version }}
|
|
||||||
repository: ${{ inputs.override_ci_tools_repository }}
|
|
||||||
|
|
||||||
- name: Checkout DuckDB to version
|
|
||||||
if: ${{inputs.duckdb_version != ''}}
|
|
||||||
run: |
|
|
||||||
DUCKDB_GIT_VERSION=${{ inputs.duckdb_version }} make set_duckdb_version
|
|
||||||
|
|
||||||
- name: Tag extension
|
|
||||||
if: ${{inputs.extension_tag != ''}}
|
|
||||||
run: |
|
|
||||||
git tag ${{ inputs.extension_tag }}
|
|
||||||
|
|
||||||
- name: Tag DuckDB extension
|
|
||||||
if: ${{inputs.duckdb_tag != ''}}
|
|
||||||
run: |
|
|
||||||
DUCKDB_TAG=${{ inputs.duckdb_tag }} make set_duckdb_tag
|
|
||||||
|
|
||||||
- uses: mymindstorm/setup-emsdk@v13
|
|
||||||
with:
|
|
||||||
version: 3.1.71
|
|
||||||
|
|
||||||
- name: Setup Rust for cross compilation
|
|
||||||
if: ${{ (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;'))}}
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: wasm32-unknown-emscripten
|
|
||||||
|
|
||||||
- name: 'Setup go'
|
|
||||||
if: ${{ (inputs.enable_go || contains(format(';{0};', inputs.extra_toolchains), ';go;'))}}
|
|
||||||
uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '1.23'
|
|
||||||
|
|
||||||
- name: Setup vcpkg
|
|
||||||
uses: lukka/run-vcpkg@v11.1
|
|
||||||
with:
|
|
||||||
vcpkgGitCommitId: ${{ inputs.vcpkg_commit }}
|
|
||||||
vcpkgGitURL: ${{ inputs.vcpkg_url }}
|
|
||||||
|
|
||||||
- name: Setup Ccache
|
|
||||||
uses: hendrikmuhs/ccache-action@main
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
key: ${{ github.job }}-${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
- name: Run configure
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
DUCKDB_GIT_VERSION: ${{ inputs.duckdb_version }}
|
|
||||||
run: |
|
|
||||||
make configure_ci
|
|
||||||
|
|
||||||
- name: Build Wasm module
|
|
||||||
run: |
|
|
||||||
make ${{ matrix.duckdb_arch }}
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
if-no-files-found: error
|
|
||||||
name: ${{ inputs.extension_name }}-${{ inputs.duckdb_version }}-extension-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
|
|
||||||
path: |
|
|
||||||
build/${{ matrix.duckdb_arch }}/extension/${{ inputs.extension_name }}/${{ inputs.extension_name }}.duckdb_extension.wasm
|
|
||||||
|
|
||||||
- name: Print Rust logs
|
|
||||||
if: ${{ inputs.rust_logs && (inputs.enable_rust || contains(format(';{0};', inputs.extra_toolchains), ';rust;')) }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
for filename in build/release/rust/src/*/*build-*.log; do
|
|
||||||
echo Printing logs for file $filename
|
|
||||||
cat $filename;
|
|
||||||
echo Done printing logs for $filename
|
|
||||||
done
|
|
||||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,7 +1,7 @@
|
|||||||
[submodule "duckdb"]
|
[submodule "duckdb"]
|
||||||
path = duckdb
|
path = duckdb
|
||||||
url = https://github.com/duckdb/duckdb
|
url = https://github.com/duckdb/duckdb
|
||||||
branch = v1.2.1
|
branch = v1.3.0
|
||||||
[submodule "extension-ci-tools"]
|
[submodule "extension-ci-tools"]
|
||||||
path = extension-ci-tools
|
path = extension-ci-tools
|
||||||
url = https://github.com/duckdb/extension-ci-tools
|
url = https://github.com/duckdb/extension-ci-tools
|
||||||
|
|||||||
@@ -60,5 +60,3 @@ install(
|
|||||||
EXPORT "${DUCKDB_EXPORT_SET}"
|
EXPORT "${DUCKDB_EXPORT_SET}"
|
||||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
|
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
|
||||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
|
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
|
||||||
|
|
||||||
add_subdirectory(test-ssl)
|
|
||||||
2
duckdb
2
duckdb
Submodule duckdb updated: 8e52ec4395...71c5c07cdd
Submodule extension-ci-tools updated: 00e6af0684...b3a2f0d29e
@@ -9,6 +9,7 @@
|
|||||||
#include "utils/serialization.hpp"
|
#include "utils/serialization.hpp"
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
#include "watcher.hpp"
|
#include "watcher.hpp"
|
||||||
|
#include <duckdb/common/http_util.hpp>
|
||||||
#include <duckdb/common/serializer/binary_serializer.hpp>
|
#include <duckdb/common/serializer/binary_serializer.hpp>
|
||||||
#include <duckdb/common/serializer/memory_stream.hpp>
|
#include <duckdb/common/serializer/memory_stream.hpp>
|
||||||
#include <duckdb/main/attached_database.hpp>
|
#include <duckdb/main/attached_database.hpp>
|
||||||
@@ -94,13 +95,17 @@ const HttpServer &HttpServer::Start(ClientContext &context, bool *was_started) {
|
|||||||
|
|
||||||
const auto remote_url = GetRemoteUrl(context);
|
const auto remote_url = GetRemoteUrl(context);
|
||||||
const auto port = GetLocalPort(context);
|
const auto port = GetLocalPort(context);
|
||||||
|
auto &http_util = HTTPUtil::Get(*context.db);
|
||||||
|
// FIXME - https://github.com/duckdb/duckdb/pull/17655 will remove `unused`
|
||||||
|
auto http_params = http_util.InitializeParameters(context, "unused");
|
||||||
auto server = GetInstance(context);
|
auto server = GetInstance(context);
|
||||||
server->DoStart(port, remote_url);
|
server->DoStart(port, remote_url, std::move(http_params));
|
||||||
return *server;
|
return *server;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpServer::DoStart(const uint16_t _local_port,
|
void HttpServer::DoStart(const uint16_t _local_port,
|
||||||
const std::string &_remote_url) {
|
const std::string &_remote_url,
|
||||||
|
unique_ptr<HTTPParams> _http_params) {
|
||||||
if (Started()) {
|
if (Started()) {
|
||||||
throw std::runtime_error("HttpServer already started");
|
throw std::runtime_error("HttpServer already started");
|
||||||
}
|
}
|
||||||
@@ -108,6 +113,7 @@ void HttpServer::DoStart(const uint16_t _local_port,
|
|||||||
local_port = _local_port;
|
local_port = _local_port;
|
||||||
local_url = StringUtil::Format("http://localhost:%d", local_port);
|
local_url = StringUtil::Format("http://localhost:%d", local_port);
|
||||||
remote_url = _remote_url;
|
remote_url = _remote_url;
|
||||||
|
http_params = std::move(_http_params);
|
||||||
user_agent =
|
user_agent =
|
||||||
StringUtil::Format("duckdb-ui/%s-%s(%s)", DuckDB::LibraryVersion(),
|
StringUtil::Format("duckdb-ui/%s-%s(%s)", DuckDB::LibraryVersion(),
|
||||||
UI_EXTENSION_VERSION, DuckDB::Platform());
|
UI_EXTENSION_VERSION, DuckDB::Platform());
|
||||||
@@ -144,6 +150,7 @@ void HttpServer::DoStop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ddb_instance.reset();
|
ddb_instance.reset();
|
||||||
|
http_params = nullptr;
|
||||||
remote_url = "";
|
remote_url = "";
|
||||||
local_port = 0;
|
local_port = 0;
|
||||||
}
|
}
|
||||||
@@ -240,19 +247,47 @@ void HttpServer::HandleGetLocalToken(const httplib::Request &req,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adapted from
|
||||||
|
// https://github.com/duckdb/duckdb/blob/1f8b6839ea7864c3e3fb020574f67384cb58124c/src/main/http/http_util.cpp#L129-L147
|
||||||
|
// Which is not currently exposed.
|
||||||
|
void HttpServer::InitClientFromParams(httplib::Client &client) {
|
||||||
|
auto sec = static_cast<time_t>(http_params->timeout);
|
||||||
|
auto usec = static_cast<time_t>(http_params->timeout_usec);
|
||||||
|
client.set_keep_alive(true);
|
||||||
|
client.set_write_timeout(sec, usec);
|
||||||
|
client.set_read_timeout(sec, usec);
|
||||||
|
client.set_connection_timeout(sec, usec);
|
||||||
|
|
||||||
|
if (!http_params->http_proxy.empty()) {
|
||||||
|
client.set_proxy(http_params->http_proxy,
|
||||||
|
static_cast<int>(http_params->http_proxy_port));
|
||||||
|
|
||||||
|
if (!http_params->http_proxy_username.empty()) {
|
||||||
|
client.set_proxy_basic_auth(http_params->http_proxy_username,
|
||||||
|
http_params->http_proxy_password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HttpServer::HandleGet(const httplib::Request &req,
|
void HttpServer::HandleGet(const httplib::Request &req,
|
||||||
httplib::Response &res) {
|
httplib::Response &res) {
|
||||||
// Create HTTP client to remote URL
|
// Create HTTP client to remote URL
|
||||||
// TODO: Can this be created once and shared?
|
// TODO: Can this be created once and shared?
|
||||||
httplib::Client client(remote_url);
|
httplib::Client client(remote_url);
|
||||||
client.set_keep_alive(true);
|
InitClientFromParams(client);
|
||||||
|
|
||||||
if (IsEnvEnabled("ui_disable_server_certificate_verification")) {
|
if (IsEnvEnabled("ui_disable_server_certificate_verification")) {
|
||||||
client.enable_server_certificate_verification(false);
|
client.enable_server_certificate_verification(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
httplib::Headers headers = {{"User-Agent", user_agent}};
|
||||||
|
auto cookie = req.get_header_value("Cookie");
|
||||||
|
if (!cookie.empty()) {
|
||||||
|
headers.emplace("Cookie", cookie);
|
||||||
|
}
|
||||||
|
|
||||||
// forward GET to remote URL
|
// forward GET to remote URL
|
||||||
auto result = client.Get(req.path, req.params, {{"User-Agent", user_agent}});
|
auto result = client.Get(req.path, req.params, headers);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
res.status = 500;
|
res.status = 500;
|
||||||
res.set_content("Could not fetch: '" + req.path + "' from '" + remote_url +
|
res.set_content("Could not fetch: '" + req.path + "' from '" + remote_url +
|
||||||
@@ -366,13 +401,63 @@ void HttpServer::DoHandleRun(const httplib::Request &req,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unique_ptr<SQLStatement> last_statement;
|
||||||
|
|
||||||
|
auto statements = connection->ExtractStatements(content);
|
||||||
|
auto statement_count = statements.size();
|
||||||
|
|
||||||
|
if (statement_count == 0) {
|
||||||
|
SetResponseErrorResult(res, "No statements");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there's more than one statement, run all but the last.
|
||||||
|
if (statement_count > 1) {
|
||||||
|
for (auto i = 0; i < statement_count - 1; ++i) {
|
||||||
|
auto pending = connection->PendingQuery(std::move(statements[i]));
|
||||||
|
// Return any error found before execution.
|
||||||
|
if (pending->HasError()) {
|
||||||
|
SetResponseErrorResult(res, pending->GetError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Execute tasks until result is ready (or there's an error).
|
||||||
|
auto exec_result = PendingExecutionResult::RESULT_NOT_READY;
|
||||||
|
while (!PendingQueryResult::IsResultReady(exec_result)) {
|
||||||
|
exec_result = pending->ExecuteTask();
|
||||||
|
if (exec_result == PendingExecutionResult::BLOCKED ||
|
||||||
|
exec_result == PendingExecutionResult::NO_TASKS_AVAILABLE) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Return any error found during execution.
|
||||||
|
switch (exec_result) {
|
||||||
|
case PendingExecutionResult::EXECUTION_ERROR:
|
||||||
|
SetResponseErrorResult(res, pending->GetError());
|
||||||
|
return;
|
||||||
|
case PendingExecutionResult::EXECUTION_FINISHED:
|
||||||
|
case PendingExecutionResult::RESULT_READY:
|
||||||
|
// ignore the result
|
||||||
|
pending->Execute();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SetResponseErrorResult(
|
||||||
|
res, StringUtil::Format("Unexpected PendingExecutionResult: %s",
|
||||||
|
exec_result));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the last statement.
|
||||||
|
auto &statement_to_run = statements[statement_count - 1];
|
||||||
|
|
||||||
// We use a pending query so we can execute tasks and fetch chunks
|
// We use a pending query so we can execute tasks and fetch chunks
|
||||||
// incrementally. This enables cancellation.
|
// incrementally. This enables cancellation.
|
||||||
unique_ptr<PendingQueryResult> pending;
|
unique_ptr<PendingQueryResult> pending;
|
||||||
|
|
||||||
// Create pending query, with request content as SQL.
|
// Create pending query, with request content as SQL.
|
||||||
if (parameter_values.size() > 0) {
|
if (parameter_values.size() > 0) {
|
||||||
auto prepared = connection->Prepare(content);
|
auto prepared = connection->Prepare(std::move(statement_to_run));
|
||||||
if (prepared->HasError()) {
|
if (prepared->HasError()) {
|
||||||
SetResponseErrorResult(res, prepared->GetError());
|
SetResponseErrorResult(res, prepared->GetError());
|
||||||
return;
|
return;
|
||||||
@@ -385,7 +470,7 @@ void HttpServer::DoHandleRun(const httplib::Request &req,
|
|||||||
}
|
}
|
||||||
pending = prepared->PendingQuery(values, true);
|
pending = prepared->PendingQuery(values, true);
|
||||||
} else {
|
} else {
|
||||||
pending = connection->PendingQuery(content, true);
|
pending = connection->PendingQuery(std::move(statement_to_run), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pending->HasError()) {
|
if (pending->HasError()) {
|
||||||
@@ -433,7 +518,9 @@ void HttpServer::DoHandleRun(const httplib::Request &req,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
SetResponseErrorResult(res, "Unexpected PendingExecutionResult");
|
SetResponseErrorResult(
|
||||||
|
res, StringUtil::Format("Unexpected PendingExecutionResult: %s",
|
||||||
|
exec_result));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <duckdb.hpp>
|
#include <duckdb.hpp>
|
||||||
|
#include <duckdb/common/http_util.hpp>
|
||||||
|
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
#include "httplib.hpp"
|
#include "httplib.hpp"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
namespace httplib = duckdb_httplib_openssl;
|
namespace httplib = duckdb_httplib_openssl;
|
||||||
|
|
||||||
namespace duckdb {
|
namespace duckdb {
|
||||||
|
class HTTPParams;
|
||||||
class MemoryStream;
|
class MemoryStream;
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
@@ -40,7 +42,8 @@ private:
|
|||||||
friend class Watcher;
|
friend class Watcher;
|
||||||
|
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
void DoStart(const uint16_t local_port, const std::string &remote_url);
|
void DoStart(const uint16_t local_port, const std::string &remote_url,
|
||||||
|
unique_ptr<HTTPParams>);
|
||||||
void DoStop();
|
void DoStop();
|
||||||
void Run();
|
void Run();
|
||||||
void UpdateDatabaseInstance(shared_ptr<DatabaseInstance> context_db);
|
void UpdateDatabaseInstance(shared_ptr<DatabaseInstance> context_db);
|
||||||
@@ -67,6 +70,7 @@ private:
|
|||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
shared_ptr<DatabaseInstance> LockDatabaseInstance();
|
shared_ptr<DatabaseInstance> LockDatabaseInstance();
|
||||||
|
void InitClientFromParams(httplib::Client &);
|
||||||
|
|
||||||
uint16_t local_port;
|
uint16_t local_port;
|
||||||
std::string local_url;
|
std::string local_url;
|
||||||
@@ -77,6 +81,7 @@ private:
|
|||||||
unique_ptr<std::thread> main_thread;
|
unique_ptr<std::thread> main_thread;
|
||||||
unique_ptr<EventDispatcher> event_dispatcher;
|
unique_ptr<EventDispatcher> event_dispatcher;
|
||||||
unique_ptr<Watcher> watcher;
|
unique_ptr<Watcher> watcher;
|
||||||
|
unique_ptr<HTTPParams> http_params;
|
||||||
|
|
||||||
static unique_ptr<HttpServer> server_instance;
|
static unique_ptr<HttpServer> server_instance;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ namespace duckdb {
|
|||||||
|
|
||||||
class UiExtension : public Extension {
|
class UiExtension : public Extension {
|
||||||
public:
|
public:
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
void Load(ExtensionLoader &loader) override;
|
||||||
|
#else
|
||||||
void Load(DuckDB &db) override;
|
void Load(DuckDB &db) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string Name() override;
|
std::string Name() override;
|
||||||
std::string Version() const override;
|
std::string Version() const override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <duckdb.hpp>
|
#include <duckdb.hpp>
|
||||||
|
#ifndef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
#include <duckdb/main/extension_util.hpp>
|
#include <duckdb/main/extension_util.hpp>
|
||||||
|
#endif
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace duckdb {
|
namespace duckdb {
|
||||||
@@ -64,6 +66,15 @@ void TableFunc(ClientContext &context, TableFunctionInput &input,
|
|||||||
output.SetValue(0, 0, result);
|
output.SetValue(0, 0, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
template <typename Func, Func func>
|
||||||
|
void RegisterTF(ExtensionLoader &loader, const char *name) {
|
||||||
|
TableFunction tf(name, {}, internal::TableFunc<Func, func>,
|
||||||
|
internal::SingleStringResultBind,
|
||||||
|
RunOnceTableFunctionState::Init);
|
||||||
|
loader.RegisterFunction(tf);
|
||||||
|
}
|
||||||
|
#else
|
||||||
template <typename Func, Func func>
|
template <typename Func, Func func>
|
||||||
void RegisterTF(DatabaseInstance &instance, const char *name) {
|
void RegisterTF(DatabaseInstance &instance, const char *name) {
|
||||||
TableFunction tf(name, {}, internal::TableFunc<Func, func>,
|
TableFunction tf(name, {}, internal::TableFunc<Func, func>,
|
||||||
@@ -71,10 +82,16 @@ void RegisterTF(DatabaseInstance &instance, const char *name) {
|
|||||||
RunOnceTableFunctionState::Init);
|
RunOnceTableFunctionState::Init);
|
||||||
ExtensionUtil::RegisterFunction(instance, tf);
|
ExtensionUtil::RegisterFunction(instance, tf);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
#define REGISTER_TF(name, func) \
|
||||||
|
internal::RegisterTF<decltype(&func), &func>(loader, name)
|
||||||
|
#else
|
||||||
#define REGISTER_TF(name, func) \
|
#define REGISTER_TF(name, func) \
|
||||||
internal::RegisterTF<decltype(&func), &func>(instance, name)
|
internal::RegisterTF<decltype(&func), &func>(instance, name)
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace duckdb
|
} // namespace duckdb
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define OPEN_COMMAND "start"
|
#define OPEN_COMMAND "start"
|
||||||
|
#undef CreateDirectory // avoid being transformed to `CreateDirectoryA`
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
#define OPEN_COMMAND "xdg-open"
|
#define OPEN_COMMAND "xdg-open"
|
||||||
#else
|
#else
|
||||||
@@ -81,7 +82,12 @@ void InitStorageExtension(duckdb::DatabaseInstance &db) {
|
|||||||
config.storage_extensions[STORAGE_EXTENSION_KEY] = std::move(ext);
|
config.storage_extensions[STORAGE_EXTENSION_KEY] = std::move(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
static void LoadInternal(ExtensionLoader &loader) {
|
||||||
|
auto &instance = loader.GetDatabaseInstance();
|
||||||
|
#else
|
||||||
static void LoadInternal(DatabaseInstance &instance) {
|
static void LoadInternal(DatabaseInstance &instance) {
|
||||||
|
#endif
|
||||||
InitStorageExtension(instance);
|
InitStorageExtension(instance);
|
||||||
|
|
||||||
// If the server is already running we need to update the database instance
|
// If the server is already running we need to update the database instance
|
||||||
@@ -128,11 +134,20 @@ static void LoadInternal(DatabaseInstance &instance) {
|
|||||||
TableFunction tf("ui_is_started", {}, IsUIStartedTableFunc,
|
TableFunction tf("ui_is_started", {}, IsUIStartedTableFunc,
|
||||||
internal::SingleBoolResultBind,
|
internal::SingleBoolResultBind,
|
||||||
RunOnceTableFunctionState::Init);
|
RunOnceTableFunctionState::Init);
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
loader.RegisterFunction(tf);
|
||||||
|
#else
|
||||||
ExtensionUtil::RegisterFunction(instance, tf);
|
ExtensionUtil::RegisterFunction(instance, tf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
void UiExtension::Load(ExtensionLoader &loader) { LoadInternal(loader); }
|
||||||
|
#else
|
||||||
void UiExtension::Load(DuckDB &db) { LoadInternal(*db.instance); }
|
void UiExtension::Load(DuckDB &db) { LoadInternal(*db.instance); }
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string UiExtension::Name() { return "ui"; }
|
std::string UiExtension::Name() { return "ui"; }
|
||||||
|
|
||||||
std::string UiExtension::Version() const { return UI_EXTENSION_VERSION; }
|
std::string UiExtension::Version() const { return UI_EXTENSION_VERSION; }
|
||||||
@@ -141,10 +156,14 @@ std::string UiExtension::Version() const { return UI_EXTENSION_VERSION; }
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
#ifdef DUCKDB_CPP_EXTENSION_ENTRY
|
||||||
|
DUCKDB_CPP_EXTENSION_ENTRY(ui, loader) { duckdb::LoadInternal(loader); }
|
||||||
|
#else
|
||||||
DUCKDB_EXTENSION_API void ui_init(duckdb::DatabaseInstance &db) {
|
DUCKDB_EXTENSION_API void ui_init(duckdb::DatabaseInstance &db) {
|
||||||
duckdb::DuckDB db_wrapper(db);
|
duckdb::DuckDB db_wrapper(db);
|
||||||
db_wrapper.LoadExtension<duckdb::UiExtension>();
|
db_wrapper.LoadExtension<duckdb::UiExtension>();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DUCKDB_EXTENSION_API const char *ui_version() {
|
DUCKDB_EXTENSION_API const char *ui_version() {
|
||||||
return duckdb::DuckDB::LibraryVersion();
|
return duckdb::DuckDB::LibraryVersion();
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.5...3.31.5)
|
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
|
||||||
|
|
||||||
project("Test ssl")
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
|
|
||||||
add_definitions(-DNO_DUCKDB_RE2 -DCMAKE_BUILD_TYPE=Debug)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
|
|
||||||
|
|
||||||
include_directories(
|
|
||||||
${PROJECT_SOURCE_DIR}/../third_party/httplib
|
|
||||||
${PROJECT_SOURCE_DIR}/../duckdb/src/include)
|
|
||||||
|
|
||||||
add_executable("test_ssl" "test_ssl.cc")
|
|
||||||
|
|
||||||
target_link_libraries("test_ssl" OpenSSL::SSL OpenSSL::Crypto)
|
|
||||||
|
|
||||||
install(TARGETS "test_ssl")
|
|
||||||
|
|
||||||
# cmake -S . -G Ninja -B build && cmake --build build
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
#include "httplib.hpp"
|
|
||||||
|
|
||||||
using namespace duckdb_httplib_openssl;
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
Client client("https://ui.duckdb.org");
|
|
||||||
auto res = client.Get("/");
|
|
||||||
if (res) {
|
|
||||||
std::cout << "Status: " << res->status << std::endl;
|
|
||||||
std::cout << "Body: " << res->body.substr(0, 42) << "... (" << res->body.size() << ")" << std::endl;
|
|
||||||
} else {
|
|
||||||
std::cout << "Error: " << res.error() << std::endl;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
85
third_party/httplib/httplib.hpp
vendored
85
third_party/httplib/httplib.hpp
vendored
@@ -248,78 +248,8 @@ using socket_t = int;
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
#ifdef NO_DUCKDB_RE2
|
|
||||||
namespace duckdb_re2 {
|
|
||||||
enum class RegexOptions : uint8_t { NONE, CASE_INSENSITIVE };
|
|
||||||
class Regex {
|
|
||||||
public:
|
|
||||||
explicit Regex(const std::string &pattern, RegexOptions options = RegexOptions::NONE): re(pattern) {}
|
|
||||||
explicit Regex(const char *pattern, RegexOptions options = RegexOptions::NONE) : Regex(std::string(pattern)) {
|
|
||||||
}
|
|
||||||
// const duckdb_re2::RE2 &GetRegex() const {
|
|
||||||
// return *regex;
|
|
||||||
// }
|
|
||||||
std::regex re;
|
|
||||||
};
|
|
||||||
struct GroupMatch {
|
|
||||||
std::string text;
|
|
||||||
uint32_t position;
|
|
||||||
|
|
||||||
const std::string &str() const { // NOLINT
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
operator std::string() const { // NOLINT: allow implicit cast
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Match {
|
|
||||||
|
|
||||||
GroupMatch GetGroup(uint64_t index) {
|
|
||||||
return {str(index), static_cast<uint32_t>(position(index))};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string str(uint64_t index) { // NOLINT
|
|
||||||
return m.str(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t position(uint64_t index) { // NOLINT
|
|
||||||
return m.position(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t length(uint64_t index) { // NOLINT
|
|
||||||
throw std::runtime_error("uint64_t length(uint64_t index) - NA");
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupMatch operator[](uint64_t i) {
|
|
||||||
return GetGroup(i);
|
|
||||||
}
|
|
||||||
std::cmatch m;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool RegexSearch(const std::string &input, Match &match, const Regex ®ex) {
|
|
||||||
throw std::runtime_error("bool RegexSearch(const std::string &input, Match &match, const Regex ®ex) - NA");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RegexMatch(const std::string &input, Match &match, const Regex ®ex) {
|
|
||||||
return std::regex_match(input.c_str(), match.m, regex.re);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RegexMatch(const char *start, const char *end, Match &match, const Regex ®ex) {
|
|
||||||
throw std::runtime_error("bool RegexMatch(const char *start, const char *end, Match &match, const Regex ®ex) - NA");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RegexMatch(const std::string &input, const Regex ®ex) {
|
|
||||||
std::cmatch m;
|
|
||||||
return std::regex_match(input.c_str(), m, regex.re);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#include "duckdb/common/re2_regex.hpp"
|
#include "duckdb/common/re2_regex.hpp"
|
||||||
#include "duckdb/common/random_engine.hpp"
|
#include "duckdb/common/random_engine.hpp"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -4713,9 +4643,6 @@ inline std::string to_lower(const char *beg, const char *end) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline std::string make_multipart_data_boundary() {
|
inline std::string make_multipart_data_boundary() {
|
||||||
#ifdef NO_DUCKDB_RE2
|
|
||||||
throw std::runtime_error("NA");
|
|
||||||
#else
|
|
||||||
static const char data[] =
|
static const char data[] =
|
||||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
@@ -4726,7 +4653,6 @@ inline std::string make_multipart_data_boundary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_multipart_boundary_chars_valid(const std::string &boundary) {
|
inline bool is_multipart_boundary_chars_valid(const std::string &boundary) {
|
||||||
@@ -5183,7 +5109,6 @@ inline bool parse_www_authenticate(const Response &res,
|
|||||||
if (type == "Basic") {
|
if (type == "Basic") {
|
||||||
return false;
|
return false;
|
||||||
} else if (type == "Digest") {
|
} else if (type == "Digest") {
|
||||||
#ifndef NO_DUCKDB_RE2
|
|
||||||
s = s.substr(pos + 1);
|
s = s.substr(pos + 1);
|
||||||
auto matches = duckdb_re2::RegexFindAll(s, re);
|
auto matches = duckdb_re2::RegexFindAll(s, re);
|
||||||
for (auto &m : matches) {
|
for (auto &m : matches) {
|
||||||
@@ -5197,9 +5122,6 @@ inline bool parse_www_authenticate(const Response &res,
|
|||||||
auth[key] = val;
|
auth[key] = val;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
throw std::runtime_error("parse_www_authenticate- NA");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8244,10 +8166,6 @@ inline SSL *ssl_new(socket_t sock, SSL_CTX *ctx, std::mutex &ctx_mutex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ssl) {
|
if (ssl) {
|
||||||
#ifdef NO_DUCKDB_RE2
|
|
||||||
SSL_set_msg_callback(ssl, SSL_trace);
|
|
||||||
SSL_set_msg_callback_arg(ssl, BIO_new_fp(stdout, 0));
|
|
||||||
#endif
|
|
||||||
set_nonblocking(sock, true);
|
set_nonblocking(sock, true);
|
||||||
auto bio = BIO_new_socket(static_cast<int>(sock), BIO_NOCLOSE);
|
auto bio = BIO_new_socket(static_cast<int>(sock), BIO_NOCLOSE);
|
||||||
BIO_set_nbio(bio, 1);
|
BIO_set_nbio(bio, 1);
|
||||||
@@ -8760,7 +8678,6 @@ inline bool SSLClient::initialize_ssl(Socket &socket, Error &error) {
|
|||||||
verify_result_ = SSL_get_verify_result(ssl2);
|
verify_result_ = SSL_get_verify_result(ssl2);
|
||||||
|
|
||||||
if (verify_result_ != X509_V_OK) {
|
if (verify_result_ != X509_V_OK) {
|
||||||
std::cerr << "SSL_get_verify_result failed: " << verify_result_ << std::endl;
|
|
||||||
error = Error::SSLServerVerification;
|
error = Error::SSLServerVerification;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -8769,12 +8686,10 @@ inline bool SSLClient::initialize_ssl(Socket &socket, Error &error) {
|
|||||||
|
|
||||||
if (server_cert == nullptr) {
|
if (server_cert == nullptr) {
|
||||||
error = Error::SSLServerVerification;
|
error = Error::SSLServerVerification;
|
||||||
std::cerr << "SSL_get1_peer_certificate failed" << std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!verify_host(server_cert)) {
|
if (!verify_host(server_cert)) {
|
||||||
std::cerr << "verify_host failed" << std::endl;
|
|
||||||
X509_free(server_cert);
|
X509_free(server_cert);
|
||||||
error = Error::SSLServerVerification;
|
error = Error::SSLServerVerification;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user