chore: import upstream snapshot with attribution
CI / windows_test (push) Waiting to run
CI / compile_and_lint (push) Failing after 0s
CI / docker_build (linux/amd64, -linux-amd64-duckdb, duckdb) (push) Failing after 0s
CI / docker_build (linux/arm64, -linux-arm64, minimal) (push) Failing after 2s
CI / docker_build (linux/arm64, -linux-arm64-duckdb, duckdb) (push) Failing after 1s
CI / docker_build (linux/amd64, minimal) (push) Failing after 1s
CI / test (, sqlite, sqlite::memory:) (push) Has been skipped
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (push) Has been skipped
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been skipped
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / playwright (push) Has been skipped
CI / docker_build (linux/arm/v7, -linux-arm-v7, minimal) (push) Failing after 0s
CI / hurl_examples (push) Failing after 8s
deploy website / deploy_official_site (push) Failing after 1s
CI / docker_push (duckdb) (push) Waiting to run
CI / docker_push (minimal) (push) Waiting to run
CI / hurl (${{ matrix.example }}) (push) Has been skipped
CI / windows_test (push) Waiting to run
CI / compile_and_lint (push) Failing after 0s
CI / docker_build (linux/amd64, -linux-amd64-duckdb, duckdb) (push) Failing after 0s
CI / docker_build (linux/arm64, -linux-arm64, minimal) (push) Failing after 2s
CI / docker_build (linux/arm64, -linux-arm64-duckdb, duckdb) (push) Failing after 1s
CI / docker_build (linux/amd64, minimal) (push) Failing after 1s
CI / test (, sqlite, sqlite::memory:) (push) Has been skipped
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (push) Has been skipped
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been skipped
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / playwright (push) Has been skipped
CI / docker_build (linux/arm/v7, -linux-arm-v7, minimal) (push) Failing after 0s
CI / hurl_examples (push) Failing after 8s
deploy website / deploy_official_site (push) Failing after 1s
CI / docker_push (duckdb) (push) Waiting to run
CI / docker_push (minimal) (push) Waiting to run
CI / hurl (${{ matrix.example }}) (push) Has been skipped
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# Docker Build Scripts
|
||||
|
||||
This directory contains scripts used by the Dockerfile to build SQLPage with cross-compilation support.
|
||||
|
||||
## Scripts
|
||||
|
||||
- **`setup-cross-compilation.sh`**: Sets up the cross-compilation environment based on target and build architectures. Handles system dependencies, cross-compiler installation, and libgcc extraction for runtime.
|
||||
- **`build-dependencies.sh`**: Builds only the project dependencies for Docker layer caching
|
||||
- **`build-project.sh`**: Builds the final SQLPage binary
|
||||
|
||||
## Usage
|
||||
|
||||
These scripts are automatically copied and executed by the Dockerfile during the build process. They handle:
|
||||
|
||||
- Cross-compilation setup for different architectures (amd64, arm64, arm)
|
||||
- System dependencies installation
|
||||
- Cargo build configuration with appropriate linkers
|
||||
- Library extraction for runtime
|
||||
|
||||
The scripts use temporary files in `/tmp/` to pass configuration between stages and export environment variables for use in subsequent build steps.
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source /tmp/build-env.sh
|
||||
|
||||
PROFILE="${CARGO_PROFILE:-superoptimized}"
|
||||
echo "Building dependencies for target: $TARGET (profile: $PROFILE)"
|
||||
|
||||
cargo build \
|
||||
--target "$TARGET" \
|
||||
--config "target.$TARGET.linker=\"$LINKER\"" \
|
||||
--features odbc-static \
|
||||
--profile "$PROFILE"
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source /tmp/build-env.sh
|
||||
|
||||
PROFILE="${CARGO_PROFILE:-superoptimized}"
|
||||
echo "Building project for target: $TARGET (profile: $PROFILE)"
|
||||
|
||||
cargo build \
|
||||
--target "$TARGET" \
|
||||
--config "target.$TARGET.linker=\"$LINKER\"" \
|
||||
--features odbc-static \
|
||||
--profile "$PROFILE"
|
||||
|
||||
mv "target/$TARGET/$PROFILE/sqlpage" sqlpage.bin
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
TARGETARCH="${1:-amd64}"
|
||||
DUCKDB_VERSION="${2:-v1.5.3.0}"
|
||||
|
||||
# Determine the correct DuckDB ODBC package for the architecture
|
||||
case "$TARGETARCH" in
|
||||
amd64) odbc_zip="duckdb_odbc-linux-amd64.zip" ;;
|
||||
arm64) odbc_zip="duckdb_odbc-linux-arm64.zip" ;;
|
||||
*) echo "Unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Download and install DuckDB ODBC driver
|
||||
curl -fsSL -o /tmp/duckdb_odbc.zip "https://github.com/duckdb/duckdb-odbc/releases/download/${DUCKDB_VERSION}/${odbc_zip}"
|
||||
mkdir -p /opt/duckdb_odbc
|
||||
unzip /tmp/duckdb_odbc.zip -d /opt/duckdb_odbc
|
||||
rm /tmp/duckdb_odbc.zip
|
||||
|
||||
# Configure ODBC driver in odbcinst.ini
|
||||
cat >> /etc/odbcinst.ini << EOF
|
||||
|
||||
[DuckDB]
|
||||
Description=DuckDB ODBC Driver
|
||||
Driver=/opt/duckdb_odbc/libduckdb_odbc.so
|
||||
Setup=/opt/duckdb_odbc/libduckdb_odbc.so
|
||||
UsageCount=1
|
||||
EOF
|
||||
|
||||
# Configure default DuckDB data source in odbc.ini
|
||||
cat >> /etc/odbc.ini << EOF
|
||||
|
||||
[DuckDB]
|
||||
Driver=DuckDB
|
||||
Database=/var/lib/sqlpage/duckdb.db
|
||||
EOF
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
cache_dir="target/sqlpage_artefacts"
|
||||
mkdir -p "$cache_dir"
|
||||
|
||||
echo "[1/3] Prefetching Cargo dependencies"
|
||||
cargo fetch --locked
|
||||
|
||||
echo "[2/3] Prefetching npm dependencies"
|
||||
npm ci --ignore-scripts --no-audit
|
||||
if [ -f tests/end-to-end/package-lock.json ]; then
|
||||
(
|
||||
cd tests/end-to-end
|
||||
npm ci --ignore-scripts --no-audit
|
||||
)
|
||||
fi
|
||||
|
||||
echo "[3/3] Prefetching raw HTTP assets used by build.rs"
|
||||
mapfile -t urls < <(
|
||||
{
|
||||
rg -o --no-filename 'https://[[:alnum:]][[:alnum:].-]*/[^" )]+' build.rs
|
||||
rg -o --no-filename '^/\* !include https://[^ ]+' sqlpage/*.css sqlpage/*.js sqlpage/*.svg \
|
||||
| sed 's#^/\* !include ##'
|
||||
} | sort -u
|
||||
)
|
||||
|
||||
for url in "${urls[@]}"; do
|
||||
file_name=$(printf '%s' "$url" | sed -E 's/[^[:alnum:].-]/_/g')
|
||||
cache_file="$cache_dir/$file_name"
|
||||
|
||||
if [ -s "$cache_file" ]; then
|
||||
echo " - Cached: $url"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo " - Downloading: $url"
|
||||
curl -fsSL "$url" -o "$cache_file"
|
||||
done
|
||||
|
||||
echo "Done. Offline caches are ready."
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
TARGETARCH="$1"
|
||||
BUILDARCH="$2"
|
||||
BINDGEN_EXTRA_CLANG_ARGS=""
|
||||
|
||||
apt-get update
|
||||
|
||||
if [ "$TARGETARCH" = "$BUILDARCH" ]; then
|
||||
TARGET="$(rustup target list --installed | head -n1)"
|
||||
LINKER="gcc"
|
||||
apt-get install -y gcc libgcc-s1 make
|
||||
LIBDIR="/lib/$(gcc -print-multiarch)"
|
||||
elif [ "$TARGETARCH" = "arm64" ]; then
|
||||
TARGET="aarch64-unknown-linux-gnu"
|
||||
LINKER="aarch64-linux-gnu-gcc"
|
||||
apt-get install -y gcc-aarch64-linux-gnu libgcc-s1-arm64-cross make
|
||||
LIBDIR="/usr/aarch64-linux-gnu/lib"
|
||||
elif [ "$TARGETARCH" = "arm" ]; then
|
||||
TARGET="armv7-unknown-linux-gnueabihf"
|
||||
LINKER="arm-linux-gnueabihf-gcc"
|
||||
apt-get install -y gcc-arm-linux-gnueabihf libgcc-s1-armhf-cross make cmake libclang-dev
|
||||
cargo install --force --locked bindgen-cli
|
||||
SYSROOT=$(arm-linux-gnueabihf-gcc -print-sysroot)
|
||||
BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$SYSROOT -I$SYSROOT/usr/include -I$SYSROOT/usr/include/arm-linux-gnueabihf"
|
||||
LIBDIR="/usr/arm-linux-gnueabihf/lib"
|
||||
else
|
||||
echo "Unsupported cross compilation target: $TARGETARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/sqlpage-libs
|
||||
cp "$LIBDIR/libgcc_s.so.1" /tmp/sqlpage-libs/
|
||||
rustup target add "$TARGET"
|
||||
|
||||
{
|
||||
echo "export TARGET='$TARGET'"
|
||||
echo "export LINKER='$LINKER'"
|
||||
if [ -n "$BINDGEN_EXTRA_CLANG_ARGS" ]; then
|
||||
printf "export BINDGEN_EXTRA_CLANG_ARGS=%q\n" "$BINDGEN_EXTRA_CLANG_ARGS"
|
||||
fi
|
||||
} > /tmp/build-env.sh
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
# Create sqlpage user and group
|
||||
addgroup --gid 1000 --system sqlpage
|
||||
adduser --uid 1000 --system --no-create-home --ingroup sqlpage sqlpage
|
||||
|
||||
# Create and configure directories
|
||||
mkdir -p /etc/sqlpage /var/lib/sqlpage /var/www
|
||||
chown -R sqlpage:sqlpage /etc/sqlpage /var/lib/sqlpage /var/www
|
||||
Executable
+79
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
FILTER="${1:-}"
|
||||
|
||||
if ! command -v hurl >/dev/null 2>&1; then
|
||||
echo "hurl is required. See https://hurl.dev/docs/installation.html" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
current_project=""
|
||||
current_compose=""
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "$current_project" && -n "$current_compose" ]]; then
|
||||
docker compose -p "$current_project" -f "$current_compose" down --volumes --remove-orphans >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
run_index=0
|
||||
tested=0
|
||||
while IFS= read -r -d "" test_file; do
|
||||
dir="$(dirname "$test_file")"
|
||||
rel_dir="${dir#"$ROOT_DIR/"}"
|
||||
|
||||
if [[ -n "$FILTER" ]]; then
|
||||
if [[ "$FILTER" == */* ]]; then
|
||||
[[ "$rel_dir" == "$FILTER" ]] || continue
|
||||
else
|
||||
[[ "$rel_dir" == *"$FILTER"* ]] || continue
|
||||
fi
|
||||
fi
|
||||
|
||||
run_index=$((run_index + 1))
|
||||
tested=$((tested + 1))
|
||||
current_project="sqlpage_example_${run_index}"
|
||||
current_compose="$dir/docker-compose.yml"
|
||||
|
||||
echo "::group::Testing $rel_dir"
|
||||
if ! docker compose -p "$current_project" -f "$current_compose" up -d --quiet-pull --build --remove-orphans; then
|
||||
echo "::error file=$rel_dir/docker-compose.yml,title=Example compose startup failed::$rel_dir failed to start"
|
||||
echo "::group::docker compose ps for $rel_dir"
|
||||
docker compose -p "$current_project" -f "$current_compose" ps -a
|
||||
echo "::endgroup::"
|
||||
echo "::group::docker compose logs for $rel_dir"
|
||||
docker compose -p "$current_project" -f "$current_compose" logs
|
||||
echo "::endgroup::"
|
||||
echo "::endgroup::"
|
||||
exit 1
|
||||
fi
|
||||
if ! hurl --test \
|
||||
--retry 60 \
|
||||
--retry-interval 1s \
|
||||
--connect-timeout 2s \
|
||||
--error-format long \
|
||||
"$test_file"; then
|
||||
echo "::error file=$rel_dir/test.hurl,title=Hurl example test failed::$rel_dir failed"
|
||||
echo "::group::docker compose ps for $rel_dir"
|
||||
docker compose -p "$current_project" -f "$current_compose" ps
|
||||
echo "::endgroup::"
|
||||
echo "::group::docker compose logs for $rel_dir"
|
||||
docker compose -p "$current_project" -f "$current_compose" logs
|
||||
echo "::endgroup::"
|
||||
echo "::endgroup::"
|
||||
exit 1
|
||||
fi
|
||||
docker compose -p "$current_project" -f "$current_compose" down --volumes --remove-orphans
|
||||
echo "::endgroup::"
|
||||
|
||||
current_project=""
|
||||
current_compose=""
|
||||
done < <(find "$ROOT_DIR/examples" -mindepth 2 -maxdepth 2 -name test.hurl -print0 | sort -z)
|
||||
|
||||
if [[ "$tested" -eq 0 ]]; then
|
||||
echo "No examples matched filter: $FILTER" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user