Skip to content

Commit

Permalink
Update generated code for beta (#1803)
Browse files Browse the repository at this point in the history
* Update generated code (#1793)

* Update generated code for v1399

* Update generated code for v1409

* Update generated code for v1412

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>

* Bump version to 16.4.0

* Added pull request template (#1797)

* Add justfile, remove coveralls, and fix AUTOLOAD in CI (#1801)

* add justfile and tweak CI + readme

* debug test

* Debugging

* further debugging

* restore original composer json

* add more logging

* maybe fix ci

* Fix typo

* fix test naming and pass autoload directly to recipe as arugment

* Remove unused logline and fix typo

* restore composer

* remove extra log line

* update justfile

* add comments

* update ci

* revert to gh action

* ensure dependencies are installed for format and test recipes (#1802)

* Update generated code for v1439

* Update generated code for v1441

* Update generated code for v1441

* Update generated code for v1442

* Update generated code for v1443

* Update generated code for v1445

* Update generated code for v1446

* Update generated code for v1448

* Update generated code for v1449

* Update generated code for v1450

* Added CONTRIBUTING.md file (#1806)

* minor justfile fixes (#1807)

* made v2 event class concrete, and changed convertToStripeObject to use it if we cannot find the identified event subclass (#1805)

* Update generated code for v1454

* added CONTRIBUTING.md

* Update generated code for v1456

* Update generated code for v1457

* Update generated code for v1460

---------

Co-authored-by: stripe-openapi[bot] <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Jesse Rosalia <[email protected]>
Co-authored-by: David Brownman <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2025
1 parent 4dbdcc0 commit 6904039
Show file tree
Hide file tree
Showing 36 changed files with 174 additions and 87 deletions.
40 changes: 14 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
php-cs-fixer:
name: PHP-CS-Fixer

runs-on: ubuntu-latest
runs-on: "ubuntu-24.04"

steps:
- uses: actions/checkout@v3
Expand All @@ -35,20 +35,16 @@ jobs:
phpstan:
name: PHPStan

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- "8.2"
runs-on: "ubuntu-24.04"

steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@v3

- 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
Expand All @@ -69,19 +65,17 @@ jobs:
run: composer install --prefer-dist --no-progress

- name: Run phpstan
run: make phpstan
run: just lint

tests:
name: Tests

runs-on: ubuntu-latest
runs-on: "ubuntu-24.04"

strategy:
fail-fast: false
matrix:
env:
- AUTOLOAD=0
- AUTOLOAD=1
autoload:
- "0"
- "1"
php-version:
- "5.6"
- "7.0"
Expand All @@ -92,15 +86,16 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
name: Tests (php@${{ matrix.php-version }}, AUTOLOAD=${{ matrix.autoload }})

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
Expand All @@ -125,17 +120,10 @@ 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
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 --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
Expand All @@ -144,7 +132,7 @@ jobs:
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') &&
startsWith(github.ref, 'refs/tags/v') &&
endsWith(github.actor, '-stripe')
runs-on: ubuntu-latest
runs-on: "ubuntu-24.04"
steps:
- uses: actions/checkout@v2
- uses: stripe/openapi/actions/notify-release@master
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,6 +14,7 @@ test: vendor
.PHONY: test

ci-test: vendor
echo "calling build with $$AUTOLOAD"
./build.php $$AUTOLOAD
.PHONY: ci-test

Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1437
v1460
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -249,7 +248,11 @@ New features and bug fixes are released on the latest major version of the Strip

## Development

Get [Composer][composer]. For example, on Mac OS:
[Contribution guidelines for this project](CONTRIBUTING.md)

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
Expand All @@ -258,7 +261,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
Expand All @@ -273,13 +277,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]:
Expand All @@ -291,7 +297,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
Expand Down
59 changes: 59 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
set quiet

import? '../sdk-codegen/utils.just'

# make vendored executables callable directly
export PATH := "vendor/bin:" + env_var('PATH')

_default:
just --list --unsorted

# install vendored dependencies
install *args:
composer install {{ if is_dependency() == "true" {"--quiet"} else {""} }} {{ args }}

# ⭐ run full unit test suite; needs stripe-mock
[no-exit-message]
test *args: install
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: install
PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix -v --using-cache=no {{ args }}

# 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}}

# for backwards compatibility; ideally removed later
[private]
alias phpstan := lint

# called by tooling
[private]
update-version version:
echo "{{ version }}" > VERSION
perl -pi -e 's|VERSION = '\''[.\-\w\d]+'\''|VERSION = '\''{{ version }}'\''|' lib/Stripe.php


PHPDOCUMENTOR_VERSION := "v3.0.0"
# generates docs; currently broken? can unhide if working
[private]
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
Loading

0 comments on commit 6904039

Please sign in to comment.