From b23abf5d5a49b7c6d78189b5f83551f54e874cae Mon Sep 17 00:00:00 2001 From: David Brownman Date: Tue, 7 Jan 2025 16:38:20 -0800 Subject: [PATCH 01/16] add justfile and tweak CI + readme --- .github/workflows/ci.yml | 15 +++------- .gitignore | 3 -- Makefile | 2 ++ README.md | 17 +++++++---- justfile | 63 ++++++++++++++++++++++++++++++++++++++++ phpunit.no_autoload.xml | 3 -- phpunit.xml | 3 -- 7 files changed, 80 insertions(+), 26 deletions(-) create mode 100644 justfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d287552dd..6f13eacff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: - "8.2" steps: + - uses: extractions/setup-just@v2 - uses: actions/checkout@v3 - name: Setup PHP @@ -69,7 +70,7 @@ jobs: run: composer install --prefer-dist --no-progress - name: Run phpstan - run: make phpstan + run: just lint tests: name: Tests @@ -94,13 +95,13 @@ jobs: - "8.2" steps: + - uses: extractions/setup-just@v2 - uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - coverage: xdebug - name: Get Composer Cache Directory id: composer-cache @@ -127,15 +128,7 @@ jobs: - name: Run test suite run: | php --version - make ci-test - - - name: Coveralls - if: matrix.php-version == '8.2' && matrix.env == 'AUTOLOAD=1' - uses: coverallsapp/github-action@v2 - with: - files: clover.xml - flag-name: php-${{ matrix.php-version }}-${{ matrix.env }} - github-token: ${{ secrets.GITHUB_TOKEN }} + just ci-test publish: # Doesn't actually publish. The publish happens via a packagist webhook configured in the Github UI. But we still display a message here diff --git a/.gitignore b/.gitignore index 880465ac1..2049c2070 100644 --- a/.gitignore +++ b/.gitignore @@ -13,9 +13,6 @@ build/* # If the vendor directory isn't being commited the composer.lock file should also be ignored composer.lock -# Ignore PHPUnit coverage file -clover.xml - # Ignore IDE's configuration files .idea diff --git a/Makefile b/Makefile index 4702fcb47..b57087ae0 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# NOTE: this file is deprecated and slated for deletion; prefer using the equivalent `just` commands. + export PHPDOCUMENTOR_VERSION := v3.0.0 vendor: composer.json diff --git a/README.md b/README.md index b51c486dd..627e3db88 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ [![Latest Stable Version](https://poser.pugx.org/stripe/stripe-php/v/stable.svg)](https://packagist.org/packages/stripe/stripe-php) [![Total Downloads](https://poser.pugx.org/stripe/stripe-php/downloads.svg)](https://packagist.org/packages/stripe/stripe-php) [![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php) -[![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master) The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a pre-defined set of @@ -249,7 +248,9 @@ New features and bug fixes are released on the latest major version of the Strip ## Development -Get [Composer][composer]. For example, on Mac OS: +We use [just](https://github.com/casey/just) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`. + +To get started, install [Composer][composer]. For example, on Mac OS: ```bash brew install composer @@ -258,7 +259,8 @@ brew install composer Install dependencies: ```bash -composer install +just install +# or: composer install ``` The test suite depends on [stripe-mock], so make sure to fetch and run it from a @@ -273,13 +275,15 @@ stripe-mock Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite: ```bash -./vendor/bin/phpunit +just test +# or: ./vendor/bin/phpunit ``` Or to run an individual test file: ```bash -./vendor/bin/phpunit tests/Stripe/UtilTest.php +just test tests/Stripe/UtilTest.php +# or: ./vendor/bin/phpunit tests/Stripe/UtilTest.php ``` Update bundled CA certificates from the [Mozilla cURL release][curl]: @@ -291,7 +295,8 @@ Update bundled CA certificates from the [Mozilla cURL release][curl]: The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with: ```bash -./vendor/bin/php-cs-fixer fix -v . +just format +# or: ./vendor/bin/php-cs-fixer fix -v . ``` ## Attention plugin developers diff --git a/justfile b/justfile new file mode 100644 index 000000000..26d376d58 --- /dev/null +++ b/justfile @@ -0,0 +1,63 @@ +import? '../sdk-codegen/justfile' + +set quiet + +export PATH := "./vendor/bin:" + env_var('PATH') +PHPDOCUMENTOR_VERSION := "v3.0.0" + +_default: + just --list --unsorted + +# install vendored dependencies; only used locally +[group('useful')] +install: + #!/usr/bin/env bash + set -euo pipefail + + composer install + + if [ ! -f vendor/bin/phpdoc ]; then + curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc + chmod +x vendor/bin/phpdoc + fi + +[no-exit-message] +[group('useful')] +test *options: + phpunit {{ options }} + +[group('CI')] +ci-test: + ./build.php $AUTOLOAD + +[group('useful')] +format *options: + PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --using-cache=no {{ options }} + +# for backwards compatibility; ideally removed later +[private] +alias codegen-format := format + +[group('CI')] +format-check: (format "--dry-run") + +[group('CI')] +lint *options: + php -d memory_limit=512M vendor/bin/phpstan analyse lib tests {{options}} + +# for backwards compatibility; ideally removed later +[private] +alias phpstan := lint + +[group('misc')] +phpstan-baseline: (lint "--generate-baseline") + +# called by tooling +[private] +update-version version: + echo "{{ version }}" > VERSION + perl -pi -e 's|VERSION = '\''[.\-\w\d]+'\''|VERSION = '\''{{ version }}'\''|' lib/Stripe.php + +[group('misc')] +phpdoc: + phpdoc diff --git a/phpunit.no_autoload.xml b/phpunit.no_autoload.xml index 71606e4e4..aad5b2ca0 100644 --- a/phpunit.no_autoload.xml +++ b/phpunit.no_autoload.xml @@ -17,7 +17,4 @@ lib - - - diff --git a/phpunit.xml b/phpunit.xml index badf860b6..688b6d2b4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -17,7 +17,4 @@ lib - - - From c911b8a47b69f64898ecc6f413b9015a80d0d522 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Tue, 7 Jan 2025 16:52:16 -0800 Subject: [PATCH 02/16] debug test --- justfile | 1 + 1 file changed, 1 insertion(+) diff --git a/justfile b/justfile index 26d376d58..89dc22132 100644 --- a/justfile +++ b/justfile @@ -28,6 +28,7 @@ test *options: [group('CI')] ci-test: + echo "got $AUTOLOAD" ./build.php $AUTOLOAD [group('useful')] From d03a553722a6189bf12f2ab52ffe8e5c6f66b1c3 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Tue, 7 Jan 2025 16:56:37 -0800 Subject: [PATCH 03/16] Debugging --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f13eacff..378bde6b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,6 +128,7 @@ jobs: - name: Run test suite run: | php --version + make ci-test just ci-test publish: From 33d342683c691d8511c60f715c798112852f0e1f Mon Sep 17 00:00:00 2001 From: David Brownman Date: Tue, 7 Jan 2025 17:03:50 -0800 Subject: [PATCH 04/16] further debugging --- .github/workflows/ci.yml | 4 +-- composer.json | 75 +++++++++++++++++----------------------- 2 files changed, 33 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 378bde6b6..ae3ec9002 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,8 +128,8 @@ jobs: - name: Run test suite run: | php --version - make ci-test - just ci-test + echo "autoload is: $AUTOLOAD" + AUTOLOAD=1 just ci-test publish: # Doesn't actually publish. The publish happens via a packagist webhook configured in the Github UI. But we still display a message here diff --git a/composer.json b/composer.json index 1e4dd7cbb..a5d34f06b 100644 --- a/composer.json +++ b/composer.json @@ -1,46 +1,33 @@ { - "name": "stripe/stripe-php", - "description": "Stripe PHP Library", - "keywords": [ - "stripe", - "payment processing", - "api" - ], - "homepage": "https://stripe.com/", - "license": "MIT", - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https://github.com/stripe/stripe-php/contributors" + "name": "stripe\/stripe-php", + "description": "Stripe PHP Library", + "keywords": [ + "stripe", + "payment processing", + "api" + ], + "homepage": "https:\/\/stripe.com\/", + "license": "MIT", + "authors": [ + { + "name": "Stripe and contributors", + "homepage": "https:\/\/github.com\/stripe\/stripe-php\/contributors" + } + ], + "require": { + "php": ">=5.6.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit\/phpunit": "^5.7 || ^9.0", + "friendsofphp\/php-cs-fixer": "3.5.0", + "phpstan\/phpstan": "^1.2" + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } } - ], - "require": { - "php": ">=5.6.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^9.0", - "friendsofphp/php-cs-fixer": "3.5.0", - "phpstan/phpstan": "^1.2" - }, - "autoload": { - "psr-4": { - "Stripe\\": "lib/" - } - }, - "autoload-dev": { - "psr-4": { - "Stripe\\": [ - "tests/", - "tests/Stripe/" - ] - } - }, - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - } -} +} \ No newline at end of file From 9de906ad803d6dfb87c9254812e0de8d6cd48ea2 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:04:00 -0800 Subject: [PATCH 05/16] restore original composer json --- .github/workflows/ci.yml | 2 +- composer.json | 75 +++++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae3ec9002..aae542455 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,7 +129,7 @@ jobs: run: | php --version echo "autoload is: $AUTOLOAD" - AUTOLOAD=1 just ci-test + just ci-test publish: # Doesn't actually publish. The publish happens via a packagist webhook configured in the Github UI. But we still display a message here diff --git a/composer.json b/composer.json index a5d34f06b..1e4dd7cbb 100644 --- a/composer.json +++ b/composer.json @@ -1,33 +1,46 @@ { - "name": "stripe\/stripe-php", - "description": "Stripe PHP Library", - "keywords": [ - "stripe", - "payment processing", - "api" - ], - "homepage": "https:\/\/stripe.com\/", - "license": "MIT", - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https:\/\/github.com\/stripe\/stripe-php\/contributors" - } - ], - "require": { - "php": ">=5.6.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit\/phpunit": "^5.7 || ^9.0", - "friendsofphp\/php-cs-fixer": "3.5.0", - "phpstan\/phpstan": "^1.2" - }, - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } + "name": "stripe/stripe-php", + "description": "Stripe PHP Library", + "keywords": [ + "stripe", + "payment processing", + "api" + ], + "homepage": "https://stripe.com/", + "license": "MIT", + "authors": [ + { + "name": "Stripe and contributors", + "homepage": "https://github.com/stripe/stripe-php/contributors" } -} \ No newline at end of file + ], + "require": { + "php": ">=5.6.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^9.0", + "friendsofphp/php-cs-fixer": "3.5.0", + "phpstan/phpstan": "^1.2" + }, + "autoload": { + "psr-4": { + "Stripe\\": "lib/" + } + }, + "autoload-dev": { + "psr-4": { + "Stripe\\": [ + "tests/", + "tests/Stripe/" + ] + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + } +} From dc89cd151ec9c9c619b5cdedfc722e326ee1a1bb Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:12:02 -0800 Subject: [PATCH 06/16] add more logging --- .github/workflows/ci.yml | 4 ++- Makefile | 1 + composer.json | 75 +++++++++++++++++----------------------- justfile | 1 + 4 files changed, 36 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aae542455..4bb415d92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,10 +126,12 @@ jobs: - uses: stripe/openapi/actions/stripe-mock@master - name: Run test suite + # --yes skips the confirmation dialogue for the CI test, which modifies files run: | php --version echo "autoload is: $AUTOLOAD" - just ci-test + make ci-test + just --yes ci-test publish: # Doesn't actually publish. The publish happens via a packagist webhook configured in the Github UI. But we still display a message here diff --git a/Makefile b/Makefile index b57087ae0..6fa3e4f0b 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ test: vendor .PHONY: test ci-test: vendor + echo "calling build with $$AUTOLOAD" ./build.php $$AUTOLOAD .PHONY: ci-test diff --git a/composer.json b/composer.json index 1e4dd7cbb..a5d34f06b 100644 --- a/composer.json +++ b/composer.json @@ -1,46 +1,33 @@ { - "name": "stripe/stripe-php", - "description": "Stripe PHP Library", - "keywords": [ - "stripe", - "payment processing", - "api" - ], - "homepage": "https://stripe.com/", - "license": "MIT", - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https://github.com/stripe/stripe-php/contributors" + "name": "stripe\/stripe-php", + "description": "Stripe PHP Library", + "keywords": [ + "stripe", + "payment processing", + "api" + ], + "homepage": "https:\/\/stripe.com\/", + "license": "MIT", + "authors": [ + { + "name": "Stripe and contributors", + "homepage": "https:\/\/github.com\/stripe\/stripe-php\/contributors" + } + ], + "require": { + "php": ">=5.6.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit\/phpunit": "^5.7 || ^9.0", + "friendsofphp\/php-cs-fixer": "3.5.0", + "phpstan\/phpstan": "^1.2" + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } } - ], - "require": { - "php": ">=5.6.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^9.0", - "friendsofphp/php-cs-fixer": "3.5.0", - "phpstan/phpstan": "^1.2" - }, - "autoload": { - "psr-4": { - "Stripe\\": "lib/" - } - }, - "autoload-dev": { - "psr-4": { - "Stripe\\": [ - "tests/", - "tests/Stripe/" - ] - } - }, - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - } -} +} \ No newline at end of file diff --git a/justfile b/justfile index 89dc22132..2e4d520c9 100644 --- a/justfile +++ b/justfile @@ -27,6 +27,7 @@ test *options: phpunit {{ options }} [group('CI')] +[confirm("This will modify local and is mostly just for CI; do you want to proceed?")] ci-test: echo "got $AUTOLOAD" ./build.php $AUTOLOAD From a80cc0980839240aee549988006e23ed4a377433 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:33:21 -0800 Subject: [PATCH 07/16] maybe fix ci --- .github/workflows/ci.yml | 8 +++++--- justfile | 16 ++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bb415d92..7e677c389 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,9 +80,9 @@ jobs: strategy: fail-fast: false matrix: - env: - - AUTOLOAD=0 - - AUTOLOAD=1 + autload: + - "0" + - "1" php-version: - "5.6" - "7.0" @@ -126,6 +126,8 @@ jobs: - uses: stripe/openapi/actions/stripe-mock@master - name: Run test suite + env: + AUTOLOAD: ${{ matrix.autoload }} # --yes skips the confirmation dialogue for the CI test, which modifies files run: | php --version diff --git a/justfile b/justfile index 2e4d520c9..5a4ecf980 100644 --- a/justfile +++ b/justfile @@ -11,16 +11,8 @@ _default: # install vendored dependencies; only used locally [group('useful')] install: - #!/usr/bin/env bash - set -euo pipefail - composer install - if [ ! -f vendor/bin/phpdoc ]; then - curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc - chmod +x vendor/bin/phpdoc - fi - [no-exit-message] [group('useful')] test *options: @@ -62,4 +54,12 @@ update-version version: [group('misc')] phpdoc: + #!/usr/bin/env bash + set -euo pipefail + + if [ ! -f vendor/bin/phpdoc ]; then + curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/{{ PHPDOCUMENTOR_VERSION }}/phpDocumentor.phar -o vendor/bin/phpdoc + chmod +x vendor/bin/phpdoc + fi + phpdoc From 31652eb7b269c8207a6ba3f511a3f293d71d1b04 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:36:24 -0800 Subject: [PATCH 08/16] Fix typo --- .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 7e677c389..25a982230 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: strategy: fail-fast: false matrix: - autload: + autoload: - "0" - "1" php-version: From 06fc80cd9580f3b9e1db6a1fea9eb77ec1b84f88 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:47:17 -0800 Subject: [PATCH 09/16] fix test naming and pass autoload directly to recipe as arugment --- .github/workflows/ci.yml | 8 ++------ justfile | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25a982230..7b5befeea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,8 +73,6 @@ jobs: run: just lint tests: - name: Tests - runs-on: ubuntu-latest strategy: @@ -93,6 +91,7 @@ jobs: - "8.0" - "8.1" - "8.2" + name: Tests (php@${{ matrix.php-version }}, AUTOLOAD=${{ matrix.autoload }}) steps: - uses: extractions/setup-just@v2 @@ -126,14 +125,11 @@ jobs: - uses: stripe/openapi/actions/stripe-mock@master - name: Run test suite - env: - AUTOLOAD: ${{ matrix.autoload }} # --yes skips the confirmation dialogue for the CI test, which modifies files run: | php --version echo "autoload is: $AUTOLOAD" - make ci-test - just --yes ci-test + just --yes ci-test ${{ matrix.autoload }} publish: # Doesn't actually publish. The publish happens via a packagist webhook configured in the Github UI. But we still display a message here diff --git a/justfile b/justfile index 5a4ecf980..3c04834e3 100644 --- a/justfile +++ b/justfile @@ -20,9 +20,9 @@ test *options: [group('CI')] [confirm("This will modify local and is mostly just for CI; do you want to proceed?")] -ci-test: - echo "got $AUTOLOAD" - ./build.php $AUTOLOAD +ci-test autoload: + echo "got {{ autoload }}" + ./build.php {{ autoload }} [group('useful')] format *options: From c03177d5f76cb352c89c75368d7b5dae3eafd072 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:49:40 -0800 Subject: [PATCH 10/16] Remove unused logline and fix typo --- .github/workflows/ci.yml | 1 - justfile | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b5befeea..f0d533d08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,6 @@ jobs: # --yes skips the confirmation dialogue for the CI test, which modifies files run: | php --version - echo "autoload is: $AUTOLOAD" just --yes ci-test ${{ matrix.autoload }} publish: diff --git a/justfile b/justfile index 3c04834e3..ac6b18080 100644 --- a/justfile +++ b/justfile @@ -19,9 +19,9 @@ test *options: phpunit {{ options }} [group('CI')] -[confirm("This will modify local and is mostly just for CI; do you want to proceed?")] +[confirm("This will modify local files and is intended for use in CI; do you want to proceed?")] ci-test autoload: - echo "got {{ autoload }}" + echo "running build.php with argument: {{ autoload }}" ./build.php {{ autoload }} [group('useful')] From 1db293ef761bc3398b025b4e2112c468e090fb8b Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 11:52:44 -0800 Subject: [PATCH 11/16] restore composer --- .github/workflows/ci.yml | 7 +--- composer.json | 75 +++++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0d533d08..604aeb470 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,11 +37,6 @@ jobs: runs-on: ubuntu-latest - strategy: - matrix: - php-version: - - "8.2" - steps: - uses: extractions/setup-just@v2 - uses: actions/checkout@v3 @@ -49,7 +44,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-version }} + php-version: "8.2" - name: Get Composer Cache Directory id: composer-cache diff --git a/composer.json b/composer.json index a5d34f06b..1e4dd7cbb 100644 --- a/composer.json +++ b/composer.json @@ -1,33 +1,46 @@ { - "name": "stripe\/stripe-php", - "description": "Stripe PHP Library", - "keywords": [ - "stripe", - "payment processing", - "api" - ], - "homepage": "https:\/\/stripe.com\/", - "license": "MIT", - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https:\/\/github.com\/stripe\/stripe-php\/contributors" - } - ], - "require": { - "php": ">=5.6.0", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit\/phpunit": "^5.7 || ^9.0", - "friendsofphp\/php-cs-fixer": "3.5.0", - "phpstan\/phpstan": "^1.2" - }, - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } + "name": "stripe/stripe-php", + "description": "Stripe PHP Library", + "keywords": [ + "stripe", + "payment processing", + "api" + ], + "homepage": "https://stripe.com/", + "license": "MIT", + "authors": [ + { + "name": "Stripe and contributors", + "homepage": "https://github.com/stripe/stripe-php/contributors" } -} \ No newline at end of file + ], + "require": { + "php": ">=5.6.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^9.0", + "friendsofphp/php-cs-fixer": "3.5.0", + "phpstan/phpstan": "^1.2" + }, + "autoload": { + "psr-4": { + "Stripe\\": "lib/" + } + }, + "autoload-dev": { + "psr-4": { + "Stripe\\": [ + "tests/", + "tests/Stripe/" + ] + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + } +} From fd1eb0d42bc209b746b3cff30bdbd71967881a0a Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 12:15:58 -0800 Subject: [PATCH 12/16] remove extra log line --- justfile | 1 - 1 file changed, 1 deletion(-) diff --git a/justfile b/justfile index ac6b18080..560772f79 100644 --- a/justfile +++ b/justfile @@ -21,7 +21,6 @@ test *options: [group('CI')] [confirm("This will modify local files and is intended for use in CI; do you want to proceed?")] ci-test autoload: - echo "running build.php with argument: {{ autoload }}" ./build.php {{ autoload }} [group('useful')] From c558ddead773faa9cd7d0096fc0cf919d5519b1c Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 15:06:56 -0800 Subject: [PATCH 13/16] update justfile --- justfile | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/justfile b/justfile index 560772f79..734e9466f 100644 --- a/justfile +++ b/justfile @@ -2,56 +2,50 @@ import? '../sdk-codegen/justfile' set quiet -export PATH := "./vendor/bin:" + env_var('PATH') -PHPDOCUMENTOR_VERSION := "v3.0.0" +# make vendored executables callable directly +export PATH := "vendor/bin:" + env_var('PATH') _default: just --list --unsorted # install vendored dependencies; only used locally -[group('useful')] install: composer install [no-exit-message] -[group('useful')] -test *options: - phpunit {{ options }} +test *args: + phpunit {{ args }} -[group('CI')] [confirm("This will modify local files and is intended for use in CI; do you want to proceed?")] ci-test autoload: ./build.php {{ autoload }} -[group('useful')] -format *options: - PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --using-cache=no {{ options }} +format *args: + PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --using-cache=no {{ args }} # for backwards compatibility; ideally removed later [private] alias codegen-format := format -[group('CI')] format-check: (format "--dry-run") -[group('CI')] -lint *options: - php -d memory_limit=512M vendor/bin/phpstan analyse lib tests {{options}} +lint *args: + php -d memory_limit=512M vendor/bin/phpstan analyse lib tests {{args}} # for backwards compatibility; ideally removed later [private] alias phpstan := lint -[group('misc')] -phpstan-baseline: (lint "--generate-baseline") - # called by tooling [private] update-version version: echo "{{ version }}" > VERSION perl -pi -e 's|VERSION = '\''[.\-\w\d]+'\''|VERSION = '\''{{ version }}'\''|' lib/Stripe.php -[group('misc')] + +PHPDOCUMENTOR_VERSION := "v3.0.0" +# generates docs; currently broken? can unhide if working +[private] phpdoc: #!/usr/bin/env bash set -euo pipefail From e6cc3e2947d28790f93bbdf141614c91fc84feaa Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 15:49:28 -0800 Subject: [PATCH 14/16] add comments --- justfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/justfile b/justfile index 734e9466f..fefc13802 100644 --- a/justfile +++ b/justfile @@ -12,14 +12,17 @@ _default: install: composer install +# ⭐ run full unit test suite; needs stripe-mock [no-exit-message] test *args: phpunit {{ args }} +# run tests in CI; can use autoload mode (or not) [confirm("This will modify local files and is intended for use in CI; do you want to proceed?")] ci-test autoload: ./build.php {{ autoload }} +# ⭐ format all files format *args: PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --using-cache=no {{ args }} @@ -27,8 +30,10 @@ format *args: [private] alias codegen-format := format +# check formatting for, but don't modify, files format-check: (format "--dry-run") +# ⭐ statically analyze code lint *args: php -d memory_limit=512M vendor/bin/phpstan analyse lib tests {{args}} From b30f3bb2c450634cefbb4b67697409d7987dcf29 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 16:45:54 -0800 Subject: [PATCH 15/16] update ci --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 604aeb470..51c95ae6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,11 @@ jobs: name: Tests (php@${{ matrix.php-version }}, AUTOLOAD=${{ matrix.autoload }}) steps: - - uses: extractions/setup-just@v2 + - name: Install just + run: | + sudo apt-get update + sudo apt-get install just + - uses: actions/checkout@v3 - name: Setup PHP From 38080e71f0079374626600ace04206cfa7f4a28f Mon Sep 17 00:00:00 2001 From: David Brownman Date: Wed, 8 Jan 2025 16:55:02 -0800 Subject: [PATCH 16/16] revert to gh action --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51c95ae6d..604aeb470 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,11 +89,7 @@ jobs: name: Tests (php@${{ matrix.php-version }}, AUTOLOAD=${{ matrix.autoload }}) steps: - - name: Install just - run: | - sudo apt-get update - sudo apt-get install just - + - uses: extractions/setup-just@v2 - uses: actions/checkout@v3 - name: Setup PHP