File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed
functions/helloworld_pubsub Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"require" : {
3
+ "php" : " >= 7.4" ,
3
4
"cloudevents/sdk-php" : " ^1.0" ,
4
5
"google/cloud-functions-framework" : " ^1.1"
5
6
},
Original file line number Diff line number Diff line change
1
+
2
+
3
+ require __DIR__ . '/vendor/autoload.php ' ;
4
+
5
+ if (count ($ argv ) > 2 ) {
6
+ die ('Usage: check_version.php CONSTRAINT ' . PHP_EOL );
7
+ }
8
+
9
+ if ('null ' === $ argv [1 ]) {
10
+ // If there is no php constraint, it satisfies
11
+ echo '0 ' ;
12
+ return ;
13
+ }
14
+
15
+ echo Composer \Semver \Semver::satisfies (PHP_VERSION , $ argv [1 ]) ? '0 ' : '1 ' ;
Original file line number Diff line number Diff line change 8
8
"google/cloud-tools" : " dev-master" ,
9
9
"guzzlehttp/guzzle" : " ^7.0" ,
10
10
"phpunit/phpunit" : " ^7|^8" ,
11
- "friendsofphp/php-cs-fixer" : " ^3.0"
11
+ "friendsofphp/php-cs-fixer" : " ^3.0" ,
12
+ "composer/semver" : " ^3.2"
12
13
}
13
14
}
Original file line number Diff line number Diff line change 170
170
# Generate the lock file (required for check-platform-reqs)
171
171
composer update --ignore-platform-reqs
172
172
# If the PHP required version is too low, skip the test
173
- if composer check-platform-reqs | grep " requires php" | grep failed ; then
173
+ EXPLICITLY_SKIPPED=$( php $TESTDIR /check_version.php " $( cat composer.json | jq -r .require.php) " ) ;
174
+ if composer check-platform-reqs | grep " requires php" | grep failed && [ " $EXPLICITLY_SKIPPED " -eq " 1" ]; then
174
175
echo " Skipping tests in $DIR (incompatible PHP version)"
175
176
else
176
177
# Run composer without "-q"
You can’t perform that action at this time.
0 commit comments