CI #329
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
name: CI | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '37 9 1 * *' | |
jobs: | |
############################################################################### | |
################################### GENERAL ################################### | |
############################################################################### | |
check_secrets: | |
name: "Check SCOUT_APM_KEY secret" | |
runs-on: ubuntu-latest | |
outputs: | |
has_scout_apm_key_secret: ${{ steps.check_scout_apm_key_secret_job.outputs.has_scout_apm_key_secret }} | |
steps: | |
- name: "Check if SCOUT_APM_KEY secret is available for this build" | |
id: check_scout_apm_key_secret_job | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
run: | | |
echo "has_scout_apm_key_secret: ${{ env.SCOUT_APM_KEY != '' }}" | |
echo "has_scout_apm_key_secret=${{ env.SCOUT_APM_KEY != '' }}" >> $GITHUB_OUTPUT | |
base-unit: | |
name: "Unit tests" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "ubuntu-latest" | |
dependencies: | |
- "lowest" | |
- "highest" | |
scout-ext: | |
- "with-scout-ext" | |
- "no-scout-ext" | |
extensions: [ | |
"", | |
"mongodb" | |
] | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
services: | |
mongo: | |
image: mongo | |
ports: | |
- 27017:27017 | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: "curl, sockets, fileinfo, ${{ matrix.extensions }}" | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Normally, we'd just add "scoutapm" to the above extensions in shivammathur/setup-php, but libcurl appears to | |
# be missing wherever the extension is built (not immediately obvious), so install it first | |
- name: "Install scoutapm extension" | |
if: ${{ matrix.scout-ext == 'with-scout-ext' }} | |
run: | | |
sudo apt-get update | |
sudo apt --fix-broken install | |
sudo apt-get install -y libcurl4-openssl-dev | |
sudo mkdir -p /tmp/pear/temp | |
sudo pecl update-channels | |
yes | sudo pecl install -f scoutapm | |
- name: "Install lowest dependencies" | |
if: ${{ matrix.dependencies == 'lowest' }} | |
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress" | |
- name: "Install highest dependencies" | |
if: ${{ matrix.dependencies == 'highest' }} | |
run: "composer update --prefer-dist --no-interaction --no-progress" | |
- name: "Run PHPUnit test suite" | |
run: "vendor/bin/phpunit --testsuite=unit,integration" | |
windows-unit: | |
name: "Windows tests" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- "windows-latest" | |
dependencies: | |
- "lowest" | |
- "highest" | |
scout-ext: | |
- "with-scout-ext" | |
- "no-scout-ext" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Vampire/setup-wsl@v2 | |
if: ${{ matrix.os == 'windows-latest' }} | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
ini-values: "${{ matrix.scout-ext == 'with-scout-ext' && 'zend_extension=D:\\a\\scout-apm-php\\scout-apm-php\\php_scoutapm.dll' || '' }}" | |
tools: pecl, composer:v2.3 | |
extensions: "curl, sockets, fileinfo, ${{ matrix.extensions }}" | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Get latest scoutapm extension version" | |
if: ${{ matrix.scout-ext == 'with-scout-ext' }} | |
uses: octokit/[email protected] | |
id: get_latest_ext_release | |
with: | |
route: GET /repos/scoutapp/scout-apm-php-ext/releases/latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Install scoutapm extension" | |
if: ${{ matrix.scout-ext == 'with-scout-ext' }} | |
shell: wsl-bash {0} | |
run: | | |
apt-get update && apt-get install -y jq curl unzip | |
# `shivammathur/setup-php` uses "nts" by default: https://github.com/shivammathur/setup-php#phpts-optional | |
SCOUT_EXT_THREAD_SAFE="nts" | |
# `windows-latest` currently uses x64 | |
SCOUT_EXT_ARCH="x64" | |
SCOUT_EXT_CONFIGURATION="${{ matrix.php-version }}-${SCOUT_EXT_THREAD_SAFE}-${SCOUT_EXT_ARCH}" | |
SCOUT_EXT_DLL_ZIP=$(echo '${{ toJSON(fromJson(steps.get_latest_ext_release.outputs.data).assets) }}' | jq -r "map(select(.name | contains(\"${SCOUT_EXT_CONFIGURATION}\"))) | .[0].browser_download_url") | |
echo "Found release URL: ${SCOUT_EXT_DLL_ZIP}" | |
curl -L -o scoutapm-ext.zip "${SCOUT_EXT_DLL_ZIP}" | |
unzip scoutapm-ext.zip php_scoutapm.dll | |
- name: "Install lowest dependencies" | |
if: ${{ matrix.dependencies == 'lowest' }} | |
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress" | |
- name: "Install highest dependencies" | |
if: ${{ matrix.dependencies == 'highest' }} | |
run: "composer update --prefer-dist --no-interaction --no-progress" | |
- name: "Run PHPUnit test suite - unit" | |
run: "vendor/bin/phpunit --testsuite=unit" | |
- name: "Download and run core agent" | |
shell: wsl-bash {0} | |
run: | | |
sudo apt-get update && sudo apt-get install -y wget | |
wget https://s3-us-west-1.amazonaws.com/scout-public-downloads/apm_core_agent/release/scout_apm_core-v1.4.0-x86_64-unknown-linux-musl.tgz | |
tar zxvf scout_apm_core-v1.4.0-x86_64-unknown-linux-musl.tgz | |
./core-agent start --tcp 0.0.0.0:4444 --log-file core-agent.log --log-level DEBUG --daemonize true | |
- name: "Run PHPUnit test suite - integration" | |
run: "vendor/bin/phpunit --testsuite=integration --testdox" | |
env: | |
SCOUT_CORE_AGENT_DOWNLOAD: false | |
SCOUT_CORE_AGENT_LAUNCH: false | |
SCOUT_CORE_AGENT_SOCKET_PATH: tcp://127.0.0.1:4444 | |
memory-leak-unit: | |
name: "Memory leak test" | |
needs: [ check_secrets ] | |
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
dependencies: ["highest"] | |
scout-ext: ["with-scout-ext", "no-scout-ext"] | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: "curl" | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Normally, we'd just add "scoutapm" to the above extensions in shivammathur/setup-php, but libcurl appears to | |
# be missing wherever the extension is built (not immediately obvious), so install it first | |
- name: "Install scoutapm extension" | |
if: matrix.scout-ext == 'with-scout-ext' | |
run: | | |
sudo apt-get update | |
sudo apt --fix-broken install | |
sudo apt-get install -y libcurl4-openssl-dev | |
sudo mkdir -p /tmp/pear/temp | |
sudo pecl update-channels | |
yes | sudo pecl install -f scoutapm | |
- name: "Install lowest dependencies" | |
if: matrix.dependencies == 'lowest' | |
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress" | |
- name: "Install highest dependencies" | |
if: matrix.dependencies == 'highest' | |
run: "composer update --prefer-dist --no-interaction --no-progress" | |
- name: "Check for memory leaks" | |
run: "tests/check-memory-leaks.sh" | |
coding-standards: | |
name: "Check coding standards" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "7.2" | |
tools: composer:v2.3 | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Install dependencies" | |
run: "composer install --no-interaction --prefer-dist" | |
- name: "Run PHP_CodeSniffer" | |
run: "vendor/bin/phpcs" | |
static-analysis: | |
name: "Perform static analysis" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "7.2" | |
tools: composer:v2.3 | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Install dependencies" | |
run: "composer install --no-interaction --prefer-dist" | |
- name: "Run Psalm" | |
run: "vendor/bin/psalm" | |
roave-backwards-compatibility-check: | |
name: "Check for Backward Compatibility breaks" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "8.1" | |
tools: composer:v2.3 | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Require Roave/BackwardCompatibilityCheck" | |
run: "composer require --no-update --no-interaction --prefer-dist --prefer-stable --dev roave/backward-compatibility-check:^6.0.1" | |
- name: "Composer update with new requirements" | |
run: "composer update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Check for BC breaks" | |
run: ".github/workflows/roave-backwards-compatibility-check.sh --install-development-dependencies --from=origin/${{ github.base_ref }}" | |
############################################################################### | |
################################### SYMFONY ################################### | |
############################################################################### | |
symfony-unit: | |
needs: base-unit | |
name: "Symfony Unit" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
extensions: ["scoutapm", ""] | |
twig-version: | |
- "2.*" | |
- "3.*" | |
symfony-version: | |
- "4.*" | |
- "5.*" | |
- "6.*" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
exclude: | |
- { symfony-version: "6.*", php-version: "7.2" } # Symfony 6 requires 8.0+ | |
- { symfony-version: "6.*", php-version: "7.3" } # Symfony 6 requires 8.0+ | |
- { symfony-version: "6.*", php-version: "7.4" } # Symfony 6 requires 8.0+ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# --no-update then a full `composer update` is needed to overcome locked dependencies | |
# See: https://github.com/composer/composer/issues/9561 | |
- name: "Remove existing requirements components (avoid conflicts)" | |
run: "composer remove --dev symfony/* laravel/* api-ecosystem-for-laravel/dingo-api --no-update --no-interaction" | |
- name: "Require Symfony ${{ matrix.symfony-version }}, Twig ${{ matrix.twig-version }}" | |
run: "composer require symfony/symfony:${{ matrix.symfony-version }} twig/twig:${{ matrix.twig-version }} symfony/orm-pack:^2.0 symfony/twig-pack:^1.0 --no-update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Composer update with new requirements" | |
run: "composer update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Run PHPUnit test suite" | |
run: "vendor/bin/phpunit --testsuite=symfony" | |
############################################################################### | |
################################### LARAVEL ################################### | |
############################################################################### | |
laravel-unit: | |
needs: base-unit | |
name: "Laravel Unit" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
extensions: ["scoutapm", ""] | |
laravel-version: | |
- "5.5.*" | |
- "6.*" | |
- "7.*" | |
- "8.*" | |
- "9.*" | |
- "10.*" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.3 | |
exclude: | |
# See - https://laravel.com/docs/9.x/releases#support-policy | |
# See - https://github.com/laravel/framework/issues/40339 | |
# Laravel 5.5 supports PHP 7.1 - 7.4 | |
- {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.1"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.2"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.3"} # Laravel 5.5.* does not support PHP 8.0+ | |
# Laravel 6 supports PHP 7.2 - 8.0 | |
- {laravel-version: "6.*", php-version: "8.1"} # Laravel 6 does not support PHP 8.1+ | |
- {laravel-version: "6.*", php-version: "8.2"} # Laravel 6 does not support PHP 8.1+ | |
- {laravel-version: "6.*", php-version: "8.3"} # Laravel 6 does not support PHP 8.1+ | |
# Laravel 7 supports PHP 7.2 - 8.0 | |
- {laravel-version: "7.*", php-version: "8.1"} # Laravel 7 does not support PHP 8.1+ | |
- {laravel-version: "7.*", php-version: "8.2"} # Laravel 7 does not support PHP 8.1+ | |
- {laravel-version: "7.*", php-version: "8.3"} # Laravel 7 does not support PHP 8.1+ | |
# Laravel 8 supports PHP 7.3 - 8.1 | |
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+ | |
- {laravel-version: "8.*", php-version: "8.2"} # Laravel 8 does not support PHP 8.2+ | |
- {laravel-version: "8.*", php-version: "8.3"} # Laravel 8 does not support PHP 8.2+ | |
# Laravel 9 supports PHP 8.0 - 8.2 | |
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+ | |
# Laravel 10 supports PHP 8.1 - 8.2 @todo tbc | |
- {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# --no-update then a full `composer update` is needed to overcome locked dependencies | |
# See: https://github.com/composer/composer/issues/9561 | |
- name: "Remove existing requirements components (avoid conflicts)" | |
run: "composer remove --dev symfony/* laravel/* api-ecosystem-for-laravel/dingo-api --no-update --no-interaction" | |
- name: "Require framework ${{ matrix.laravel-version}}" | |
run: "composer require laravel/framework:${{ matrix.laravel-version}} --no-update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Install spatie/laravel-ignition ^1.6 (if available)" | |
if: ${{ (matrix.php-version == '8.0' || matrix.php-version == '8.1') && (matrix.laravel-version == '8.*' || matrix.laravel-version == '9.*') }} | |
run: "composer require --dev spatie/laravel-ignition:^1.6 --no-update --no-interaction" | |
- name: "Install spatie/laravel-ignition ^2.0 (if available)" | |
if: ${{ (matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3') && (matrix.laravel-version == '10.*') }} | |
run: "composer require --dev spatie/laravel-ignition:^2.0 --no-update --no-interaction" | |
- name: "Unrestrict nesbot/carbon for older PHP versions" | |
if: ${{ (matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1') }} | |
run: "composer remove --dev --no-update --no-interaction nesbot/carbon" | |
- name: "Composer update with new requirements" | |
run: "composer update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Run PHPUnit (Laravel) test suite" | |
run: "vendor/bin/phpunit --testsuite=laravel" | |
laravel-e2e: | |
needs: [ check_secrets, laravel-unit ] | |
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true' | |
name: "Laravel E2E" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
extensions: ["scoutapm", ""] | |
laravel-version: | |
- "5.5.*" | |
- "6.*" | |
- "7.*" | |
- "8.*" | |
- "9.*" | |
- "10.*" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.3 | |
exclude: | |
# See - https://laravel.com/docs/9.x/releases#support-policy | |
# See - https://github.com/laravel/framework/issues/40339 | |
# Laravel 5.5 supports PHP 7.1 - 7.4 | |
- {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.1"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.2"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.3"} # Laravel 5.5.* does not support PHP 8.0+ | |
# Laravel 6 supports PHP 7.2 - 8.0 | |
- {laravel-version: "6.*", php-version: "8.1"} # Laravel 6 does not support PHP 8.1+ | |
- {laravel-version: "6.*", php-version: "8.2"} # Laravel 6 does not support PHP 8.1+ | |
- {laravel-version: "6.*", php-version: "8.3"} # Laravel 6 does not support PHP 8.1+ | |
# Laravel 7 supports PHP 7.2 - 8.0 | |
- {laravel-version: "7.*", php-version: "8.1"} # Laravel 7 does not support PHP 8.1+ | |
- {laravel-version: "7.*", php-version: "8.2"} # Laravel 7 does not support PHP 8.1+ | |
- {laravel-version: "7.*", php-version: "8.3"} # Laravel 7 does not support PHP 8.1+ | |
# Laravel 8 supports PHP 7.3 - 8.1 | |
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+ | |
- {laravel-version: "8.*", php-version: "8.2"} # Laravel 8 does not support PHP 8.2+ | |
- {laravel-version: "8.*", php-version: "8.3"} # Laravel 8 does not support PHP 8.2+ | |
# Laravel 9 supports PHP 8.0 - 8.2 | |
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+ | |
# Laravel 10 supports PHP 8.1 - 8.2 @todo tbc | |
- {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+ | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: scout-apm-php | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Composer allow-plugins to allow Laravel to actually install" | |
run: composer config --global allow-plugins true | |
- name: "Install Laravel quickstart project" | |
run: "composer create-project laravel/laravel:${{ matrix.laravel-version}} test-app --prefer-dist" | |
- name: "Add scout-apm-php as a repository" | |
run: cd test-app && composer config repositories.scout path ../scout-apm-php | |
- name: "Allow Composer plugins to run for this project" | |
run: cd test-app && composer config --no-plugins allow-plugins true | |
- name: "Require scout-apm-php current checkout" | |
run: cd test-app && composer require scoutapp/scout-apm-php:*@dev guzzlehttp/guzzle composer/package-versions-deprecated | |
- name: "Publish the provider" | |
run: cd test-app && php artisan vendor:publish --provider="Scoutapm\Laravel\Providers\ScoutApmServiceProvider" | |
- name: "Configure error handler (Laravel 5-6)" | |
if: matrix.laravel-version == '5.5.*' || matrix.laravel-version == '6.*' | |
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel5-6-exception-handler.php app/Exceptions/Handler.php | |
- name: "Configure error handler (Laravel 7)" | |
if: matrix.laravel-version == '7.*' | |
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel7-exception-handler.php app/Exceptions/Handler.php | |
- name: "Configure error handler (Laravel 8)" | |
if: matrix.laravel-version == '8.*' | |
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel8-exception-handler.php app/Exceptions/Handler.php | |
- name: "Configure error handler (Laravel 9)" | |
if: matrix.laravel-version == '9.*' || matrix.laravel-version == '10.*' | |
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel9-exception-handler.php app/Exceptions/Handler.php | |
- name: "Add route to trigger error" | |
run: cd test-app && echo -e "Route::get('/e', function () { throw new \RuntimeException('fail'); });" >> routes/web.php | |
- name: "Configure Scout" | |
run: cd test-app && echo -e "\nSCOUT_KEY=\"\${SCOUT_APM_KEY}\"\nSCOUT_NAME=\"My Laravel App\"\nSCOUT_MONITOR=true\nSCOUT_LOG_LEVEL=\"debug\"\nSCOUT_ERRORS_ENABLED=true\nSCOUT_LOG_PAYLOAD_CONTENT=true" >> .env | |
- name: "Load the index page to trigger instrumentation" | |
run: | | |
cd test-app | |
cat .env | |
php artisan serve & | |
# Give Laravel a chance to start... | |
sleep 2 | |
# Very occasionally in GH Actions, core-agent didn't quite start in time - so load the page twice | |
wget -O /dev/null http://localhost:8000 | |
sleep 1 | |
# Regular page load instrumentation | |
wget --content-on-error -O index.html http://localhost:8000 | |
cat index.html | |
# Error capture | |
wget --content-on-error -O error.html http://localhost:8000/e || true | |
cat error.html | |
ps -ax | |
- name: "Output logs on failure" | |
if: failure() | |
run: cat test-app/storage/logs/laravel.log | |
- name: "Check logs for successful payload send" | |
run: | | |
cd test-app | |
cat storage/logs/laravel.log | |
echo "Checking for APM instrumentation" | |
grep -q "local.DEBUG: \[Scout\] Sent whole payload successfully to core agent." storage/logs/laravel.log | |
echo "Checking for Error Reporting" | |
grep -q "local.DEBUG: \[Scout\] Sent 1 error event to Scout Error Reporting" storage/logs/laravel.log | |
artisan-test: | |
needs: [ check_secrets, laravel-unit ] | |
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true' | |
name: "Artisan Test" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
extensions: ["scoutapm", ""] | |
laravel-version: | |
- "5.5.*" | |
- "6.*" | |
- "7.*" | |
- "8.*" | |
- "9.*" | |
- "10.*" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2 | |
exclude: | |
# See - https://laravel.com/docs/9.x/releases#support-policy | |
# See - https://github.com/laravel/framework/issues/40339 | |
# Laravel 5.5 supports PHP 7.1 - 7.4 | |
- {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.1"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.2"} # Laravel 5.5.* does not support PHP 8.0+ | |
- {laravel-version: "5.5.*", php-version: "8.3"} # Laravel 5.5.* does not support PHP 8.0+ | |
# Laravel 6 supports PHP 7.2 - 8.0 | |
- {laravel-version: "6.*", php-version: "8.1"} # Laravel 6 does not support PHP 8.1+ | |
- {laravel-version: "6.*", php-version: "8.2"} # Laravel 6 does not support PHP 8.1+ | |
- {laravel-version: "6.*", php-version: "8.3"} # Laravel 6 does not support PHP 8.1+ | |
# Laravel 7 supports PHP 7.2 - 8.0 | |
- {laravel-version: "7.*", php-version: "8.1"} # Laravel 7 does not support PHP 8.1+ | |
- {laravel-version: "7.*", php-version: "8.2"} # Laravel 7 does not support PHP 8.1+ | |
- {laravel-version: "7.*", php-version: "8.3"} # Laravel 7 does not support PHP 8.1+ | |
# Laravel 8 supports PHP 7.3 - 8.1 | |
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+ | |
- {laravel-version: "8.*", php-version: "8.2"} # Laravel 8 does not support PHP 8.2+ | |
- {laravel-version: "8.*", php-version: "8.3"} # Laravel 8 does not support PHP 8.2+ | |
# Laravel 9 supports PHP 8.0 - 8.2 | |
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+ | |
- {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+ | |
# Laravel 10 supports PHP 8.1 - 8.2 @todo tbc | |
- {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+ | |
- {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+ | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: scout-apm-php | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Composer allow-plugins to allow Laravel to actually install" | |
run: composer config --global allow-plugins true | |
- name: "Install Laravel quickstart project" | |
run: "composer create-project laravel/laravel:${{ matrix.laravel-version}} test-app --prefer-dist" | |
- name: "Add scout-apm-php as a repository" | |
run: cd test-app && composer config repositories.scout path ../scout-apm-php | |
- name: "Allow Composer plugins to run for this project" | |
run: cd test-app && composer config --no-plugins allow-plugins true | |
- name: "Require scout-apm-php current checkout" | |
run: cd test-app && composer require scoutapp/scout-apm-php:*@dev guzzlehttp/guzzle composer/package-versions-deprecated | |
- name: "Publish the provider" | |
run: cd test-app && php artisan vendor:publish --provider="Scoutapm\Laravel\Providers\ScoutApmServiceProvider" | |
- name: "Configure Scout" | |
run: cd test-app && echo -e "\nSCOUT_KEY=\"\${SCOUT_APM_KEY}\"\nSCOUT_NAME=\"My Laravel App\"\nSCOUT_MONITOR=true\nSCOUT_LOG_LEVEL=\"debug\"\nSCOUT_ERRORS_ENABLED=true" >> .env | |
- name: "Run core agent" | |
run: | | |
cd test-app | |
cat .env | |
php artisan scoutapm:core-agent --download --launch | |
- name: "Check core agent is running" | |
run: | | |
sleep 2 | |
ps ax | grep core-agent | |
pgrep core-agent | |
############################################################################### | |
#################################### LUMEN #################################### | |
############################################################################### | |
lumen-unit: | |
needs: base-unit | |
name: "Lumen Unit" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
extensions: ["scoutapm", ""] | |
lumen-version: | |
- "5.5.*" | |
- "6.*" | |
- "7.*" | |
- "8.*" | |
- "9.*" | |
- "10.*" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2 | |
exclude: | |
# Lumen 5.5 supports PHP 7.1 - 7.3 | |
- {lumen-version: "5.5.*", php-version: "7.4"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.0"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.1"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.2"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.3"} # Lumen 5.5 does not support PHP 7.4+ | |
# Lumen 6 supports PHP 7.2 - 7.4 | |
- {lumen-version: "6.*", php-version: "8.0"} # Lumen 6 does not support PHP 8.0+ | |
- {lumen-version: "6.*", php-version: "8.1"} # Lumen 6 does not support PHP 8.0+ | |
- {lumen-version: "6.*", php-version: "8.2"} # Lumen 6 does not support PHP 8.0+ | |
- {lumen-version: "6.*", php-version: "8.3"} # Lumen 6 does not support PHP 8.0+ | |
# Lumen 7 supports PHP 7.2 - 7.4 | |
- {lumen-version: "7.*", php-version: "8.0"} # Lumen 7 does not support PHP 8.0+ | |
- {lumen-version: "7.*", php-version: "8.1"} # Lumen 7 does not support PHP 8.0+ | |
- {lumen-version: "7.*", php-version: "8.2"} # Lumen 7 does not support PHP 8.0+ | |
- {lumen-version: "7.*", php-version: "8.3"} # Lumen 7 does not support PHP 8.0+ | |
# Lumen 8 supports PHP 7.3 - 8.1 | |
- {lumen-version: "8.*", php-version: "7.2"} # Lumen 8 requires 7.3+ | |
- {lumen-version: "8.*", php-version: "8.2"} # Lumen 8 does not support PHP 8.2+ | |
- {lumen-version: "8.*", php-version: "8.3"} # Lumen 8 does not support PHP 8.2+ | |
# Lumen 9 supports PHP 8.0 - 8.2 | |
- {lumen-version: "9.*", php-version: "7.2"} # Lumen 9 requires 8.0+ | |
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+ | |
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+ | |
- {lumen-version: "9.*", php-version: "8.3"} # Lumen 9 does not support PHP 8.3+ | |
# Lumen 10 supports PHP 8.1 - 8.2 @todo tbc | |
- {lumen-version: "10.*", php-version: "7.2"} # Lumen 10 requires 8.1+ | |
- {lumen-version: "10.*", php-version: "7.3"} # Lumen 10 requires 8.1+ | |
- {lumen-version: "10.*", php-version: "7.4"} # Lumen 10 requires 8.1+ | |
- {lumen-version: "10.*", php-version: "8.0"} # Lumen 10 requires 8.1+ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# --no-update then a full `composer update` is needed to overcome locked dependencies | |
# See: https://github.com/composer/composer/issues/9561 | |
- name: "Remove existing requirements components (avoid conflicts)" | |
run: "composer remove --dev symfony/* laravel/* api-ecosystem-for-laravel/dingo-api --no-update --no-interaction" | |
- name: "Require framework ${{ matrix.lumen-version}}" | |
run: "composer require laravel/lumen:${{ matrix.lumen-version}} --no-update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Unrestrict nesbot/carbon for older PHP versions" | |
if: ${{ (matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1') }} | |
run: "composer remove --dev --no-update --no-interaction nesbot/carbon" | |
- name: "Composer update with new requirements" | |
run: "composer update --no-interaction --prefer-dist --prefer-stable" | |
- name: "Run PHPUnit (Lumen) test suite" | |
run: "vendor/bin/phpunit --testsuite=laravel" # Test suite is same as Laravel | |
lumen-e2e: | |
needs: [ check_secrets, lumen-unit ] | |
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true' | |
name: "Lumen E2E" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
extensions: ["scoutapm", ""] | |
lumen-version: | |
- "5.5.*" | |
- "6.*" | |
- "7.*" | |
- "8.*" | |
- "9.*" | |
- "10.*" | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2 | |
exclude: | |
# Lumen 5.5 supports PHP 7.1 - 7.3 | |
- {lumen-version: "5.5.*", php-version: "7.4"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.0"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.1"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.2"} # Lumen 5.5 does not support PHP 7.4+ | |
- {lumen-version: "5.5.*", php-version: "8.3"} # Lumen 5.5 does not support PHP 7.4+ | |
# Lumen 6 supports PHP 7.2 - 7.4 | |
- {lumen-version: "6.*", php-version: "8.0"} # Lumen 6 does not support PHP 8.0+ | |
- {lumen-version: "6.*", php-version: "8.1"} # Lumen 6 does not support PHP 8.0+ | |
- {lumen-version: "6.*", php-version: "8.2"} # Lumen 6 does not support PHP 8.0+ | |
- {lumen-version: "6.*", php-version: "8.3"} # Lumen 6 does not support PHP 8.0+ | |
# Lumen 7 supports PHP 7.2 - 7.4 | |
- {lumen-version: "7.*", php-version: "8.0"} # Lumen 7 does not support PHP 8.0+ | |
- {lumen-version: "7.*", php-version: "8.1"} # Lumen 7 does not support PHP 8.0+ | |
- {lumen-version: "7.*", php-version: "8.2"} # Lumen 7 does not support PHP 8.0+ | |
- {lumen-version: "7.*", php-version: "8.3"} # Lumen 7 does not support PHP 8.0+ | |
# Lumen 8 supports PHP 7.3 - 8.1 | |
- {lumen-version: "8.*", php-version: "7.2"} # Lumen 8 requires 7.3+ | |
- {lumen-version: "8.*", php-version: "8.2"} # Lumen 8 does not support PHP 8.2+ | |
- {lumen-version: "8.*", php-version: "8.3"} # Lumen 8 does not support PHP 8.2+ | |
# Lumen 9 supports PHP 8.0 - 8.2 | |
- {lumen-version: "9.*", php-version: "7.2"} # Lumen 9 requires 8.0+ | |
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+ | |
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+ | |
- {lumen-version: "9.*", php-version: "8.3"} # Lumen 9 does not support PHP 8.3+ | |
# Lumen 10 supports PHP 8.1 - 8.2 @todo tbc | |
- {lumen-version: "10.*", php-version: "7.2"} # Lumen 10 requires 8.1+ | |
- {lumen-version: "10.*", php-version: "7.3"} # Lumen 10 requires 8.1+ | |
- {lumen-version: "10.*", php-version: "7.4"} # Lumen 10 requires 8.1+ | |
- {lumen-version: "10.*", php-version: "8.0"} # Lumen 10 requires 8.1+ | |
env: | |
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }} | |
steps: | |
- name: "Skip if SCOUT_APM_KEY secret is not available" | |
run: echo 'This job is skipped entirely as it needs SCOUT_APM_KEY set in secrets.' | |
- uses: actions/checkout@v3 | |
with: | |
path: scout-apm-php | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl, composer:v2.3 | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Composer allow-plugins to allow Laravel to actually install" | |
run: composer config --global allow-plugins true | |
- name: "Install Lumen quickstart project" | |
run: "composer create-project laravel/lumen:${{ matrix.lumen-version}} test-app --prefer-dist" | |
- name: "Add scout-apm-php as a repository" | |
run: cd test-app && composer config repositories.scout path ../scout-apm-php | |
- name: "Require scout-apm-php current checkout" | |
run: cd test-app && composer require scoutapp/scout-apm-php:*@dev guzzlehttp/guzzle composer/package-versions-deprecated | |
- name: "Configure the application" | |
run: cd test-app && cp ../scout-apm-php/.github/fixtures/lumen-app.php bootstrap/app.php | |
- name: "Configure Scout" | |
run: cd test-app && echo -e "\nSCOUT_KEY=\"\${SCOUT_APM_KEY}\"\nSCOUT_NAME=\"My Lumen App\"\nSCOUT_MONITOR=true\nSCOUT_LOG_LEVEL=\"debug\"\nSCOUT_LOG_PAYLOAD_CONTENT=true" >> .env | |
- name: "Load the index page to trigger instrumentation" | |
run: | | |
cd test-app | |
cat .env | |
LOG_CHANNEL=single php -S localhost:8000 -t public/ & | |
# Give Lumen a chance to start... | |
sleep 2 | |
# Very occasionally in GH Actions, core-agent didn't quite start in time - so load the page twice | |
wget -O /dev/null http://localhost:8000 | |
sleep 1 | |
wget http://localhost:8000 | |
cat index.html | |
ps -ax | |
- name: "Output logs on failure" | |
if: failure() | |
run: cat test-app/storage/logs/lumen.log | |
- name: "Check logs for successful payload send" | |
run: | | |
cd test-app | |
ls -l storage/logs/ | |
cat storage/logs/lumen.log | |
grep -q "DEBUG: \[Scout\] Sent whole payload successfully to core agent." storage/logs/lumen.log |