Skip to content

Commit 81ae6f1

Browse files
committed
test
1 parent 400622f commit 81ae6f1

2 files changed

Lines changed: 70 additions & 25 deletions

File tree

.github/workflows/macos-release.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,13 @@ jobs:
8686
export LDFLAGS="-L$(brew --prefix libiodbc)/lib -liconv"
8787
bash ci/dependencies/driver-manager-setup-osx.sh
8888
89-
- name: Extract version from tag
90-
id: version
89+
90+
- name: Build cpp-bigquery-odbc (Skip Tests)
9191
run: |
9292
TAG=${GITHUB_REF#refs/tags/}
9393
VERSION=${TAG#v}
94-
echo "VERSION=$VERSION" >> $GITHUB_ENV
9594
echo "📦 Building version $VERSION"
96-
97-
98-
- name: Build cpp-bigquery-odbc (Skip Tests)
99-
run: |
95+
10096
if [ "${{ matrix.os }}" == "macos-14" ]; then
10197
export ODBC_INCLUDE_PATH="/opt/homebrew/opt/libiodbc/include"
10298
else
Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,100 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
#
33
# Copyright 2025 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
6-
# you may not use this file except in compliance with the License.
6+
# You may not use this file except in compliance with the License.
77
# You may obtain a copy of the License at
88
#
99
# https://www.apache.org/licenses/LICENSE-2.0
1010
#
1111
# Unless required by applicable law or agreed to in writing, software
1212
# distributed under the License is distributed on an "AS IS" BASIS,
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License for the specific language governing permissions and
15-
# limitations under the License.
14+
#
1615

1716
set -euo pipefail
1817

18+
# ---------------------------
19+
# Local Tools Directory Setup
20+
# ---------------------------
21+
TOOLS_DIR="${TOOLS_DIR:-$PWD/tools}"
22+
mkdir -p "$TOOLS_DIR/bin"
23+
export PATH="$TOOLS_DIR/bin:$PATH"
24+
25+
# ---------------------------
26+
# Bazel (via Bazelisk)
27+
# ---------------------------
28+
BAZEL_VERSION="7.0.0"
29+
BAZELISK_URL="https://github.com/bazelbuild/bazelisk/releases/download/v1.24.1/bazelisk-linux-amd64"
30+
31+
if [ ! -x "$TOOLS_DIR/bin/bazelisk" ]; then
32+
echo "Downloading Bazelisk..."
33+
curl -fsSL "$BAZELISK_URL" -o "$TOOLS_DIR/bin/bazelisk"
34+
chmod +x "$TOOLS_DIR/bin/bazelisk"
35+
ln -sf "$TOOLS_DIR/bin/bazelisk" "$TOOLS_DIR/bin/bazel"
36+
fi
37+
38+
export USE_BAZEL_VERSION="$BAZEL_VERSION"
39+
echo "Bazel version check:"
40+
bazel --version
41+
42+
# ---------------------------
43+
# CMake (local install)
44+
# ---------------------------
45+
CMAKE_VERSION="3.29.0"
46+
if ! command -v cmake >/dev/null 2>&1 || [[ "$(cmake --version | head -n1 | awk '{print $3}')" != "$CMAKE_VERSION" ]]; then
47+
echo "Installing CMake locally..."
48+
mkdir -p "$TOOLS_DIR/cmake"
49+
curl -fsSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh" -o "$TOOLS_DIR/cmake/cmake-installer.sh"
50+
chmod +x "$TOOLS_DIR/cmake/cmake-installer.sh"
51+
"$TOOLS_DIR/cmake/cmake-installer.sh" --skip-license --prefix="$TOOLS_DIR"
52+
fi
53+
cmake --version
54+
55+
# ---------------------------
56+
# iODBC (local)
57+
# ---------------------------
58+
if ! command -v iodbc-config >/dev/null 2>&1; then
59+
echo "Installing iODBC locally..."
60+
sudo apt-get update
61+
sudo apt-get install -y libiodbc2-dev
62+
fi
63+
64+
# ---------------------------
65+
# Source dependencies
66+
# ---------------------------
1967
source "$(dirname "$0")/../../lib/init.sh"
2068
source module ci/install-dependencies.sh
21-
2269
source module ci/cloudbuild/builds/lib/cmake.sh
23-
source module ci/cloudbuild/builds/lib/bazel-local.sh
2470
source module ci/cloudbuild/builds/lib/secrets.sh
2571
source module ci/lib/io.sh
2672

27-
# Common build args
73+
# ---------------------------
74+
# Build Driver
75+
# ---------------------------
2876
mapfile -t cmake_args < <(cmake::common_args)
29-
3077
BUILD_DIR="/opt/odbc-driver"
3178

32-
# Build driver
79+
echo "Building driver in $BUILD_DIR..."
3380
io::run cmake -B "$BUILD_DIR" \
34-
"${cmake_args[@]}" \
35-
-DCMAKE_CXX_STANDARD=17 \
36-
-DODBC_UNIT_TESTING=OFF \
37-
-DBQ_DRIVER_INTEGRATION_TESTS=OFF \
38-
-DODBC_DEMO_TESTING=OFF \
39-
-DODBC_EXAMPLES=ON \
40-
-DCLIENT_LIBRARY_INTEGRATION_TESTING=OFF
81+
"${cmake_args[@]}" \
82+
-DCMAKE_CXX_STANDARD=17 \
83+
-DODBC_UNIT_TESTING=OFF \
84+
-DBQ_DRIVER_INTEGRATION_TESTS=OFF \
85+
-DODBC_DEMO_TESTING=OFF \
86+
-DODBC_EXAMPLES=ON \
87+
-DCLIENT_LIBRARY_INTEGRATION_TESTING=OFF
4188

4289
io::run cmake --build "$BUILD_DIR" --target all
4390

44-
# Create tarball for release
91+
# ---------------------------
92+
# Package Release
93+
# ---------------------------
4594
VERSION_TAG="${TAG_NAME:-unknown}"
4695
OUTPUT_TAR="cpp-bigquery-odbc-${VERSION_TAG}-linux-x86_64.tar.gz"
4796

4897
echo "Packaging build artifacts into ${OUTPUT_TAR}..."
4998
tar -czf "${OUTPUT_TAR}" -C "$BUILD_DIR" .
5099

51-
echo "Build packaged successfully: ${OUTPUT_TAR}"
100+
echo "Build packaged successfully: ${OUTPUT_TAR}"

0 commit comments

Comments
 (0)