diff --git a/.github/workflows/buildpack-integration-test.yml b/.github/workflows/buildpack-integration-test.yml new file mode 100644 index 00000000..7ca8e38b --- /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: + python37: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + 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: 'python37' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/python37/builder + builder-tag: 'python37_20220426_3_7_12_RC00' + python38: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + 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' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/python38/builder + builder-tag: 'python38_20220426_3_8_12_RC00' + python39: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + 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' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/python39/builder + builder-tag: 'python39_20220426_3_9_10_RC00' + python310: + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.4.1 + 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' + # Latest uploaded tag from us.gcr.io/fn-img/buildpacks/python310/builder + builder-tag: 'python310_20220320_3_10_2_RC00' \ No newline at end of file diff --git a/tests/conformance/prerun.sh b/tests/conformance/prerun.sh new file mode 100755 index 00000000..b46f0b51 --- /dev/null +++ b/tests/conformance/prerun.sh @@ -0,0 +1,21 @@ +# prerun.sh sets up the test function to use the functions framework commit +# specified by generating a `requirements.txt`. This makes the function `pack` buildable +# with GCF buildpacks. +# +# `pack` command example: +# pack build python-test --builder us.gcr.io/fn-img/buildpacks/python310/builder:python310_20220320_3_10_2_RC00 --env GOOGLE_RUNTIME=python310 --env GOOGLE_FUNCTION_TARGET=write_http_declarative +set -e + +FRAMEWORK_VERSION=$1 +if [ -z "${FRAMEWORK_VERSION}" ] + then + echo "Functions Framework version required as first parameter" + exit 1 +fi + +SCRIPT_DIR=$(realpath $(dirname $0)) + +cd $SCRIPT_DIR + +echo "git+https://github.com/GoogleCloudPlatform/functions-framework-python@$FRAMEWORK_VERSION#egg=functions-framework" > requirements.txt +cat requirements.txt \ No newline at end of file