diff --git a/.github/workflows/buildpack-integration-test.yml b/.github/workflows/buildpack-integration-test.yml new file mode 100644 index 00000000..997b7300 --- /dev/null +++ b/.github/workflows/buildpack-integration-test.yml @@ -0,0 +1,52 @@ +# Validates Functions Framework with GCF buildpacks. +name: Buildpack Integration Test +on: + push: + branches: + - master + workflow_dispatch: +jobs: + nodejs10: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + with: + http-builder-source: 'test/conformance' + http-builder-target: 'writeHttpDeclarative' + cloudevent-builder-source: 'test/conformance' + cloudevent-builder-target: 'writeCloudEventDeclarative' + prerun: 'test/conformance/prerun.sh' + builder-runtime: 'nodejs10' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/nodejs10/builder + builder-tag: 'nodejs10_20220320_10_24_1_RC00' + nodejs12: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + with: + http-builder-source: 'test/conformance' + http-builder-target: 'writeHttpDeclarative' + cloudevent-builder-source: 'test/conformance' + cloudevent-builder-target: 'writeCloudEventDeclarative' + prerun: 'test/conformance/prerun.sh' + builder-runtime: 'nodejs12' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/nodejs12/builder + builder-tag: 'nodejs12_20220320_12_22_9_RC00' + nodejs14: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + with: + http-builder-source: 'test/conformance' + http-builder-target: 'writeHttpDeclarative' + cloudevent-builder-source: 'test/conformance' + cloudevent-builder-target: 'writeCloudEventDeclarative' + prerun: 'test/conformance/prerun.sh' + builder-runtime: 'nodejs14' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/nodejs16/builder + builder-tag: 'nodejs14_20220320_14_18_3_RC00' + nodejs16: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + with: + http-builder-source: 'test/conformance' + http-builder-target: 'writeHttpDeclarative' + cloudevent-builder-source: 'test/conformance' + cloudevent-builder-target: 'writeCloudEventDeclarative' + prerun: 'test/conformance/prerun.sh' + builder-runtime: 'nodejs16' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/nodejs16/builder + builder-tag: 'nodejs16_20220320_16_13_2_RC00' \ No newline at end of file diff --git a/test/conformance/.gitignore b/test/conformance/.gitignore new file mode 100644 index 00000000..1708d75e --- /dev/null +++ b/test/conformance/.gitignore @@ -0,0 +1,2 @@ +# Generated by prerun.sh for buildpack integration test +google-cloud-functions-framework-0.0.0.tgz \ No newline at end of file diff --git a/test/conformance/prerun.sh b/test/conformance/prerun.sh new file mode 100755 index 00000000..c6321241 --- /dev/null +++ b/test/conformance/prerun.sh @@ -0,0 +1,21 @@ +# prerun.sh sets up the test function to use the functions framework commit +# specified by generating a `package.json`. This makes the function `pack` buildable +# with GCF buildpacks. +# +# `pack` command example: +# pack build test-fast --builder us.gcr.io/fn-img/buildpacks/nodejs16/builder:nodejs16_20220320_16_13_2_RC00 --env GOOGLE_RUNTIME=nodejs16 --env GOOGLE_FUNCTION_TARGET=writeHttpDeclarativ +set -e + +SCRIPT_DIR=$(dirname $0) +REPO_ROOT=$SCRIPT_DIR/../.. + +cd $REPO_ROOT + +npm install gts +npm version 0.0.0 --allow-same-version --no-git-tag-version # fake a deterministic version for testing +npm pack --pack-destination $SCRIPT_DIR + +cd $SCRIPT_DIR + +npm install google-cloud-functions-framework-0.0.0.tgz +cat package.json \ No newline at end of file