Skip to content

Commit 04421ae

Browse files
committed
Initial commit with actions
1 parent 2204639 commit 04421ae

14 files changed

+393
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
labels: bug
5+
---
6+
7+
**Describe your environment** Describe any aspect of your environment relevant to the problem, including your php version (`php -v` will tell you your current version), version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on master.
8+
9+
**Steps to reproduce**
10+
Describe exactly how to reproduce the error. Include a code sample if applicable.
11+
12+
**What is the expected behavior?**
13+
What did you expect to see?
14+
15+
**What is the actual behavior?**
16+
What did you see instead?
17+
18+
**Additional context**
19+
Add any other context about the problem here.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
labels: feature-request
5+
---
6+
7+
Before opening a feature request against this repo, consider whether the feature should/could be implemented in the [other OpenTelemetry client libraries](https://github.com/open-telemetry). If so, please [open an issue in opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification/issues/new) first.
8+
9+
**Is your feature request related to a problem?**
10+
If so, provide a concise description of the problem.
11+
12+
**Describe the solution you'd like**
13+
What do you want to happen instead? What is the expected behavior?
14+
15+
**Describe alternatives you've considered**
16+
Which alternative solutions or features have you considered?
17+
18+
**Additional context**
19+
Add any other context about the feature request here.

.github/workflows/php.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
name: PHP Composer
3+
4+
on:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
operating-system: [ubuntu-latest]
17+
php-versions: ['7.3', '7.4', '8.0']
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-versions }}
26+
coverage: xdebug
27+
tools: php-cs-fixer
28+
extensions: ast, grpc
29+
30+
- name: Validate composer.json and composer.lock
31+
run: composer validate
32+
33+
- name: Cache Composer packages
34+
id: composer-cache
35+
uses: actions/cache@v2
36+
with:
37+
path: vendor
38+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-php-
41+
42+
- name: Install dependencies
43+
if: steps.composer-cache.outputs.cache-hit != 'true'
44+
run: composer install --prefer-dist --no-progress --no-suggest
45+
46+
- name: Check Style
47+
run: vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --stop-on-violation --using-cache=no
48+
49+
- name: Run Phan
50+
env:
51+
PHAN_DISABLE_XDEBUG_WARN: 1
52+
run: vendor/bin/phan
53+
54+
- name: Run Psalm
55+
run: vendor/bin/psalm --output-format=github
56+
57+
- name: Run Phpstan
58+
run: vendor/bin/phpstan analyse --error-format=github
59+
60+
- name: Run PHPUnit
61+
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
62+
63+
- name: Code Coverage
64+
run: bash <(curl -s https://codecov.io/bash)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Psalm Security Analysis
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
psalm:
7+
name: Psalm
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
13+
- name: Psalm
14+
uses: docker://vimeo/psalm-github-actions
15+
with:
16+
composer_require_dev: true
17+
composer_ignore_platform_reqs: true
18+
security_analysis: true
19+
report_file: results.sarif
20+
21+
- name: Upload Security Analysis results to GitHub
22+
uses: github/codeql-action/upload-sarif@v1
23+
with:
24+
sarif_file: results.sarif

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
composer.phar
2+
composer.lock
3+
var
4+
vendor
5+
.idea/
6+
coverage.clover
7+
tests/coverage
8+
.php_cs.cache
9+
10+
# W3C Test Service build artifacts
11+
tests/TraceContext/W3CTestService/test_app
12+
tests/TraceContext/W3CTestService/trace-context

.php_cs

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
$finder = PhpCsFixer\Finder::create()
3+
->exclude('vendor')
4+
->exclude('var/cache')
5+
->exclude('proto')
6+
->in(__DIR__);
7+
8+
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'concat_space' => ['spacing' => 'one'],
11+
'declare_equal_normalize' => ['space' => 'none'],
12+
'is_null' => true,
13+
'modernize_types_casting' => true,
14+
'ordered_imports' => true,
15+
'php_unit_construct' => true,
16+
'single_line_comment_style' => true,
17+
'yoda_style' => false,
18+
'@PSR2' => true,
19+
'array_syntax' => ['syntax' => 'short'],
20+
'blank_line_after_opening_tag' => true,
21+
'blank_line_before_return' => true,
22+
'blank_line_before_statement' => true,
23+
'cast_spaces' => true,
24+
'declare_strict_types' => true,
25+
'function_typehint_space' => true,
26+
'include' => true,
27+
'lowercase_cast' => true,
28+
'new_with_braces' => true,
29+
'no_extra_consecutive_blank_lines' => true,
30+
'no_leading_import_slash' => true,
31+
'no_short_echo_tag' => true,
32+
'no_unused_imports' => true,
33+
'no_useless_else' => true,
34+
'no_useless_return' => true,
35+
'ordered_imports' => true,
36+
'phpdoc_order' => true,
37+
'phpdoc_scalar' => true,
38+
'phpdoc_types' => true,
39+
'short_scalar_cast' => true,
40+
'single_blank_line_before_namespace' => true,
41+
'single_quote' => true,
42+
'trailing_comma_in_multiline_array' => true,
43+
])
44+
->setRiskyAllowed(true)
45+
->setFinder($finder);

CODEOWNERS

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#####################################################
2+
#
3+
# List of approvers for OpenTelemetry PHP API/SDK
4+
#
5+
#####################################################
6+
#
7+
# Learn about membership in OpenTelemetry community:
8+
# https://github.com/open-telemetry/community/blob/master/community-membership.md
9+
#
10+
#
11+
# Learn about CODEOWNERS file format:
12+
# https://help.github.com/en/articles/about-code-owners
13+
#
14+
15+
* @bobstrecansky @beniamin @zsistla @fahmy-mohammed

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Maintainers ([@open-telemetry/php-maintainers](https://github.com/orgs/open-telemetry/teams/php-maintainers)):
2+
3+
- [Bob Strecansky](https://github.com/bobstrecansky), Mailchimp
4+
5+
Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#maintainer)
6+
7+
Approvers ([@open-telemetry/php-approvers](https://github.com/orgs/open-telemetry/teams/php-approvers)):
8+
9+
- [Levi Morrison](https://github.com/morrisonlevi), Datadog
10+
- [Austin Schoen](https://github.com/AustinSchoen), Mailchimp
11+
- [Beniamin Calota](https://github.com/beniamin), eMag
12+
13+
Find more information about the approver role in the [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#approver)
14+
15+
Triagers ([@open-telemetry/php-triagers](https://github.com/orgs/open-telemetry/teams/php-triagers)):
16+
17+
- [Jodee Varney](https://github.com/jodeev), Splunk
18+
19+
Find more information about the triager role in the [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#triager)

code-of-conduct.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Code Of Conduct
2+
opentelemetry-php follows the code of conduct that the rest of the OpenTelemetry [community](https://github.com/open-telemetry/community/blob/master/code-of-conduct.md) follows, the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md)

codecov.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
codecov:
2+
require_ci_to_pass: false
3+
4+
coverage:
5+
precision: 2
6+
round: down
7+
range: "70...100"
8+
status:
9+
project: true
10+
patch: false
11+
12+
parsers:
13+
gcov:
14+
branch_detection:
15+
conditional: true
16+
loop: true
17+
method: false
18+
macro: false
19+
20+
comment:
21+
layout: "reach,diff,flags,files,footer"
22+
behavior: default
23+
require_changes: false

composer.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "open-telemetry/opentelemetry",
3+
"description": "OpenTelemetry makes robust, portable telemetry a built-in feature of cloud-native software.",
4+
"type": "library",
5+
"license": "Apache-2.0",
6+
"require": {
7+
"php": "^7.3 || ^8.0",
8+
"ext-json": "*",
9+
"promphp/prometheus_client_php": "^2.2.1",
10+
"grpc/grpc": "^1.30",
11+
"google/protobuf": "^v3.3.0",
12+
"psr/http-client-implementation": "^1.0",
13+
"psr/http-factory-implementation": "^1.0"
14+
},
15+
"authors": [
16+
{
17+
"name": "Bob Strecansky",
18+
"email": "[email protected]"
19+
},
20+
{
21+
"name": "Dmitry Krokhin",
22+
"email": "[email protected]"
23+
},
24+
{
25+
"name": "Levi Morrison",
26+
"email": "[email protected]"
27+
}
28+
],
29+
"autoload": {
30+
"psr-4": {
31+
"OpenTelemetry\\Context\\": "Context",
32+
"OpenTelemetry\\": "api",
33+
"OpenTelemetry\\Sdk\\": "sdk",
34+
"OpenTelemetry\\Contrib\\": "contrib",
35+
"Opentelemetry\\Proto\\Collector\\Trace\\V1\\": "proto/Opentelemetry/Proto/Collector/Trace/V1",
36+
"Opentelemetry\\Proto\\Trace\\V1\\":"proto/Opentelemetry/Proto/Trace/V1",
37+
"Opentelemetry\\Proto\\Common\\V1\\":"proto/Opentelemetry/Proto/Common/V1",
38+
"Opentelemetry\\Proto\\Resource\\V1\\":"proto/Opentelemetry/Proto/Resource/V1",
39+
"GPBMetadata\\Opentelemetry\\Proto\\Collector\\Trace\\V1\\": "proto/GPBMetadata/Opentelemetry/Proto/Collector/Trace/V1",
40+
"GPBMetadata\\Opentelemetry\\Proto\\Trace\\V1\\":"proto/GPBMetadata/Opentelemetry/Proto/Trace/V1",
41+
"GPBMetadata\\Opentelemetry\\Proto\\Common\\V1\\":"proto/GPBMetadata/Opentelemetry/Proto/Common/V1",
42+
"GPBMetadata\\Opentelemetry\\Proto\\Resource\\V1\\":"proto/GPBMetadata/Opentelemetry/Proto/Resource/V1"
43+
}
44+
},
45+
"autoload-dev": {
46+
"psr-4": {
47+
"OpenTelemetry\\Tests\\": "tests/"
48+
}
49+
},
50+
"require-dev": {
51+
"phpunit/phpunit": "^9.3",
52+
"composer/xdebug-handler": "^1.3",
53+
"phan/phan": "^3.0",
54+
"friendsofphp/php-cs-fixer": "^2.18",
55+
"vimeo/psalm": "^4.0",
56+
"phpstan/phpstan": "^0.12.50",
57+
"phpstan/phpstan-phpunit": "^0.12.16",
58+
"psalm/plugin-phpunit": "^0.13.0",
59+
"guzzlehttp/guzzle": "^7.3",
60+
"guzzlehttp/psr7": "^2.0@RC",
61+
"symfony/http-client": "^5.2",
62+
"nyholm/psr7": "^1.4"
63+
}
64+
}

phpstan.neon.dist

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
includes:
2+
- vendor/phpstan/phpstan-phpunit/extension.neon
3+
4+
parameters:
5+
tmpDir: var/cache/phpstan
6+
level: 5
7+
paths:
8+
- .
9+
excludes_analyse:
10+
- var
11+
- vendor
12+
- proto
13+
- tests/TraceContext/W3CTestService

phpunit.xml.dist

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
6+
backupGlobals="false"
7+
backupStaticAttributes="false"
8+
bootstrap="./vendor/autoload.php"
9+
cacheResult="false"
10+
colors="false"
11+
convertErrorsToExceptions="true"
12+
convertNoticesToExceptions="true"
13+
convertWarningsToExceptions="true"
14+
forceCoversAnnotation="false"
15+
processIsolation="false"
16+
stopOnError="false"
17+
stopOnFailure="false"
18+
stopOnIncomplete="false"
19+
stopOnSkipped="false"
20+
stopOnRisky="false"
21+
timeoutForSmallTests="1"
22+
timeoutForMediumTests="10"
23+
timeoutForLargeTests="60"
24+
verbose="true">
25+
26+
<coverage processUncoveredFiles="true">
27+
<include>
28+
<directory>contrib</directory>
29+
<directory>sdk</directory>
30+
</include>
31+
</coverage>
32+
33+
<php>
34+
<ini name="date.timezone" value="UTC" />
35+
<ini name="display_errors" value="On" />
36+
<ini name="display_startup_errors" value="On" />
37+
<ini name="error_reporting" value="E_ALL" />
38+
</php>
39+
40+
<testsuites>
41+
<!-- <testsuite name="Sdk Unit Tests">
42+
<directory>./tests/Sdk/Unit</directory>
43+
</testsuite>
44+
<testsuite name="Integration Tests">
45+
<directory>./tests/Sdk/Integration</directory>
46+
</testsuite>
47+
<testsuite name="Contrib Unit Tests">
48+
<directory>./tests/Contrib/Unit</directory>
49+
</testsuite>
50+
<testsuite name="Context Unit Tests">
51+
<directory>./tests/Context/Unit</directory>
52+
</testsuite>
53+
!-->
54+
</testsuites>
55+
56+
</phpunit>

0 commit comments

Comments
 (0)