Skip to content

Commit abdc39b

Browse files
Run component tests, unit tests and static analysis in distro build (#29)
--------- Co-authored-by: Sergey Kleyman <Sergey.Kleyman@elastic.co>
1 parent 60a3bb1 commit abdc39b

File tree

398 files changed

+32025
-971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

398 files changed

+32025
-971
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ concurrency:
2323
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2424

2525
jobs:
26+
test-php-static-and-unit:
27+
uses: ./.github/workflows/test-php-static-and-unit.yml
28+
2629
build-compiler:
2730
uses: ./.github/workflows/native-dev-tools-build.yml
2831
secrets: inherit
@@ -58,13 +61,21 @@ jobs:
5861
- build-packages
5962
uses: ./.github/workflows/test-otel-unit.yml
6063

64+
test-packages-component-tests:
65+
needs:
66+
- build-packages
67+
uses: ./.github/workflows/test-packages-component-tests.yml
68+
69+
6170
# The very last job to report whether the Workflow passed.
6271
# This will act as the Branch Protection gatekeeper
6372
ci:
6473
needs:
6574
- tests-phpt
75+
- test-php-static-and-unit
6676
- build-packages
6777
- test-otel-unit
78+
- test-packages-component-tests
6879
runs-on: ubuntu-latest
6980
steps:
7081
- name: report
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
3+
# Generates matrix for component tests
4+
name: generate-component-tests-matrix
5+
6+
on:
7+
workflow_call:
8+
outputs:
9+
matrix:
10+
description: "Matrix for component tests"
11+
value: ${{ jobs.generate-component-tests-matrix.outputs.matrix }}
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
generate-component-tests-matrix:
18+
name: generate-component-tests-matrix
19+
timeout-minutes: 5
20+
runs-on: ubuntu-latest
21+
outputs:
22+
matrix: ${{ steps.generate.outputs.matrix }}
23+
steps:
24+
- uses: actions/checkout@v6
25+
- id: generate
26+
run: |
27+
MATRIX_JSON=$(./tools/test/component/generate_matrix.sh | jq --raw-input --slurp -c 'split("\n") | map(select(length > 0)) | map({ "row": . } )')
28+
echo "matrix={\"include\":${MATRIX_JSON}}"
29+
echo "matrix={\"include\":${MATRIX_JSON}}" >> $GITHUB_OUTPUT
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
3+
name: test-packages-component-tests
4+
5+
on:
6+
workflow_call: ~
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
BUILD_PACKAGES_SUB_DIR: build/packages
13+
COMPONENT_TESTS_LOGS_SUB_DIR: build/component_tests_logs
14+
15+
jobs:
16+
generate-component-tests-matrix:
17+
uses: ./.github/workflows/generate-component-tests-matrix.yml
18+
19+
run-component-tests-in-docker-for-one-matrix-row:
20+
name: row
21+
runs-on: 'ubuntu-latest'
22+
needs: generate-component-tests-matrix
23+
timeout-minutes: 300
24+
strategy:
25+
fail-fast: false
26+
matrix: ${{ fromJson(needs.generate-component-tests-matrix.outputs.matrix) }}
27+
env:
28+
MATRIX_ROW: ${{ matrix.row }}
29+
steps:
30+
- uses: actions/checkout@v6
31+
- name: Download built packages
32+
uses: actions/download-artifact@v7
33+
with:
34+
pattern: packages-*
35+
path: ${{ env.BUILD_PACKAGES_SUB_DIR }}
36+
37+
- name: Run component tests
38+
continue-on-error: false
39+
run: |
40+
mv "${PWD}/${{ env.BUILD_PACKAGES_SUB_DIR }}/"*/* "${PWD}/${{ env.BUILD_PACKAGES_SUB_DIR }}/"
41+
rm -rf "${PWD}/${{ env.BUILD_PACKAGES_SUB_DIR }}/packages-"*
42+
./tools/test/component/test_packages_one_matrix_row_in_docker.sh --matrix_row "${MATRIX_ROW}" --packages_dir "${PWD}/${{ env.BUILD_PACKAGES_SUB_DIR }}" --logs_dir "${PWD}/${{ env.COMPONENT_TESTS_LOGS_SUB_DIR }}"
43+
- uses: actions/upload-artifact@v6
44+
if: always()
45+
continue-on-error: false
46+
with:
47+
name: test-packages-component-tests-${{ matrix.row }}
48+
path: |
49+
${{ env.COMPONENT_TESTS_LOGS_SUB_DIR }}/*
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
3+
name: test-php-static-and-unit
4+
5+
on:
6+
workflow_call: ~
7+
workflow_dispatch: ~
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
UNIT_TESTS_LOGS_SUB_DIR: build/unit_tests_logs
14+
15+
jobs:
16+
generate-php-versions:
17+
uses: ./.github/workflows/generate-php-versions.yml
18+
19+
static-check-and-unit-tests:
20+
name: static check and unit tests
21+
runs-on: ubuntu-latest
22+
needs: generate-php-versions
23+
timeout-minutes: 30
24+
strategy:
25+
fail-fast: false
26+
matrix: ${{ fromJson(needs.generate-php-versions.outputs.php-versions) }}
27+
env:
28+
PHP_VERSION: ${{ matrix.php-version }}
29+
steps:
30+
- uses: actions/checkout@v6
31+
- name: Invoke test_php_static_and_unit.sh
32+
run: ./tools/test/test_php_static_and_unit.sh --php_versions "${PHP_VERSION}" --logs_dir "${PWD}/${{ env.UNIT_TESTS_LOGS_SUB_DIR }}"
33+
- uses: actions/upload-artifact@v6
34+
if: always()
35+
continue-on-error: false
36+
with:
37+
name: test_php_static_and_unit-log-${{ matrix.php-version }}
38+
path: |
39+
${{ env.UNIT_TESTS_LOGS_SUB_DIR }}/*

.gitignore

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Generated files
2+
prod/php/OpenTelemetry/Distro/PhpPartVersion.php
3+
prod/php/OpenTelemetry/Distro/Log/LogFeature.php
4+
5+
# Mac
6+
.DS_Store
7+
8+
# JetBrains PhpStorm
9+
.idea/
10+
11+
# Visual Studio
12+
.vs/
13+
14+
# Visual Studio Code
15+
.vscode/
16+
17+
# Composer
18+
composer.lock
19+
composer.phar
20+
vendor/
21+
prod/php/vendor_*/
22+
23+
# PHP_CodeSniffer
24+
.php_cs.cache
25+
26+
# PHPUnit
27+
.phpunit.result.cache
28+
29+
#phpt results folder
30+
prod/native/extension/phpt/results/
31+
prod/native/phpbridge_extension/phpt/results/
32+
33+
#native build folder
34+
prod/native/_build/
35+
36+
# Built documentation
37+
html_docs
38+
39+
# Packaging artifacts and generated unit test reports
40+
build/*
41+
42+
# Backup files when using sed
43+
.bck
44+
45+
# For local development
46+
z_local*
47+
48+
# Per user PHPStan configuration
49+
phpstan.neon
50+
51+
# Prerequisites
52+
*.d
53+
54+
# Compiled Object files
55+
*.slo
56+
*.lo
57+
*.o
58+
*.obj
59+
60+
# Precompiled Headers
61+
*.gch
62+
*.pch
63+
64+
# Compiled Dynamic libraries
65+
*.so
66+
*.dylib
67+
*.dll
68+
69+
# Fortran module files
70+
*.mod
71+
*.smod
72+
73+
# Compiled Static libraries
74+
*.lai
75+
*.la
76+
*.a
77+
*.lib
78+
79+
# Executables
80+
*.exe
81+
*.out
82+
*.app
83+
84+
# Docs
85+
.artifacts
86+
docs/.artifacts

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"autoload-dev": {
5454
"psr-4": {
5555
"OpenTelemetry\\Distro\\": "./prod/php/OpenTelemetry/Distro/",
56-
"ElasticOTelTests\\": "./tests/ElasticOTelTests/",
57-
"ElasticOTelTools\\Build\\": "./tools/build/"
56+
"OTelDistroTests\\": "./tests/OTelDistroTests/",
57+
"OpenTelemetry\\DistroTools\\Build\\": "./tools/build/"
5858
}
5959
},
6060
"config": {
@@ -74,7 +74,7 @@
7474
"php tools/build/direct_composer_install_update_not_allowed.php update"
7575
],
7676
"generate_lock_use_current_json": [
77-
"@putenv OTEL_PHP_PHP_TOOLS_ALLOW_DIRECT_COMPOSER_COMMAND=true",
77+
"@putenv OTEL_PHP_TOOLS_ALLOW_DIRECT_COMPOSER_COMMAND=true",
7878
"composer --ignore-platform-req=ext-mysqli --ignore-platform-req=ext-pgsql --ignore-platform-req=ext-opentelemetry --no-interaction --no-plugins --no-scripts --no-install update"
7979
],
8080
"parallel-lint": [

generated_composer_lock_files/dev.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"autoload-dev": {
5454
"psr-4": {
5555
"OpenTelemetry\\Distro\\": "./prod/php/OpenTelemetry/Distro/",
56-
"ElasticOTelTests\\": "./tests/ElasticOTelTests/",
57-
"ElasticOTelTools\\Build\\": "./tools/build/"
56+
"OTelDistroTests\\": "./tests/OTelDistroTests/",
57+
"OpenTelemetry\\DistroTools\\Build\\": "./tools/build/"
5858
}
5959
},
6060
"config": {
@@ -74,7 +74,7 @@
7474
"php tools/build/direct_composer_install_update_not_allowed.php update"
7575
],
7676
"generate_lock_use_current_json": [
77-
"@putenv OTEL_PHP_PHP_TOOLS_ALLOW_DIRECT_COMPOSER_COMMAND=true",
77+
"@putenv OTEL_PHP_TOOLS_ALLOW_DIRECT_COMPOSER_COMMAND=true",
7878
"composer --ignore-platform-req=ext-mysqli --ignore-platform-req=ext-pgsql --ignore-platform-req=ext-opentelemetry --no-interaction --no-plugins --no-scripts --no-install update"
7979
],
8080
"parallel-lint": [

0 commit comments

Comments
 (0)