diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 37151ba5..d9e08bfa 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -1,7 +1,10 @@ assign_prs: - - josephlewis42 - - KaylaNguyen + - Ectelion + - janell-chen + - akerekes assign_issues: - - josephlewis42 - - KaylaNguyen + - Ectelion + - janell-chen + - akerekes + diff --git a/.github/workflows/buildpack-integration-test.yml b/.github/workflows/buildpack-integration-test.yml index 3ffaea0c..5a748c62 100644 --- a/.github/workflows/buildpack-integration-test.yml +++ b/.github/workflows/buildpack-integration-test.yml @@ -4,14 +4,16 @@ on: push: branches: - main + pull_request: workflow_dispatch: # Declare default permissions as read only. permissions: read-all jobs: - php74-buildpack-test: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.1 + php81-buildpack-test: + if: github.event.pull_request.head.repo.full_name == github.repository + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'declarativeHttpFunc' @@ -19,9 +21,11 @@ jobs: cloudevent-builder-target: 'declarativeCloudEventFunc' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' output-file: 'vendor/bin/function_output.json' - builder-runtime: 'php74' - php81-buildpack-test: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.1 + builder-runtime: 'php81' + builder-runtime-version: '">=8.1,<8.2"' + php82-buildpack-test: + if: github.event.pull_request.head.repo.full_name == github.repository + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'declarativeHttpFunc' @@ -29,9 +33,11 @@ jobs: cloudevent-builder-target: 'declarativeCloudEventFunc' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' output-file: 'vendor/bin/function_output.json' - builder-runtime: 'php81' + builder-runtime: 'php82' + builder-runtime-version: '">=8.2,<8.3"' php82-buildpack-test: - uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@v1.8.1 + if: github.event.pull_request.head.repo.full_name == github.repository + uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/buildpack-integration-test.yml@main with: http-builder-source: 'tests/conformance' http-builder-target: 'declarativeHttpFunc' @@ -39,4 +45,5 @@ jobs: cloudevent-builder-target: 'declarativeCloudEventFunc' prerun: 'tests/conformance/prerun.sh ${{ github.sha }}' output-file: 'vendor/bin/function_output.json' - builder-runtime: 'php82' + builder-runtime: 'php83' + builder-runtime-version: '">=8.3,<8.4"' \ No newline at end of file diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 367eeb1a..51c0ef72 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -14,11 +14,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: [ '7.4','8.0','8.1','8.2' ] + php-version: [ '8.1','8.2','8.3' ] name: PHP ${{ matrix.php-version }} Conformance Test steps: - name: Harden Runner - uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: block allowed-endpoints: > @@ -31,27 +31,27 @@ jobs: storage.googleapis.com:443 - name: Checkout code - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup PHP ${{ matrix.php-version }} - uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2 with: php-version: ${{ matrix.php-version }} - name: Install Dependencies - uses: nick-invision/retry@39da88d5f7d15a96aed861dbabbe8b7443e3182a # v1.0.4 + uses: nick-invision/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 with: timeout_minutes: 10 max_attempts: 3 command: composer install - name: Setup Go - uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2.2.0 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version: '1.20' - name: Run HTTP conformance tests - uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3 + uses: GoogleCloudPlatform/functions-framework-conformance/action@72a4f36b10f1c6435ab1a86a9ea24bda464cc262 # v1.8.6 env: FUNCTION_TARGET: 'httpFunc' FUNCTION_SIGNATURE_TYPE: 'http' @@ -62,7 +62,7 @@ jobs: cmd: "'php -S localhost:8080 router.php'" - name: Run Declarative HTTP conformance tests - uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3 + uses: GoogleCloudPlatform/functions-framework-conformance/action@72a4f36b10f1c6435ab1a86a9ea24bda464cc262 # v1.8.6 env: FUNCTION_TARGET: 'declarativeHttpFunc' FUNCTION_SOURCE: ${{ github.workspace }}/tests/conformance/index.php @@ -72,7 +72,7 @@ jobs: cmd: "'php -S localhost:8080 router.php'" - name: Run Declarative Typed conformance tests - uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3 + uses: GoogleCloudPlatform/functions-framework-conformance/action@72a4f36b10f1c6435ab1a86a9ea24bda464cc262 # v1.8.6 env: FUNCTION_TARGET: 'declarativeTypedFunc' FUNCTION_SOURCE: ${{ github.workspace }}/tests/conformance/index.php @@ -83,7 +83,7 @@ jobs: cmd: "'php -S localhost:8080 router.php'" - name: Run CloudEvent conformance tests - uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3 + uses: GoogleCloudPlatform/functions-framework-conformance/action@72a4f36b10f1c6435ab1a86a9ea24bda464cc262 # v1.8.6 env: FUNCTION_TARGET: 'cloudEventFunc' FUNCTION_SIGNATURE_TYPE: 'cloudevent' @@ -95,7 +95,7 @@ jobs: cmd: "'php -S localhost:8080 router.php'" - name: Run Declarative CloudEvent conformance tests - uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.2.1 + uses: GoogleCloudPlatform/functions-framework-conformance/action@72a4f36b10f1c6435ab1a86a9ea24bda464cc262 # v1.8.6 env: FUNCTION_TARGET: 'declarativeCloudEventFunc' FUNCTION_SOURCE: ${{ github.workspace }}/tests/conformance/index.php diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index a422aec6..5ee3b533 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -26,6 +26,6 @@ jobs: github.com:443 - name: 'Checkout Repository' - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: 'Dependency Review' - uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 + uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0b14a66a..4138fb7b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,15 +12,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block allowed-endpoints: > github.com:443 - - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga:latest@sha256:27a50ce07cc06958526e4182b3ace3019cad50a5506df2e20ea190e83e931f11 + uses: docker://oskarstark/php-cs-fixer-ga:latest@sha256:9702a9fd95c40b383507d97d467d4c9ff709a6b7c7d3a7a7da3b7c155ee0aa38 with: args: . --diff --dry-run diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 978b4dba..5508984c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -25,7 +25,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -39,14 +39,15 @@ jobs: oss-fuzz-build-logs.storage.googleapis.com:443 sigstore-tuf-root.storage.googleapis.com:443 rekor.sigstore.dev:443 + www.bestpractices.dev:443 - name: "Checkout code" - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif @@ -58,6 +59,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27 + uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 with: sarif_file: results.sarif diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index a58173ec..967156b2 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -13,11 +13,11 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: [ '7.4','8.0','8.1','8.2' ] + php-versions: [ '8.1','8.2','8.3' ] name: PHP ${{ matrix.php-versions }} Unit Test steps: - name: Harden Runner - uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: egress-policy: block allowed-endpoints: > @@ -33,15 +33,16 @@ jobs: repo.packagist.org:80 storage.googleapis.com:443 auth.docker.io:443 + *.githubusercontent.com:443 - name: Checkout - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Uses PHP ${{ matrix.php-versions }} - uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2 with: php-version: ${{ matrix.php-versions }} - name: Install Dependencies - uses: nick-invision/retry@39da88d5f7d15a96aed861dbabbe8b7443e3182a # v1.0.4 + uses: nick-invision/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 with: timeout_minutes: 10 max_attempts: 3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 418ce42a..0aa25116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,51 @@ # Changelog +## [1.4.0](https://github.com/GoogleCloudPlatform/functions-framework-php/compare/v1.3.0...v1.4.0) (2024-09-20) + + +### Features + +* add environment variable for configuring max_execution_time ([#185](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/185)) ([fd1ca55](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/fd1ca55def1bf267caf8ed0bf6ee1625df64abbf)) + + +### Bug Fixes + +* drop support for php 8.0 and earlier, add testing for php 8.3 ([1926fae](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/1926fae0ae121f7d19262d86c96e25e9aaa3b394)) +* use full import paths from vendor for new composer ([#163](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/163)) ([fb92e9e](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/fb92e9e198dbb71d9d70d7fc199e9981a6a42d26)) + + +### Miscellaneous Chores + +* **deps:** update actions/checkout action to v4 ([#176](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/176)) ([a90c0f3](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/a90c0f3393c3fba9c51d86052e8f1d5ed4987f04)) +* **deps:** update actions/dependency-review-action action to v3 ([#177](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/177)) ([bbbdfef](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/bbbdfefafd2c791420ca4d0ffb185863003c062a)) +* **deps:** update actions/dependency-review-action action to v4 ([#188](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/188)) ([a3eb48c](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/a3eb48c0199a2bc4adbcc6190b95e37a8480de10)) +* **deps:** update actions/setup-go action to v5 ([#183](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/183)) ([a81f023](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/a81f0232540711d0a6c022d857f7f45a555ec80d)) +* **deps:** update all non-major dependencies ([#175](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/175)) ([f1b4ac1](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/f1b4ac13b75f80384fe5368907a5e629f924462f)) +* **deps:** update all non-major dependencies ([#182](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/182)) ([ceb2acb](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/ceb2acb11802229bb7d1ae642925dd3e8ec06ec4)) +* **deps:** update all non-major dependencies ([#187](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/187)) ([1dc699f](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/1dc699f9067b25102c6e5acb9719ebdd9c9b554a)) +* **deps:** update dependency psr/http-message to v2 ([#189](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/189)) ([9f4b045](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/9f4b04573d15c70e1d25ab8f298f5b8c15c7b744)) +* **deps:** update github/codeql-action action to v3 ([#191](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/191)) ([7d1ba36](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/7d1ba3672ec7fc899ddaf9f0c995822555e16786)) +* **deps:** update googlecloudplatform/functions-framework-conformance digest to e42b153 ([#157](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/157)) ([85aed77](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/85aed7719107da6c2c932281fcac3f538830cf63)) +* **deps:** update nick-invision/retry action to v3 ([#192](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/192)) ([c0873b4](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/c0873b4bf9861f18ec4eeeda62486c67e6cc3736)) +* **deps:** update oskarstark/php-cs-fixer-ga:latest docker digest to 665532c ([#174](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/174)) ([1ad568d](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/1ad568dc86f97bc5fe6cde8f4993fade3c3dc859)) +* **deps:** update oskarstark/php-cs-fixer-ga:latest docker digest to 83b093a ([#181](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/181)) ([02f1777](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/02f1777308e9c66ecdc52fc9a21f2d713fa93383)) +* **deps:** update oskarstark/php-cs-fixer-ga:latest docker digest to 8ad55ef ([#158](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/158)) ([3f0a3e0](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/3f0a3e0019155d34374eae5a5a8594293910b132)) +* **deps:** update oskarstark/php-cs-fixer-ga:latest docker digest to 9702a9f ([#186](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/186)) ([8cfaeca](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/8cfaeca80c2174c6130dbb9cb44d6d0d3c19d405)) +* **deps:** update oskarstark/php-cs-fixer-ga:latest docker digest to dff3928 ([#171](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/171)) ([4aef2ea](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/4aef2eabe4e85ea131b1bf3aba18d7ed95d1a6b2)) +* **deps:** update oskarstark/php-cs-fixer-ga:latest docker digest to febc59e ([#179](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/179)) ([e3af608](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/e3af6084e305ad07b8dde1046d602587ae701f50)) +* **deps:** update shivammathur/setup-php digest to 6d7209f ([#180](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/180)) ([4faaea7](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/4faaea7cf011e5c01ea9af54fdbf361364e5341a)) +* **deps:** update shivammathur/setup-php digest to 81cd5ae ([#172](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/172)) ([e32b8fe](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/e32b8fe42519d28b369be538489269399bbadc69)) +* **deps:** update shivammathur/setup-php digest to c541c15 ([#195](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/195)) ([ebf37e1](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/ebf37e1dc4c1e4a88f06205452efc6b7c4cef5ef)) +* disable integration test on forks ([#165](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/165)) ([ed91598](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/ed9159810386612c51b416daacc77d510b550741)) +* fix CI ([#200](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/200)) ([06f5d8b](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/06f5d8b0f2e0675e43ac403065844b6dde5c70b9)) +* remove self from blunderbuss.yml ([#173](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/173)) ([d6cc80f](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/d6cc80f60e9b6b75dfd492007ca6c2dc4de02ffe)) +* run buildpack tests on pull ([#153](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/153)) ([8606f4c](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/8606f4c5ca32d5108d977d476bb53265c41d68c4)) +* Update blunderbuss.yml ([#164](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/164)) ([6496941](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/649694181b45175a91dd97d932cfdddeef83bdf4)) +* Update blunderbuss.yml ([#196](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/196)) ([e3a4d65](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/e3a4d658ab3fd127931818d26aaa3e29c622f40c)) +* Update blunderbuss.yml ([#197](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/197)) ([c2c095d](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/c2c095ddbb23da5093c4e85679d2bd1ee7c512fd)) +* Update harden runner and fix ci errors. ([#160](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/160)) ([1e26c21](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/1e26c21b0cf7908f50645a86b819fa8eaf5b3d1e)) +* Update scorecard.yml ([#199](https://github.com/GoogleCloudPlatform/functions-framework-php/issues/199)) ([347098a](https://github.com/GoogleCloudPlatform/functions-framework-php/commit/347098a608a1e0a173726d0ecc6d40f742b03e82)) + ## [1.3.0](https://github.com/GoogleCloudPlatform/functions-framework-php/compare/v1.2.0...v1.3.0) (2023-06-26) diff --git a/README.md b/README.md index 7adf82be..9da692d4 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ run the following commands: ```sh export FUNCTION_TARGET=helloHttp -php -S localhost:8080 vendor/bin/router.php +php -S localhost:8080 vendor/google/cloud-functions-framework/router.php ``` Open `http://localhost:8080/` in your browser and see *Hello World from a PHP HTTP function!*. @@ -231,7 +231,7 @@ variable to `cloudevent`. ```sh export FUNCTION_TARGET=helloCloudEvent export FUNCTION_SIGNATURE_TYPE=cloudevent -php -S localhost:8080 vendor/bin/router.php +php -S localhost:8080 vendor/google/cloud-functions-framework/router.php ``` In a separate tab, make a cURL request in Cloud Event format to your function: diff --git a/composer.json b/composer.json index e6b89eb3..e11f2f21 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,9 @@ "description": "Google Cloud Functions Framework for PHP", "license": "Apache-2.0", "require": { - "php": ">=7.4", + "php": ">=8.1", "guzzlehttp/psr7": "^1.7|^2.0", - "psr/http-message": "^1.0", + "psr/http-message": "^2.0", "cloudevents/sdk-php": "^1.0" }, "suggest": { @@ -17,7 +17,7 @@ } }, "require-dev": { - "phpunit/phpunit": "^7.5|^8.0", + "phpunit/phpunit": "^10.5|^11.3", "guzzlehttp/guzzle": "^7.2" }, "autoload-dev": { diff --git a/examples/hello/Dockerfile b/examples/hello/Dockerfile index 15671b98..74c9dc6b 100644 --- a/examples/hello/Dockerfile +++ b/examples/hello/Dockerfile @@ -10,7 +10,7 @@ WORKDIR /srv/ # # We configure it to use the `router.php` file included in this package. RUN mkdir .googleconfig && \ - echo '{"entrypointContents": "serve vendor/bin/router.php"}' > .googleconfig/app_start.json + echo '{"entrypointContents": "serve vendor/google/cloud-functions-framework/router.php"}' > .googleconfig/app_start.json # Copy over composer files and run "composer install" COPY composer.* ./ diff --git a/router.php b/router.php index 9f0dfad7..e763c300 100755 --- a/router.php +++ b/router.php @@ -42,6 +42,12 @@ // registered $projectContext->registerCloudStorageStreamWrapperIfPossible(); +// Initialize timeout, in case configured. +$custom_timeout = getenv('CLOUD_RUN_TIMEOUT_SECONDS'); +if ($custom_timeout !== false) { + set_time_limit($custom_timeout); +} + /** * Invoke the function based on the function type. */ diff --git a/tests/InvokerTest.php b/tests/InvokerTest.php index 3f525ca3..fc2cbda8 100644 --- a/tests/InvokerTest.php +++ b/tests/InvokerTest.php @@ -163,7 +163,7 @@ public function testTypedBadRequestError(): void $this->assertSame('Bad Request', (string) $response->getBody()); } - public function provideErrorHandling(): array + public static function provideErrorHandling(): array { return [ ['http', 'crash'], diff --git a/tests/conformance/prerun.sh b/tests/conformance/prerun.sh index 69186fc2..53a3151d 100755 --- a/tests/conformance/prerun.sh +++ b/tests/conformance/prerun.sh @@ -11,17 +11,20 @@ set -e cd $(dirname $0) -if [ -z "${FRAMEWORK_VERSION}" ] - then - echo "Functions Framework version required as first parameter" - exit 1 +if [ -z "${FRAMEWORK_VERSION}" ]; then + echo "Functions Framework version required as first parameter" + exit 1 +fi + +if [ -z "${GITHUB_HEAD_REF}" ]; then + GITHUB_HEAD_REF="main" fi echo '{ "require": { - "google/cloud-functions-framework": "dev-main#'${FRAMEWORK_VERSION}'", + "google/cloud-functions-framework": "dev-'${GITHUB_HEAD_REF}'#'${FRAMEWORK_VERSION}'", "cloudevents/sdk-php": "^1.0" } -}' > composer.json +}' >composer.json -cat composer.json \ No newline at end of file +cat composer.json diff --git a/tests/vendorTest.php b/tests/vendorTest.php index ddbf07b8..6ada5077 100644 --- a/tests/vendorTest.php +++ b/tests/vendorTest.php @@ -57,7 +57,7 @@ public function testDefaultFunctionSource(): void 'FUNCTION_SOURCE=' . ' FUNCTION_SIGNATURE_TYPE=http' . ' FUNCTION_TARGET=helloDefault' . - ' php %s/vendor/bin/router.php', + ' php %s/vendor/google/cloud-functions-framework/router.php', self::$tmpDir ); exec($cmd, $output); @@ -72,7 +72,7 @@ public function testRelativeFunctionSource(): void 'FUNCTION_SOURCE=relative.php' . ' FUNCTION_SIGNATURE_TYPE=http' . ' FUNCTION_TARGET=helloDefault' . - ' php %s/vendor/bin/router.php', + ' php %s/vendor/google/cloud-functions-framework/router.php', self::$tmpDir ); exec($cmd, $output); @@ -87,7 +87,7 @@ public function testAbsoluteFunctionSource(): void 'FUNCTION_SOURCE=%s/absolute.php' . ' FUNCTION_SIGNATURE_TYPE=http' . ' FUNCTION_TARGET=helloDefault' . - ' php %s/vendor/bin/router.php', + ' php %s/vendor/google/cloud-functions-framework/router.php', self::$tmpDir, self::$tmpDir ); @@ -103,7 +103,7 @@ public function testGcsIsNotRegistered(): void 'FUNCTION_SOURCE=%s/gcs.php' . ' FUNCTION_SIGNATURE_TYPE=http' . ' FUNCTION_TARGET=helloDefault' . - ' php %s/vendor/bin/router.php', + ' php %s/vendor/google/cloud-functions-framework/router.php', self::$tmpDir, self::$tmpDir ); @@ -124,7 +124,7 @@ public function testGcsIsRegistered(): void 'FUNCTION_SOURCE=%s/gcs.php' . ' FUNCTION_SIGNATURE_TYPE=http' . ' FUNCTION_TARGET=helloDefault' . - ' php %s/vendor/bin/router.php', + ' php %s/vendor/google/cloud-functions-framework/router.php', self::$tmpDir, self::$tmpDir ); @@ -132,4 +132,50 @@ public function testGcsIsRegistered(): void $this->assertEquals(['GCS Stream Wrapper is registered'], $output); } + + public function testLegacyVendorBinDefaultFunctionSource(): void + { + copy(__DIR__ . '/fixtures/index.php', self::$tmpDir . '/index.php'); + $cmd = sprintf( + 'FUNCTION_SOURCE=' . + ' FUNCTION_SIGNATURE_TYPE=http' . + ' FUNCTION_TARGET=helloDefault' . + ' php %s/vendor/bin/router.php', + self::$tmpDir + ); + exec($cmd, $output); + + $this->assertSame(['Hello Default!'], $output); + } + + public function testLegacyVendorBinRelativeFunctionSource(): void + { + copy(__DIR__ . '/fixtures/relative.php', self::$tmpDir . '/relative.php'); + $cmd = sprintf( + 'FUNCTION_SOURCE=relative.php' . + ' FUNCTION_SIGNATURE_TYPE=http' . + ' FUNCTION_TARGET=helloDefault' . + ' php %s/vendor/bin/router.php', + self::$tmpDir + ); + exec($cmd, $output); + + $this->assertSame(['Hello Relative!'], $output); + } + + public function testLegacyVendorBinAbsoluteFunctionSource(): void + { + copy(__DIR__ . '/fixtures/absolute.php', self::$tmpDir . '/absolute.php'); + $cmd = sprintf( + 'FUNCTION_SOURCE=%s/absolute.php' . + ' FUNCTION_SIGNATURE_TYPE=http' . + ' FUNCTION_TARGET=helloDefault' . + ' php %s/vendor/bin/router.php', + self::$tmpDir, + self::$tmpDir + ); + exec($cmd, $output); + + $this->assertSame(['Hello Absolute!'], $output); + } }