From 0048296602a2a6c29415dfedc157184ce4158987 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Fri, 19 Nov 2021 09:53:29 -0500 Subject: [PATCH 01/21] feat: add test matrix shell This is the basic operation: stand up the framework, configure Rollbar within that framework, then invoke a log message. Rig Rollbar so that logged messages get written to a file, that we then check exists and contains the desired value. Later iterations will add the specifics for each framework-version, which may require multiple action files: the setup varies slightly between framework and framework-version. --- .github/workflows/ci.yml | 103 ++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4affb99..c4da356 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ name: Rollbar-PHP-Laravel CI # Fire this action on pushes to main branch (master) as well as other branches # or pull requests. Also, run every day at 02:42 GMT -- this catches failures -# from dependencies that update indepdently. +# from dependencies that update independently. on: push: pull_request: @@ -17,21 +17,17 @@ on: - cron: '42 2 * * *' jobs: - # Check that this runs on PHP on all versions we claim to support, on both - # UNIX-like and Windows environments, and that use both the lowest possible - # compatible version as well as the most-recent stable version. This will - # fail-fast by default, so we include our edgiest versions (currently 7.4) - # first as they're most likely to fail. - # @seealso https://freek.dev/1546 - # @seealso https://www.dereuromark.de/2019/01/04/test-composer-dependencies-with-prefer-lowest/ - php-tests: + # Check that this runs on all combinations of Laravel we claim to support. + laravel-tests: strategy: matrix: - php: [7.3, 7.2] - dependency: [stable] os: [ubuntu] - - name: PHP ${{ matrix.php }} on ${{ matrix.os }}, ${{ matrix.dependency }} dependencies preferred + php: [7.4] + laravel: [^7.0] + rollbar-php-laravel: [^7.0] + env: + ROLLBAR_TOKEN: ad865e76e7fb496fab096ac07b1dbabb + name: Laravel ${{ matrix.laravel }} PHP ${{ matrix.php }} ${{ matrix.os }} Rollbar ${{ matrix.rollbar-php }} runs-on: ${{ matrix.os }}-latest steps: - name: Checkout the code @@ -42,29 +38,70 @@ jobs: with: php-version: ${{ matrix.php }} extensions: curl - ini-values: ${{ matrix.ini }} - coverage: xdebug - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Create Laravel test app + run: composer create-project laravel/laravel rollbar-test-app - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency }}- - restore-keys: ${{ matrix.os }}-composer-${{ matrix.dependency }}- + - name: Install rollbar-php-laravel package + working-directory: rollbar-test-app + run: | + echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env + echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env + chmod 400 .env - - name: Install dependencies - run: composer update --prefer-${{ matrix.dependency }} --prefer-dist --no-interaction + - name: Configure Laravel to use Rollbar and configure Rollbar to invoke logging callback + working-directory: rollbar-test-app + run: | + > config/logging.php echo ' "rollbar", + "channels" => array ( + "rollbar" => array ( + "driver" => "monolog", + "handler" => \Rollbar\Laravel\MonologHandler::class, + "access_token" => env("ROLLBAR_TOKEN"), + "level" => "debug", + "check_ignore" => "check_ignore", + ) + ) + ); + ' + touch app/helpers.php + > tmp-composer.json jq '.autoload += { "files": [ "app/helpers.php" ] }' composer.json + mv tmp-composer.json composer.json + composer dump-autoload - - name: Make logs directory - run: mkdir -p build/logs + - name: Define logging callback that invokes when Laravel logs through Rollbar + working-directory: rollbar-test-app + run: | + > app/helpers.php echo ' tests/Feature/LoggingTest.php echo 'assertFileExists(temp_file(), + "Rollbar check_ignore handler not invoked, suggesting an issue integrating Rollbar into Laravel."); + $this->assertSame($value, file_get_contents(temp_file()), + "check_ignore file did not contain expected value, suggesting file left by another process."); + } + } + ' - - name: Report results - if: success() - run: ./vendor/bin/php-coveralls -v || true + - name: Invoke the Laravel test suite + working-directory: rollbar-test-app + run: | + ./vendor/bin/phpunit From fe9c9157204afb54a02a12bcda6b76cc0bacae77 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Sat, 20 Nov 2021 11:52:16 -0500 Subject: [PATCH 02/21] doc: better describe what's being tested --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4da356..53c3708 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,9 @@ # Primary CI checks for Rollbar-PHP-Laravel. +# We're checking that logging within Laravel passes through the Rollbar Laravel +# integration when that integration is properly installed. We make this check +# for all supported combinations of Laravel, Rollbar, and PHP. We are not +# checking that messages are properly sent to Rollbar: that's handled by +# rollbar-php. # # Test with act: # brew install act From cdc039f4be09638d3493584acd504820701943d1 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Sat, 20 Nov 2021 11:52:52 -0500 Subject: [PATCH 03/21] fix: remove API token from code Never store secrets. Also, by pushing the secret definition into the runner, we have more flexibility for choosing their value based on branch conditions (eg, for testing certain behaviors of various tokens). --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53c3708..6df5207 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: laravel: [^7.0] rollbar-php-laravel: [^7.0] env: - ROLLBAR_TOKEN: ad865e76e7fb496fab096ac07b1dbabb + ROLLBAR_TOKEN: 00000000000000000000000000000000 name: Laravel ${{ matrix.laravel }} PHP ${{ matrix.php }} ${{ matrix.os }} Rollbar ${{ matrix.rollbar-php }} runs-on: ${{ matrix.os }}-latest steps: From ef5442f9f3f1f061f01e7613722f5b1d893251fb Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Sat, 20 Nov 2021 11:54:01 -0500 Subject: [PATCH 04/21] feat: make tests green on known good combination --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6df5207..77c2b99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,7 @@ jobs: - name: Install rollbar-php-laravel package working-directory: rollbar-test-app run: | + composer require rollbar/rollbar-laravel echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env chmod 400 .env @@ -65,6 +66,7 @@ jobs: "handler" => \Rollbar\Laravel\MonologHandler::class, "access_token" => env("ROLLBAR_TOKEN"), "level" => "debug", + // use the check_ignore filter to capture log messages for verification "check_ignore" => "check_ignore", ) ) @@ -83,8 +85,10 @@ jobs: return env("RUNNER_TEMP") . DIRECTORY_SEPARATOR . env("GITHUB_RUN_ID") . ".tmp.txt"; } function check_ignore($isUncaught, $toLog, $payload) { + // write log message to a file for inspection file_put_contents(temp_file(), (string)$toLog); - return false; + // return indication that the log should be dropped + return true; } ' @@ -96,8 +100,13 @@ jobs: class LoggingTest extends \Tests\TestCase { public function test_log_call_invokes_rollbar_check_ignore() { - $value = env("GITHUB_RUN_ID"); + // generate a random valued log message to check it is passed through the + // Laravel logging mechanism into Rollbar + $value = sprintf("%s-%s", env("GITHUB_RUN_ID"), rand()); + \Log::error($value); + + // check that we have our random value written into our local file $this->assertFileExists(temp_file(), "Rollbar check_ignore handler not invoked, suggesting an issue integrating Rollbar into Laravel."); $this->assertSame($value, file_get_contents(temp_file()), From 7f81181e41e43263b31c1c66fa9ab2ccc609e3c6 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Mon, 22 Nov 2021 22:26:45 -0500 Subject: [PATCH 05/21] feat: add combinations --- .github/workflows/ci.yml | 58 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77c2b99..cee858f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,12 +27,60 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4] - laravel: [^7.0] - rollbar-php-laravel: [^7.0] + php: [7.4, 7.3, 7.2, 7.1, 7.0] + laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6, ^5.5] + rollbar-php-laravel: [^7, ^4, ^2] + exclude: + # Laravel 8 requires php 7.3+, so exclude all PHP versions prior to 7.3 + - laravel: ^8 + php: 7.2 + - laravel: ^8 + php: 7.1 + - laravel: ^8 + php: 7.0 + # Laravel 7 and 6 requires php 7.2+, so exclude all PHP versions prior to 7.2 + - laravel: ^7 + php: 7.1 + - laravel: ^7 + php: 7.0 + - laravel: ^6 + php: 7.1 + - laravel: ^6 + php: 7.0 + # Laravel 6+ use rollbar-php-laravel latest, so exclude all below 7 + - laravel: ^6 + rollbar-php-laravel: ^4 + - laravel: ^6 + rollbar-php-laravel: ^2 + - laravel: ^7 + rollbar-php-laravel: ^4 + - laravel: ^7 + rollbar-php-laravel: ^2 + - laravel: ^8 + rollbar-php-laravel: ^4 + - laravel: ^8 + rollbar-php-laravel: ^2 + # Laravel 5.6 to 5.8 use rollbar-php-laravel 4.x, so exclude all above that and below that + - laravel: ^5.6 + rollbar-php-laravel: ^7 + - laravel: ^5.6 + rollbar-php-laravel: ^2 + - laravel: ^5.7 + rollbar-php-laravel: ^7 + - laravel: ^5.7 + rollbar-php-laravel: ^2 + - laravel: ^5.8 + rollbar-php-laravel: ^7 + - laravel: ^5.8 + rollbar-php-laravel: ^2 + # Laravel 5.5 and below use rollbar-php-laravel 2.x, so exclude all above that + - laravel: ^5.5 + rollbar-php-laravel: ^7 + - laravel: ^5.5 + rollbar-php-laravel: ^4 env: ROLLBAR_TOKEN: 00000000000000000000000000000000 - name: Laravel ${{ matrix.laravel }} PHP ${{ matrix.php }} ${{ matrix.os }} Rollbar ${{ matrix.rollbar-php }} + name: ${{ matrix.laravel }}/${{ matrix.rollbar-php-laravel }}/${{ matrix.php }}(${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: - name: Checkout the code @@ -50,7 +98,7 @@ jobs: - name: Install rollbar-php-laravel package working-directory: rollbar-test-app run: | - composer require rollbar/rollbar-laravel + composer require rollbar/rollbar-laravel:${{ matrix.rollbar-php-laravel }} echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env chmod 400 .env From ed82fa2007aa69296b656980fa08a07b4a14a594 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Mon, 22 Nov 2021 23:06:08 -0500 Subject: [PATCH 06/21] feat: use documented version constraint The [docs][1] call for `4.*` and `2.*`, so we'll use those to align with the exact documentation. [1]:https://docs.rollbar.com/docs/laravel --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cee858f..666fc32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: os: [ubuntu] php: [7.4, 7.3, 7.2, 7.1, 7.0] laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6, ^5.5] - rollbar-php-laravel: [^7, ^4, ^2] + rollbar-php-laravel: [^7, 4.*, 2.*] exclude: # Laravel 8 requires php 7.3+, so exclude all PHP versions prior to 7.3 - laravel: ^8 @@ -49,35 +49,35 @@ jobs: php: 7.0 # Laravel 6+ use rollbar-php-laravel latest, so exclude all below 7 - laravel: ^6 - rollbar-php-laravel: ^4 + rollbar-php-laravel: 4.* - laravel: ^6 - rollbar-php-laravel: ^2 + rollbar-php-laravel: 2.* - laravel: ^7 - rollbar-php-laravel: ^4 + rollbar-php-laravel: 4.* - laravel: ^7 - rollbar-php-laravel: ^2 + rollbar-php-laravel: 2.* - laravel: ^8 - rollbar-php-laravel: ^4 + rollbar-php-laravel: 4.* - laravel: ^8 - rollbar-php-laravel: ^2 + rollbar-php-laravel: 2.* # Laravel 5.6 to 5.8 use rollbar-php-laravel 4.x, so exclude all above that and below that - laravel: ^5.6 rollbar-php-laravel: ^7 - laravel: ^5.6 - rollbar-php-laravel: ^2 + rollbar-php-laravel: 2.* - laravel: ^5.7 rollbar-php-laravel: ^7 - laravel: ^5.7 - rollbar-php-laravel: ^2 + rollbar-php-laravel: 2.* - laravel: ^5.8 rollbar-php-laravel: ^7 - laravel: ^5.8 - rollbar-php-laravel: ^2 + rollbar-php-laravel: 2.* # Laravel 5.5 and below use rollbar-php-laravel 2.x, so exclude all above that - laravel: ^5.5 rollbar-php-laravel: ^7 - laravel: ^5.5 - rollbar-php-laravel: ^4 + rollbar-php-laravel: 4.* env: ROLLBAR_TOKEN: 00000000000000000000000000000000 name: ${{ matrix.laravel }}/${{ matrix.rollbar-php-laravel }}/${{ matrix.php }}(${{ matrix.os }}) @@ -98,7 +98,7 @@ jobs: - name: Install rollbar-php-laravel package working-directory: rollbar-test-app run: | - composer require rollbar/rollbar-laravel:${{ matrix.rollbar-php-laravel }} + composer require rollbar/rollbar-laravel ${{ matrix.rollbar-php-laravel }} echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env chmod 400 .env From 07e8499eb2215f19f296bbbc1ca46272cabb88b3 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Mon, 6 Dec 2021 21:33:19 -0500 Subject: [PATCH 07/21] refac: shrink working set to known good Now we'll add them in one at a time, excluding or fixing the bad combo. --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 666fc32..2c0da8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,9 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4, 7.3, 7.2, 7.1, 7.0] - laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6, ^5.5] - rollbar-php-laravel: [^7, 4.*, 2.*] + php: [7.4] + laravel: [^8] + rollbar-php-laravel: [^7] exclude: # Laravel 8 requires php 7.3+, so exclude all PHP versions prior to 7.3 - laravel: ^8 @@ -47,6 +47,13 @@ jobs: php: 7.1 - laravel: ^6 php: 7.0 + # Laravel 5.8, 5.7, and 5.6 requires php 7.1.3+, so exclude all PHP versions prior to 7.1.3 for them + - laravel: ^5.8 + php: 7.0 + - laravel: ^5.7 + php: 7.0 + - laravel: ^5.6 + php: 7.0 # Laravel 6+ use rollbar-php-laravel latest, so exclude all below 7 - laravel: ^6 rollbar-php-laravel: 4.* From 7353ba5ab7f7fe140d019fcc80d7541bcfb92799 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Mon, 6 Dec 2021 22:42:40 -0500 Subject: [PATCH 08/21] feat: add test matrix Covers Laravel 5.6 through 8, on the appropriate PHP versions from the 7.x series. Comments out a known failing combination of Laravel 5.5 and doesn't include the unlikely to work PHP 8 support. --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c0da8a..dfbcfd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,12 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4] - laravel: [^8] - rollbar-php-laravel: [^7] + php: [7.4, 7.3, 7.2, 7.1] + laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] + rollbar-php-laravel: [^7, 4.*] + #fails#php: [7.0] + #fails#laravel: [^5.5] + #fails#rollbar-php-laravel: [2.*] exclude: # Laravel 8 requires php 7.3+, so exclude all PHP versions prior to 7.3 - laravel: ^8 From c5088195c505aa82693b0852b00d931781b74172 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Mon, 6 Dec 2021 22:53:31 -0500 Subject: [PATCH 09/21] refac: simplify to one test Hunting down why failing on GitHub action but not local `act`. --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfbcfd1..4515778 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,12 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4, 7.3, 7.2, 7.1] - laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] - rollbar-php-laravel: [^7, 4.*] + php: [7.4] + laravel: [^8] + rollbar-php-laravel: [^7] + #simplify#php: [7.4, 7.3, 7.2, 7.1] + #simplify#laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] + #simplify#rollbar-php-laravel: [^7, 4.*] #fails#php: [7.0] #fails#laravel: [^5.5] #fails#rollbar-php-laravel: [2.*] From 4fe38fd67c59c58585cb1d3a368d00ffb3b7b6b0 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Mon, 6 Dec 2021 22:59:25 -0500 Subject: [PATCH 10/21] refac: add temp file diagnostic --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4515778..736c5d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,7 +143,9 @@ jobs: run: | > app/helpers.php echo ' Date: Mon, 6 Dec 2021 23:01:48 -0500 Subject: [PATCH 11/21] refac: add further diagnostic lines --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 736c5d2..2562223 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,7 +149,8 @@ jobs: } function check_ignore($isUncaught, $toLog, $payload) { // write log message to a file for inspection - file_put_contents(temp_file(), (string)$toLog); + $ok = file_put_contents(temp_file(), (string)$toLog); + var_dump($ok); // return indication that the log should be dropped return true; } @@ -167,7 +168,9 @@ jobs: // Laravel logging mechanism into Rollbar $value = sprintf("%s-%s", env("GITHUB_RUN_ID"), rand()); + var_dump("x"); \Log::error($value); + var_dump("y"); // check that we have our random value written into our local file $this->assertFileExists(temp_file(), From f89d216e1c21b1537f5530aeb90b1889d1ac6170 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 8 Dec 2021 09:48:44 -0500 Subject: [PATCH 12/21] fix: use current rollbar token The runner is removing leading zeroes, setting the value to '0'. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2562223..8666926 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: - laravel: ^5.5 rollbar-php-laravel: 4.* env: - ROLLBAR_TOKEN: 00000000000000000000000000000000 + ROLLBAR_TOKEN: "ad865e76e7fb496fab096ac07b1dbabb" name: ${{ matrix.laravel }}/${{ matrix.rollbar-php-laravel }}/${{ matrix.php }}(${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: From d9cc7ffe471b5453b9ca686b7a219e3f7537cb72 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 8 Dec 2021 21:55:20 -0500 Subject: [PATCH 13/21] feat: activate all known good combo --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8666926..15062c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,12 +27,9 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4] - laravel: [^8] - rollbar-php-laravel: [^7] - #simplify#php: [7.4, 7.3, 7.2, 7.1] - #simplify#laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] - #simplify#rollbar-php-laravel: [^7, 4.*] + php: [7.4, 7.3, 7.2, 7.1] + laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] + rollbar-php-laravel: [^7, 4.*] #fails#php: [7.0] #fails#laravel: [^5.5] #fails#rollbar-php-laravel: [2.*] From 448962dc7512d4f88e693e77cd9684b2b6324e29 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 8 Dec 2021 22:09:24 -0500 Subject: [PATCH 14/21] feat: specific software for version in job name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15062c1..f77e045 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: rollbar-php-laravel: 4.* env: ROLLBAR_TOKEN: "ad865e76e7fb496fab096ac07b1dbabb" - name: ${{ matrix.laravel }}/${{ matrix.rollbar-php-laravel }}/${{ matrix.php }}(${{ matrix.os }}) + name: Laravel ${{ matrix.laravel }}/Rollbar ${{ matrix.rollbar-php-laravel }}/PHP ${{ matrix.php }}(${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: - name: Checkout the code From cd89dd591f830fd4e055347f683e4224570324e2 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 8 Dec 2021 22:10:19 -0500 Subject: [PATCH 15/21] feat: install specific Laravel version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f77e045..f68f7dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: extensions: curl - name: Create Laravel test app - run: composer create-project laravel/laravel rollbar-test-app + run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} - name: Install rollbar-php-laravel package working-directory: rollbar-test-app From 7e2779d0762914caaa782c188fec93681ac8c3b2 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 8 Dec 2021 22:12:53 -0500 Subject: [PATCH 16/21] feat: add early version This failed locally, but it may have been a false negative. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f68f7dc..d8823aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,9 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4, 7.3, 7.2, 7.1] - laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] - rollbar-php-laravel: [^7, 4.*] + php: [7.4, 7.3, 7.2, 7.1, 7.0] + laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6, ^5.5] + rollbar-php-laravel: [^7, 4.*, 2.*] #fails#php: [7.0] #fails#laravel: [^5.5] #fails#rollbar-php-laravel: [2.*] From 3c1b78d963e28c57cab905563b7f6de7878cf355 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 8 Dec 2021 22:15:16 -0500 Subject: [PATCH 17/21] refac: remove broken version and debugs --- .github/workflows/ci.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8823aa..51b4f8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,9 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4, 7.3, 7.2, 7.1, 7.0] - laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6, ^5.5] - rollbar-php-laravel: [^7, 4.*, 2.*] + php: [7.4, 7.3, 7.2, 7.1] + laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] + rollbar-php-laravel: [^7, 4.*] #fails#php: [7.0] #fails#laravel: [^5.5] #fails#rollbar-php-laravel: [2.*] @@ -140,14 +140,11 @@ jobs: run: | > app/helpers.php echo 'assertFileExists(temp_file(), From cf5d03da08917949d797229aa5b59eb65ac8262f Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Thu, 9 Dec 2021 09:01:19 -0500 Subject: [PATCH 18/21] doc: note the intent of the checkout step --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51b4f8b..e5c9d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,6 +93,11 @@ jobs: name: Laravel ${{ matrix.laravel }}/Rollbar ${{ matrix.rollbar-php-laravel }}/PHP ${{ matrix.php }}(${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: + # Note: this step is currently unused, because we are installing Rollbar + # Note: from Packagist 3 steps later. This was done to prove out currently + # Note: working combinations from published versions. The next iteration + # Note: will move the CI to use the correct branch, so that pre-published + # Note: code will be tested. - name: Checkout the code uses: actions/checkout@v2 From c7a1516f401f970095d3aab4ae3e86b99643945e Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 15 Dec 2021 09:54:44 -0500 Subject: [PATCH 19/21] refac: break out into lineage branches Now that we've proved out the support (from prior runs where the matrix encompassed all supported versions and was hitting released tags) and we have a baseline of known support, we can break out the code into lineage branches. In this regime (which matches rollbar-php operation), commits to the lineage branch are checked against the documented support for that lineage. --- .github/workflows/ci-2.x.yml | 129 +++++++++++++++++++++++++++++++++++ .github/workflows/ci-4.x.yml | 129 +++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 74 +++++--------------- 3 files changed, 274 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/ci-2.x.yml create mode 100644 .github/workflows/ci-4.x.yml diff --git a/.github/workflows/ci-2.x.yml b/.github/workflows/ci-2.x.yml new file mode 100644 index 0000000..96ed709 --- /dev/null +++ b/.github/workflows/ci-2.x.yml @@ -0,0 +1,129 @@ +# Primary CI checks for Rollbar-PHP-Laravel. +# We're checking that logging within Laravel passes through the Rollbar Laravel +# integration when that integration is properly installed. We make this check +# for all supported combinations of Laravel, Rollbar, and PHP. We are not +# checking that messages are properly sent to Rollbar: that's handled by +# rollbar-php. +# +# Test with act: +# brew install act +# act -P ubuntu-latest=shivammathur/node:latest +# +# @see https://github.com/nektos/act/issues/329 +name: Rollbar-PHP-Laravel CI, version 2.x + +# Fire this action on pushes to 2.x legacy branches (the official one, as well +# as development branches within it -- hence the wildcard), and also tags for +# the legacy lineage. Also, run every day at 02:42 GMT to catch failures from +# transitive dependencies. + +on: + push: + branches: + - next/2.x/** + tags: + - v2.* + pull_request: + branches: + - next/2.x/** + schedule: + - cron: '42 2 * * *' + +jobs: + # Check that this runs on all combinations of Laravel we claim to support. + laravel-tests: + strategy: + matrix: + os: [ubuntu] + php: [7.4, 7.3, 7.2, 7.1, 7.0] + laravel: [^5.5] + env: + ROLLBAR_TOKEN: "ad865e76e7fb496fab096ac07b1dbabb" + name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }}-latest + steps: + - name: Install PHP and composer environment + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl + + - name: Create Laravel test app + run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} + + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Install that code using Composer rigged to look in the parent directory + working-directory: rollbar-test-app + run: | + composer config repositories.local '{"type":"path", "url":".."}' + composer require rollbar/rollbar-laravel + echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env + echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env + chmod 400 .env + + - name: Configure Laravel to use Rollbar and configure Rollbar to invoke logging callback + working-directory: rollbar-test-app + run: | + > config/logging.php echo ' "rollbar", + "channels" => array ( + "rollbar" => array ( + "driver" => "monolog", + "handler" => \Rollbar\Laravel\MonologHandler::class, + "access_token" => env("ROLLBAR_TOKEN"), + "level" => "debug", + // use the check_ignore filter to capture log messages for verification + "check_ignore" => "check_ignore", + ) + ) + ); + ' + touch app/helpers.php + > tmp-composer.json jq '.autoload += { "files": [ "app/helpers.php" ] }' composer.json + mv tmp-composer.json composer.json + composer dump-autoload + + - name: Define logging callback that invokes when Laravel logs through Rollbar + working-directory: rollbar-test-app + run: | + > app/helpers.php echo ' tests/Feature/LoggingTest.php echo 'assertFileExists(temp_file(), + "Rollbar check_ignore handler not invoked, suggesting an issue integrating Rollbar into Laravel."); + $this->assertSame($value, file_get_contents(temp_file()), + "check_ignore file did not contain expected value, suggesting file left by another process."); + } + } + ' + + - name: Invoke the Laravel test suite + working-directory: rollbar-test-app + run: | + ./vendor/bin/phpunit diff --git a/.github/workflows/ci-4.x.yml b/.github/workflows/ci-4.x.yml new file mode 100644 index 0000000..e82af40 --- /dev/null +++ b/.github/workflows/ci-4.x.yml @@ -0,0 +1,129 @@ +# Primary CI checks for Rollbar-PHP-Laravel. +# We're checking that logging within Laravel passes through the Rollbar Laravel +# integration when that integration is properly installed. We make this check +# for all supported combinations of Laravel, Rollbar, and PHP. We are not +# checking that messages are properly sent to Rollbar: that's handled by +# rollbar-php. +# +# Test with act: +# brew install act +# act -P ubuntu-latest=shivammathur/node:latest +# +# @see https://github.com/nektos/act/issues/329 +name: Rollbar-PHP-Laravel CI, version 4.x + +# Fire this action on pushes to 4.x legacy branches (the official one, as well +# as development branches within it -- hence the wildcard), and also tags for +# the legacy lineage. Also, run every day at 02:42 GMT to catch failures from +# transitive dependencies. + +on: + push: + branches: + - next/4.x/** + tags: + - v4.* + pull_request: + branches: + - next/4.x/** + schedule: + - cron: '42 2 * * *' + +jobs: + # Check that this runs on all combinations of Laravel we claim to support. + laravel-tests: + strategy: + matrix: + os: [ubuntu] + php: [7.4, 7.3, 7.2, 7.1] + laravel: [^5.8, ^5.7, ^5.6] + env: + ROLLBAR_TOKEN: "ad865e76e7fb496fab096ac07b1dbabb" + name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }}-latest + steps: + - name: Install PHP and composer environment + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl + + - name: Create Laravel test app + run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} + + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Install that code using Composer rigged to look in the parent directory + working-directory: rollbar-test-app + run: | + composer config repositories.local '{"type":"path", "url":".."}' + composer require rollbar/rollbar-laravel + echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env + echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env + chmod 400 .env + + - name: Configure Laravel to use Rollbar and configure Rollbar to invoke logging callback + working-directory: rollbar-test-app + run: | + > config/logging.php echo ' "rollbar", + "channels" => array ( + "rollbar" => array ( + "driver" => "monolog", + "handler" => \Rollbar\Laravel\MonologHandler::class, + "access_token" => env("ROLLBAR_TOKEN"), + "level" => "debug", + // use the check_ignore filter to capture log messages for verification + "check_ignore" => "check_ignore", + ) + ) + ); + ' + touch app/helpers.php + > tmp-composer.json jq '.autoload += { "files": [ "app/helpers.php" ] }' composer.json + mv tmp-composer.json composer.json + composer dump-autoload + + - name: Define logging callback that invokes when Laravel logs through Rollbar + working-directory: rollbar-test-app + run: | + > app/helpers.php echo ' tests/Feature/LoggingTest.php echo 'assertFileExists(temp_file(), + "Rollbar check_ignore handler not invoked, suggesting an issue integrating Rollbar into Laravel."); + $this->assertSame($value, file_get_contents(temp_file()), + "check_ignore file did not contain expected value, suggesting file left by another process."); + } + } + ' + + - name: Invoke the Laravel test suite + working-directory: rollbar-test-app + run: | + ./vendor/bin/phpunit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5c9d14..de9805e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,14 +10,18 @@ # act -P ubuntu-latest=shivammathur/node:latest # # @see https://github.com/nektos/act/issues/329 -name: Rollbar-PHP-Laravel CI +name: Rollbar-PHP-Laravel CI, master # Fire this action on pushes to main branch (master) as well as other branches -# or pull requests. Also, run every day at 02:42 GMT -- this catches failures -# from dependencies that update independently. +# or pull requests, excluding those in the next/ lineage. Also, run every day +# at 02:42 GMT -- this catches failures from transitive dependencies. on: push: + branches-ignore: + - next/** pull_request: + branches-ignore: + - next/** schedule: - cron: '42 2 * * *' @@ -27,12 +31,8 @@ jobs: strategy: matrix: os: [ubuntu] - php: [7.4, 7.3, 7.2, 7.1] - laravel: [^8, ^7, ^6, ^5.8, ^5.7, ^5.6] - rollbar-php-laravel: [^7, 4.*] - #fails#php: [7.0] - #fails#laravel: [^5.5] - #fails#rollbar-php-laravel: [2.*] + php: [7.4, 7.3, 7.2] + laravel: [^8, ^7, ^6] exclude: # Laravel 8 requires php 7.3+, so exclude all PHP versions prior to 7.3 - laravel: ^8 @@ -50,57 +50,11 @@ jobs: php: 7.1 - laravel: ^6 php: 7.0 - # Laravel 5.8, 5.7, and 5.6 requires php 7.1.3+, so exclude all PHP versions prior to 7.1.3 for them - - laravel: ^5.8 - php: 7.0 - - laravel: ^5.7 - php: 7.0 - - laravel: ^5.6 - php: 7.0 - # Laravel 6+ use rollbar-php-laravel latest, so exclude all below 7 - - laravel: ^6 - rollbar-php-laravel: 4.* - - laravel: ^6 - rollbar-php-laravel: 2.* - - laravel: ^7 - rollbar-php-laravel: 4.* - - laravel: ^7 - rollbar-php-laravel: 2.* - - laravel: ^8 - rollbar-php-laravel: 4.* - - laravel: ^8 - rollbar-php-laravel: 2.* - # Laravel 5.6 to 5.8 use rollbar-php-laravel 4.x, so exclude all above that and below that - - laravel: ^5.6 - rollbar-php-laravel: ^7 - - laravel: ^5.6 - rollbar-php-laravel: 2.* - - laravel: ^5.7 - rollbar-php-laravel: ^7 - - laravel: ^5.7 - rollbar-php-laravel: 2.* - - laravel: ^5.8 - rollbar-php-laravel: ^7 - - laravel: ^5.8 - rollbar-php-laravel: 2.* - # Laravel 5.5 and below use rollbar-php-laravel 2.x, so exclude all above that - - laravel: ^5.5 - rollbar-php-laravel: ^7 - - laravel: ^5.5 - rollbar-php-laravel: 4.* env: ROLLBAR_TOKEN: "ad865e76e7fb496fab096ac07b1dbabb" - name: Laravel ${{ matrix.laravel }}/Rollbar ${{ matrix.rollbar-php-laravel }}/PHP ${{ matrix.php }}(${{ matrix.os }}) + name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: - # Note: this step is currently unused, because we are installing Rollbar - # Note: from Packagist 3 steps later. This was done to prove out currently - # Note: working combinations from published versions. The next iteration - # Note: will move the CI to use the correct branch, so that pre-published - # Note: code will be tested. - - name: Checkout the code - uses: actions/checkout@v2 - - name: Install PHP and composer environment uses: shivammathur/setup-php@v2 with: @@ -110,10 +64,14 @@ jobs: - name: Create Laravel test app run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} - - name: Install rollbar-php-laravel package + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Install that code using Composer rigged to look in the parent directory working-directory: rollbar-test-app run: | - composer require rollbar/rollbar-laravel ${{ matrix.rollbar-php-laravel }} + composer config repositories.local '{"type":"path", "url":".."}' + composer require rollbar/rollbar-laravel echo "ROLLBAR_TOKEN=${ROLLBAR_TOKEN}" >> .env echo "GITHUB_RUN_ID=${GITHUB_RUN_ID}" >> .env chmod 400 .env From a20096aa281dff844584b1c7a30ac877d69f8b8b Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 15 Dec 2021 10:01:07 -0500 Subject: [PATCH 20/21] refac: remove irrelevant matrix exclusions --- .github/workflows/ci.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de9805e..0694d9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,19 +37,6 @@ jobs: # Laravel 8 requires php 7.3+, so exclude all PHP versions prior to 7.3 - laravel: ^8 php: 7.2 - - laravel: ^8 - php: 7.1 - - laravel: ^8 - php: 7.0 - # Laravel 7 and 6 requires php 7.2+, so exclude all PHP versions prior to 7.2 - - laravel: ^7 - php: 7.1 - - laravel: ^7 - php: 7.0 - - laravel: ^6 - php: 7.1 - - laravel: ^6 - php: 7.0 env: ROLLBAR_TOKEN: "ad865e76e7fb496fab096ac07b1dbabb" name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) From f2e7916e667c8b5118431a559c8897b2debd4e43 Mon Sep 17 00:00:00 2001 From: Bishop Bettini Date: Wed, 15 Dec 2021 10:03:13 -0500 Subject: [PATCH 21/21] fix: checkout needs to be first --- .github/workflows/ci-2.x.yml | 6 +++--- .github/workflows/ci-4.x.yml | 6 +++--- .github/workflows/ci.yml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-2.x.yml b/.github/workflows/ci-2.x.yml index 96ed709..6339b60 100644 --- a/.github/workflows/ci-2.x.yml +++ b/.github/workflows/ci-2.x.yml @@ -42,6 +42,9 @@ jobs: name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: + - name: Checkout the code + uses: actions/checkout@v2 + - name: Install PHP and composer environment uses: shivammathur/setup-php@v2 with: @@ -51,9 +54,6 @@ jobs: - name: Create Laravel test app run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} - - name: Checkout the code - uses: actions/checkout@v2 - - name: Install that code using Composer rigged to look in the parent directory working-directory: rollbar-test-app run: | diff --git a/.github/workflows/ci-4.x.yml b/.github/workflows/ci-4.x.yml index e82af40..d8235c3 100644 --- a/.github/workflows/ci-4.x.yml +++ b/.github/workflows/ci-4.x.yml @@ -42,6 +42,9 @@ jobs: name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: + - name: Checkout the code + uses: actions/checkout@v2 + - name: Install PHP and composer environment uses: shivammathur/setup-php@v2 with: @@ -51,9 +54,6 @@ jobs: - name: Create Laravel test app run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} - - name: Checkout the code - uses: actions/checkout@v2 - - name: Install that code using Composer rigged to look in the parent directory working-directory: rollbar-test-app run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0694d9b..c10ea76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,9 @@ jobs: name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }} (${{ matrix.os }}) runs-on: ${{ matrix.os }}-latest steps: + - name: Checkout the code + uses: actions/checkout@v2 + - name: Install PHP and composer environment uses: shivammathur/setup-php@v2 with: @@ -51,9 +54,6 @@ jobs: - name: Create Laravel test app run: composer create-project laravel/laravel rollbar-test-app ${{ matrix.laravel }} - - name: Checkout the code - uses: actions/checkout@v2 - - name: Install that code using Composer rigged to look in the parent directory working-directory: rollbar-test-app run: |