macOS Release Build #188
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] | |
| 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 -L https://github.com/Kitware/CMake/releases/download/v3.29.0/cmake-3.29.0-macos-universal.tar.gz -o cmake.tar.gz | |
| tar -xzf cmake.tar.gz | |
| sudo cp -r cmake-3.29.0-macos-universal/CMake.app/Contents/bin/* /usr/local/bin/ | |
| sudo cp -r cmake-3.29.0-macos-universal/CMake.app/Contents/share/cmake-3.29 /usr/local/share/ | |
| cmake --version | |
| - 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 and Build cpp-bigquery-odbc 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/gha/builds/macos-release-setup.sh | |
| export ODBC_INCLUDE_PATH="/opt/homebrew/opt/libiodbc/include" | |
| bash ci/gha/builds/macos-cmake.sh | |
| - name: Validate DRIVER_VERSION with github tag. | |
| id: version | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| HEADER_VERSION=$(grep 'DRIVER_VERSION' google/cloud/odbc/internal/version.h | sed -E 's/.*"([^"]+)".*/\1/') | |
| echo "Tag version: $VERSION" | |
| echo "Header DRIVER_VERSION: $HEADER_VERSION" | |
| if [ "$VERSION" != "$HEADER_VERSION" ]; then | |
| echo "DRIVER_VERSION doesn't match the version in github tag." | |
| exit 1 | |
| else | |
| echo "DRIVER_VERSION matches tag version" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Create TAR Package | |
| run: | | |
| set -euo pipefail | |
| # Detect CMake build output directory | |
| if [ -d "cmake-out" ]; then | |
| BUILD_DIR="cmake-out" | |
| 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 | |
| # 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/release/odbc.ini release_package/odbc.ini | |
| cp -rv ci/gha/builds/release/odbcinst.ini release_package/odbcinst.ini | |
| # Create TAR.GZ file | |
| TAR_NAME="ODBCDriverforBigQuery_macos_${{ steps.version.outputs.version }}.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: ODBCDriverforBigQuery_macos_${{ steps.version.outputs.version }}.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| 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 |