-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added static check and GitHub workflow for it (#137)
* Added static check and GitHub workflow for it * Marked test_php_static_check.sh as executable * Give human readable names to stages in test-php-static-check.yml * Revert back to `return new CompletedFuture(null)` in `ElasticHttpTransport::send` * Fixed issues found by static analysis in the changes from main * Added ability to run multiple PHP version to test_php_static_check.sh * Fixed PHP versions format in test-php-static-check.yml matrix * Switched to generated list of the supported PHP versions Generating list of the supported PHP versions by reading from ./elastic-otel-php.properties * Make new workflow names more aligned with the existing * echo -n instead of echo in generate-php-versions.yml * Fixed issues with list generation * Refactored to have only one workflows triggered on PR * Refactored workflows * Cleaned up for better diff
- Loading branch information
1 parent
3d75448
commit 113e075
Showing
24 changed files
with
448 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
|
||
# Generates list of supported PHP versions by reading supported_php_versions property in ./elastic-otel-php.properties | ||
name: generate-php-versions | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
php-versions: | ||
description: "Generated list of supported PHP versions" | ||
value: ${{ jobs.generate-php-versions.outputs.php-versions }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
generate-php-versions: | ||
name: generate-php-versions | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
outputs: | ||
php-versions: ${{ steps.generate.outputs.php-versions }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: generate | ||
run: | | ||
source ./tools/read_properties.sh | ||
read_properties elastic-otel-php.properties PROJECT_PROPERTIES | ||
PHP_VERSIONS=${PROJECT_PROPERTIES_SUPPORTED_PHP_VERSIONS//[()]/} | ||
echo "PHP_VERSIONS: ${PHP_VERSIONS}" | ||
PHP_VERSIONS_JSON=$(echo -n ${PHP_VERSIONS} | jq --raw-input --slurp --compact-output 'split(" ") | map(select(length > 0)) | map({ "php-version": . } )') | ||
echo "php-versions={\"include\":${PHP_VERSIONS_JSON}}" | ||
echo "php-versions={\"include\":${PHP_VERSIONS_JSON}}" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
|
||
name: test-php-static-check | ||
|
||
on: | ||
workflow_call: ~ | ||
workflow_dispatch: ~ | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
generate-php-versions: | ||
uses: ./.github/workflows/generate-php-versions.yml | ||
|
||
static-check: | ||
runs-on: ubuntu-latest | ||
needs: generate-php-versions | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.generate-php-versions.outputs.php-versions) }} | ||
env: | ||
PHP_VERSION: ${{ matrix.php-version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Invoke test_php_static_check.sh | ||
run: ./tools/build/test_php_static_check.sh --php_versions "${PHP_VERSION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Elastic\OTel; | ||
|
||
use Elastic\OTel\Util\StaticClassTrait; | ||
|
||
/** | ||
* Code in this file is part of implementation internals, and thus it is not covered by the backward compatibility. | ||
* | ||
* @internal | ||
*/ | ||
final class ElasticOTelPhpPartVersion | ||
{ | ||
use StaticClassTrait; | ||
|
||
public static function get(): string | ||
{ | ||
/** | ||
* @var string $phpPartVersion | ||
* | ||
* Constant \Elastic\OTel\ELASTIC_OTEL_PHP_VERSION is defined in the generated file prod/php/ElasticOTel/PhpPartVersion.php | ||
* | ||
* @noinspection PhpUnnecessaryFullyQualifiedNameInspection, PhpUndefinedConstantInspection | ||
*/ | ||
$phpPartVersion = \Elastic\OTel\ELASTIC_OTEL_PHP_VERSION; // @phpstan-ignore constant.notFound | ||
return $phpPartVersion; | ||
} | ||
} |
Oops, something went wrong.