Skip to content

Commit

Permalink
chore: add GCF buildpack integration test Workflow
Browse files Browse the repository at this point in the history
See [functions-framework-conformance builidpack integration workflow PR](GoogleCloudPlatform/functions-framework-conformance#99) for more information.
  • Loading branch information
anniefu committed Jun 28, 2022
1 parent 7025c7b commit 90393b7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/buildpack-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Validates Functions Framework with GCF buildpacks.
name: Buildpack Integration Test
on:
push:
branches:
- main
workflow_dispatch:
jobs:
ruby30-buildpack-test:
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/[email protected]
with:
http-builder-source: 'test/conformance'
http-builder-target: 'http_func'
cloudevent-builder-source: 'test/conformance'
cloudevent-builder-target: 'cloudevent_func'
prerun: 'test/conformance/prerun.sh ${{ github.sha }}'
builder-runtime: 'ruby30'
# Latest uploaded tag from us.gcr.io/fn-img/buildpacks/ruby30/builder
builder-tag: 'ruby30_20220620_3_0_4_RC00'
5 changes: 5 additions & 0 deletions test/conformance/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These files are generate dynamically based off the git commit sha
# when trying to build the conformance test function with buildpacks,
# and should not be checked in.
Gemfile
Gemfile.lock
27 changes: 27 additions & 0 deletions test/conformance/prerun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# prerun.sh sets up the test function to use the functions framework commit
# specified. This makes the function `pack` buildable with GCF buildpacks.
#
# `pack` build example command:
# pack build myfn --verbose --builder us.gcr.io/fn-img/buildpacks/ruby30/builder:ruby30_20220620_3_0_4_RC00 --env GOOGLE_RUNTIME=ruby30 --env GOOGLE_FUNCTION_TARGET=http_func --env X_GOOGLE_TARGET_PLATFORM=gcf
FRAMEWORK_VERSION=$1

# exit when any command fails
set -e

cd $(dirname $0)

if [ -z "${FRAMEWORK_VERSION}" ]
then
echo "Functions Framework version required as first parameter"
exit 1
fi

echo "source 'https://rubygems.org'
gem 'functions_framework', github: 'GoogleCloudPlatform/functions-framework-ruby', ref: '$FRAMEWORK_VERSION'" > Gemfile
cat Gemfile

sudo gem install bundler

# Generate a Gemfile.lock without installing any Gems
bundle lock --update
cat Gemfile.lock

0 comments on commit 90393b7

Please sign in to comment.