Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release BQ Driver | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" # Matches v1.2.3 style tags | |
| permissions: | |
| contents: write | |
| jobs: | |
| linux-release: | |
| name: Release BQ Driver (Linux) | |
| runs-on: ubuntu-22.04 | |
| env: | |
| BUILD_NAME: release-bq-driver | |
| DEPENDENCIES: BAZEL,iODBC,DRIVER_MANAGER_SETUP_GOOGLE_DRIVER | |
| DISTRO: ubuntu-22.04-install | |
| TRIGGER_TYPE: release | |
| LOGS_BUCKET: my-release-artifacts-bucket | |
| TAG_NAME: ${{ github.ref_name }} | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # 🔹 Version update happens ONLY here | |
| - name: Update version.txt and kDriverVer | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| echo "📌 Updating version files to $VERSION" | |
| echo "$VERSION" > version.txt | |
| sed -i "s|constexpr char const\* kDriverVer = \".*\";|constexpr char const* kDriverVer = \"${VERSION}.0000\";|" google/cloud/odbc/internal/common_constants.h | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add version.txt google/cloud/odbc/internal/common_constants.h | |
| git commit -m "Release $GITHUB_REF_NAME: update version.txt and kDriverVer" || echo "No changes" | |
| git push origin HEAD:${GITHUB_REF_NAME} | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| create_credentials_file: true | |
| credentials_json: ${{ secrets.BUILD_CACHE_KEY }} | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential pkg-config libiodbc2-dev | |
| - name: Build & package driver | |
| run: | | |
| chmod +x ci/cloudbuild/builds/release-bq-driver.sh | |
| ci/cloudbuild/builds/release-bq-driver.sh | |
| - name: Upload tarball to GCS | |
| uses: google-github-actions/upload-cloud-storage@v2 | |
| with: | |
| path: cpp-bigquery-odbc-${{ env.TAG_NAME }}-linux-x86_64.tar.gz | |
| destination: ${{ env.LOGS_BUCKET }}/artifacts/${{ env.TAG_NAME }}/ | |
| macos-release: | |
| name: Release BQ Driver (macOS) | |
| needs: linux-release # 🔹 Ensures Linux runs first | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ macos-14, macos-13 ] | |
| shard: [ BqDriver ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: google-github-actions/auth@v2 | |
| with: | |
| create_credentials_file: true | |
| credentials_json: ${{ secrets.BUILD_CACHE_KEY }} | |
| - uses: actions/setup-python@v5 | |
| id: py311 | |
| with: | |
| python-version: '3.11' | |
| - uses: google-github-actions/setup-gcloud@v2 | |
| with: | |
| version: '500.0.0' | |
| env: | |
| CLOUDSDK_PYTHON: ${{ steps.py311.outputs.python-path }} | |
| - name: Dynamic Configuration | |
| id: dynamic | |
| run: echo "vcpkg-version=$(cat ci/etc/vcpkg-version.txt)" >> "${GITHUB_OUTPUT}" | |
| - name: Install bash >= 5.x and Ninja | |
| run: brew install bash ninja | |
| - name: Download cmake formula (3.29.0) and install | |
| run: | | |
| brew unlink cmake | |
| curl -fsSL -o cmake.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/c93f8de910aaf6b4a1b9021caee32ece216787b4/Formula/c/cmake.rb | |
| brew install cmake.rb | |
| - name: cmake version | |
| run: cmake --version | |
| - name: Download and Install sccache | |
| working-directory: "${{runner.temp}}" | |
| run: | | |
| curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-apple-darwin.tar.gz | \ | |
| tar -zxf - --strip-components=1 && \ | |
| chmod +x sccache && \ | |
| mv sccache /Users/runner/.cargo/bin/sccache | |
| - name: Install bison flex for 'arrow' | |
| run: brew install bison flex | |
| - name: Download and Install vcpkg | |
| working-directory: "${{runner.temp}}" | |
| run: | | |
| git clone --branch ${{ steps.dynamic.outputs.vcpkg-version }} https://github.com/microsoft/vcpkg.git | |
| vcpkg/bootstrap-vcpkg.sh -disableMetrics | |
| - name: Install iODBC | |
| run: brew install libiodbc | |
| - name: Setup the driver | |
| run: | | |
| export VCPKG_ROOT="${{ runner.temp }}/vcpkg" | |
| export PATH="$VCPKG_ROOT:/opt/homebrew/bin:$PATH" | |
| export LDFLAGS="-L$(brew --prefix libiodbc)/lib -liconv" | |
| bash ci/dependencies/driver-manager-setup-osx.sh | |
| - name: Build cpp-bigquery-odbc (Skip Tests) | |
| run: | | |
| if [ "${{ matrix.os }}" == "macos-14" ]; then | |
| export ODBC_INCLUDE_PATH="/opt/homebrew/opt/libiodbc/include" | |
| else | |
| export ODBC_INCLUDE_PATH="/usr/local/opt/libiodbc/include" | |
| fi | |
| export VCPKG_ROOT="${{ runner.temp }}/vcpkg" | |
| export PATH="$VCPKG_ROOT:/opt/homebrew/bin:$PATH" | |
| export LDFLAGS="-L$(brew --prefix libiodbc)/lib -liconv" | |
| export SKIP_TESTS=1 | |
| bash ci/gha/builds/macos-cmake.sh | |
| env: | |
| USE_BAZEL_VERSION: 7.0.0 | |
| MATRIX_OS: ${{ matrix.os }} | |
| BAZEL_REMOTE_CACHE: https://storage.googleapis.com/gha-cache-cpp-bigquery-odbc/bazel-cache/${{ matrix.os }} | |
| SCCACHE_GCS_BUCKET: gha-cache-cpp-bigquery-odbc | |
| SCCACHE_GCS_KEY_PREFIX: sccache/${{ matrix.os }} | |
| SCCACHE_GCS_RW_MODE: READ_WRITE | |
| SCCACHE_IGNORE_SERVER_IO_ERROR: 1 | |
| VCPKG_BINARY_SOURCES: x-gcs,gs://gha-cache-cpp-bigquery-odbc/vcpkg-cache/${{ matrix.os }},readwrite | |
| - name: Create TAR Package | |
| run: | | |
| set -euo pipefail | |
| if [ -d "cmake-out" ]; then | |
| BUILD_DIR="cmake-out" | |
| elif [ -d "build" ]; then | |
| BUILD_DIR="build" | |
| else | |
| echo "❌ No build directory found. Did CMake run?" | |
| exit 1 | |
| fi | |
| echo "📂 Using build directory: $BUILD_DIR" | |
| mkdir -p release_package/lib release_package/setup | |
| cp -rv "$BUILD_DIR/google/cloud/odbc/libgoogle_cloud_odbc_bq_driver.dylib" release_package/lib/ | |
| cp -rv ci/gha/builds/lib/odbc_osx.ini release_package/setup/odbc.ini | |
| cp -rv ci/gha/builds/lib/odbcinst_osx.ini release_package/setup/odbcinst.ini | |
| cp version.txt release_package/ | |
| TAR_NAME="cpp-bigquery-odbc-${{ matrix.os }}-${GITHUB_REF_NAME}.tar.gz" | |
| tar -czvf "$TAR_NAME" -C release_package . | |
| echo "✅ TAR package created: $TAR_NAME" | |
| - name: Upload TAR to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: cpp-bigquery-odbc-${{ matrix.os }}-${{ github.ref_name }}.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |