test #18
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: macOS Release Build | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| permissions: | |
| contents: write # Needed for release upload | |
| jobs: | |
| cmake: | |
| name: cmake + ${{ matrix.os }} + ${{ matrix.shard }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ macos-14, macos-13 ] | |
| shard: [ BqDriver ] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - 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 | |
| shell: bash | |
| 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: Extract version from tag | |
| id: version | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "π¦ Building version $VERSION" | |
| - 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 | |
| # Pass version to cmake | |
| cmake -S . -B cmake-out -DPROJECT_VERSION=${VERSION} | |
| HEADER_VERSION=$(grep 'FULL_VERSION' cmake-out/google/cloud/odbc/internal/version.h | sed -E 's/.*"([^"]+)".*/\1/') | |
| echo "π¦ Tag version: $VERSION" | |
| echo "π Header FULL_VERSION: $HEADER_VERSION" | |
| if [ "$VERSION" != "$HEADER_VERSION" ]; then | |
| echo "β Mismatch: tag=$VERSION vs FULL_VERSION=$HEADER_VERSION" | |
| exit 1 | |
| else | |
| echo "β FULL_VERSION matches tag version" | |
| fi | |
| cmake --build cmake-out --parallel | |
| 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 | |
| # Detect CMake build output directory | |
| 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" | |
| # Prepare package folder | |
| mkdir -p release_package/lib release_package/setup | |
| # Copy driver files (fail if missing) | |
| cp -rv "$BUILD_DIR/google/cloud/odbc/libgoogle_cloud_odbc_bq_driver.dylib" release_package/lib/ | |
| # Copy ODBC config files from repo | |
| 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 | |
| # Create TAR.GZ file | |
| 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 }} |