Skip to content

Rename Dataproc Spark Connect to Managed Spark Connect #142

Rename Dataproc Spark Connect to Managed Spark Connect

Rename Dataproc Spark Connect to Managed Spark Connect #142

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Integration Tests with Service Account Authentication
#
# Required GitHub Secrets:
# - GCP_SA_KEY: Service account JSON key (project_id and client_email extracted automatically)
# - GCP_REGION: Google Cloud Region (optional, defaults to us-central1)
# - GCP_SUBNET: Managed Spark subnet URI
#
# See INTEGRATION_TESTS.md for setup instructions.
name: Integration Tests
on:
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
jobs:
integration-test:
name: Run integration tests
runs-on: ubuntu-latest
# Only run integration tests if secrets are available
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Cache pip dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-integration-${{ hashFiles('requirements-dev.txt', 'requirements-test.txt') }}
restore-keys: |
${{ runner.os }}-pip-integration-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
pip install -r requirements-test.txt
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@c200f3691d83b41bf9bbd8638997a462592937ed # v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@e427ad8a34f8676edf47cf7d7925499adf3eb74f # v2
- name: Extract service account details
env:
GCP_SA_KEY_JSON: ${{ secrets.GCP_SA_KEY }}
run: |
SA_EMAIL=$(echo "$GCP_SA_KEY_JSON" | jq -r '.client_email')
PROJECT_ID=$(echo "$GCP_SA_KEY_JSON" | jq -r '.project_id')
echo "::add-mask::$SA_EMAIL"
echo "::add-mask::$PROJECT_ID"
echo "SA_EMAIL=$SA_EMAIL" >> "$GITHUB_ENV"
echo "PROJECT_ID=$PROJECT_ID" >> "$GITHUB_ENV"
- name: Run integration tests
env:
CI: "true"
# Extracted from service account JSON in the previous step
GOOGLE_CLOUD_PROJECT: ${{ env.PROJECT_ID }}
MANAGED_SPARK_CONNECT_SERVICE_ACCOUNT: ${{ env.SA_EMAIL }}
# Infrastructure-specific secrets
GOOGLE_CLOUD_REGION: ${{ secrets.GCP_REGION || 'us-central1' }}
MANAGED_SPARK_CONNECT_SUBNET: ${{ secrets.GCP_SUBNET }}
MANAGED_SPARK_CONNECT_AUTH_TYPE: "SERVICE_ACCOUNT"
run: |
python -m pytest tests/integration/ -v --tb=short -x