Buildpack Integration Test workflow (GoogleCloudPlatform/functions-framework-python)
The Buildpack Integration Test workflow from GoogleCloudPlatform/functions-framework-python, explained and optimized by Latchkey.
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Buildpack Integration Test workflow from the GoogleCloudPlatform/functions-framework-python repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# Validates Functions Framework with GCF buildpacks.
name: Buildpack Integration Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# Runs every day on 12:00 AM PST
schedule:
- cron: "0 0 * * *"
# Declare default permissions as read only.
permissions: read-all
jobs:
python38:
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main
with:
http-builder-source: 'tests/conformance'
http-builder-target: 'write_http_declarative'
cloudevent-builder-source: 'tests/conformance'
cloudevent-builder-target: 'write_cloud_event_declarative'
prerun: 'tests/conformance/prerun.sh ${{ github.sha }}'
builder-runtime: 'python38'
builder-runtime-version: '3.8'
start-delay: 5
python39:
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main
with:
http-builder-source: 'tests/conformance'
http-builder-target: 'write_http_declarative'
cloudevent-builder-source: 'tests/conformance'
cloudevent-builder-target: 'write_cloud_event_declarative'
prerun: 'tests/conformance/prerun.sh ${{ github.sha }}'
builder-runtime: 'python39'
builder-runtime-version: '3.9'
start-delay: 5
python310:
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main
with:
http-builder-source: 'tests/conformance'
http-builder-target: 'write_http_declarative'
cloudevent-builder-source: 'tests/conformance'
cloudevent-builder-target: 'write_cloud_event_declarative'
prerun: 'tests/conformance/prerun.sh ${{ github.sha }}'
builder-runtime: 'python310'
builder-runtime-version: '3.10'
start-delay: 5
python311:
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main
with:
http-builder-source: 'tests/conformance'
http-builder-target: 'write_http_declarative'
cloudevent-builder-source: 'tests/conformance'
cloudevent-builder-target: 'write_cloud_event_declarative'
prerun: 'tests/conformance/prerun.sh ${{ github.sha }}'
builder-runtime: 'python311'
builder-runtime-version: '3.11'
start-delay: 5
# Python 3.12 conformance tests are disabled due to the buildpack defaulting to
# Ubuntu 18.04, which has no Python 3.12 version, and being unable to specify
# the OS/stack via the conformance test configuration
#
# python312:
# uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main
# with:
# http-builder-source: 'tests/conformance'
# http-builder-target: 'write_http_declarative'
# cloudevent-builder-source: 'tests/conformance'
# cloudevent-builder-target: 'write_cloud_event_declarative'
# prerun: 'tests/conformance/prerun.sh ${{ github.sha }}'
# builder-runtime: 'python312'
# builder-runtime-version: '3.12'
# start-delay: 5
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Validates Functions Framework with GCF buildpacks. name: Buildpack Integration Test on: push: branches: - main pull_request: workflow_dispatch: # Runs every day on 12:00 AM PST schedule: - cron: "0 0 * * *" # Declare default permissions as read only. permissions: read-all concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: python38: timeout-minutes: 30 uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' cloudevent-builder-source: 'tests/conformance' cloudevent-builder-target: 'write_cloud_event_declarative' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' builder-runtime: 'python38' builder-runtime-version: '3.8' start-delay: 5 python39: timeout-minutes: 30 uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' cloudevent-builder-source: 'tests/conformance' cloudevent-builder-target: 'write_cloud_event_declarative' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' builder-runtime: 'python39' builder-runtime-version: '3.9' start-delay: 5 python310: timeout-minutes: 30 uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' cloudevent-builder-source: 'tests/conformance' cloudevent-builder-target: 'write_cloud_event_declarative' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' builder-runtime: 'python310' builder-runtime-version: '3.10' start-delay: 5 python311: timeout-minutes: 30 uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'write_http_declarative' cloudevent-builder-source: 'tests/conformance' cloudevent-builder-target: 'write_cloud_event_declarative' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' builder-runtime: 'python311' builder-runtime-version: '3.11' start-delay: 5 # Python 3.12 conformance tests are disabled due to the buildpack defaulting to # Ubuntu 18.04, which has no Python 3.12 version, and being unable to specify # the OS/stack via the conformance test configuration # # python312: # uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main # with: # http-builder-source: 'tests/conformance' # http-builder-target: 'write_http_declarative' # cloudevent-builder-source: 'tests/conformance' # cloudevent-builder-target: 'write_cloud_event_declarative' # prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' # builder-runtime: 'python312' # builder-runtime-version: '3.12' # start-delay: 5
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- 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 4 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.