Google Integration Tests workflow (xing5/mcp-google-sheets)
The Google Integration Tests workflow from xing5/mcp-google-sheets, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Google Integration Tests workflow from the xing5/mcp-google-sheets repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Google Integration Tests
on:
workflow_dispatch:
jobs:
google-integration:
name: Live Google integration tests
runs-on: ubuntu-latest
env:
RUN_GOOGLE_INTEGRATION: "1"
DRIVE_FOLDER_ID: ${{ secrets.GOOGLE_DRIVE_FOLDER_ID }}
CREDENTIALS_CONFIG: ${{ secrets.GOOGLE_CREDENTIALS_CONFIG }}
GOOGLE_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
GOOGLE_TEST_SHARE_EMAIL: ${{ secrets.GOOGLE_TEST_SHARE_EMAIL }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --frozen --python 3.12
- name: Prepare Google credentials
run: |
if [ -n "$GOOGLE_SERVICE_ACCOUNT_JSON" ]; then
service_account_path="$RUNNER_TEMP/google-service-account.json"
printf '%s' "$GOOGLE_SERVICE_ACCOUNT_JSON" > "$service_account_path"
echo "SERVICE_ACCOUNT_PATH=$service_account_path" >> "$GITHUB_ENV"
fi
if [ -z "$DRIVE_FOLDER_ID" ]; then
echo "GOOGLE_DRIVE_FOLDER_ID secret is required." >&2
exit 1
fi
if [ -z "$GOOGLE_SERVICE_ACCOUNT_JSON" ] && [ -z "$CREDENTIALS_CONFIG" ]; then
echo "Set either GOOGLE_SERVICE_ACCOUNT_JSON or GOOGLE_CREDENTIALS_CONFIG." >&2
exit 1
fi
- name: Run live Google integration tests
run: uv run --python 3.12 python -m unittest tests.test_google_integration
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Google Integration Tests on: workflow_dispatch: jobs: google-integration: timeout-minutes: 30 name: Live Google integration tests runs-on: latchkey-small env: RUN_GOOGLE_INTEGRATION: "1" DRIVE_FOLDER_ID: ${{ secrets.GOOGLE_DRIVE_FOLDER_ID }} CREDENTIALS_CONFIG: ${{ secrets.GOOGLE_CREDENTIALS_CONFIG }} GOOGLE_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }} GOOGLE_TEST_SHARE_EMAIL: ${{ secrets.GOOGLE_TEST_SHARE_EMAIL }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python run: uv python install 3.12 - name: Install dependencies run: uv sync --frozen --python 3.12 - name: Prepare Google credentials run: | if [ -n "$GOOGLE_SERVICE_ACCOUNT_JSON" ]; then service_account_path="$RUNNER_TEMP/google-service-account.json" printf '%s' "$GOOGLE_SERVICE_ACCOUNT_JSON" > "$service_account_path" echo "SERVICE_ACCOUNT_PATH=$service_account_path" >> "$GITHUB_ENV" fi if [ -z "$DRIVE_FOLDER_ID" ]; then echo "GOOGLE_DRIVE_FOLDER_ID secret is required." >&2 exit 1 fi if [ -z "$GOOGLE_SERVICE_ACCOUNT_JSON" ] && [ -z "$CREDENTIALS_CONFIG" ]; then echo "Set either GOOGLE_SERVICE_ACCOUNT_JSON or GOOGLE_CREDENTIALS_CONFIG." >&2 exit 1 fi - name: Run live Google integration tests run: uv run --python 3.12 python -m unittest tests.test_google_integration
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.