@@ -163,15 +163,86 @@ If you want to install our previous handwritten version, run:
163163
164164` composer require seamapi/seam:1.1 `
165165
166- ## Development Setup
166+ ## Development and Testing
167167
168- 1 . Run ` yarn install ` to get prettier installed for formatting
169- 2 . Install [ composer] ( https://getcomposer.org/ ) .
170- 3 . Run ` composer install ` in this directory
171- 4 . Run ` composer exec phpunit tests `
168+ ### Quickstart
172169
173- > To run a specific test file, do ` composer exec phpunit tests/MyTest.php `
170+ Install [ PHP] ( https://www.php.net/ ) 8.0 or later,
171+ [ Composer] ( https://getcomposer.org/ ) and [ Node.js] ( https://nodejs.org/ ) ,
172+ then run
173+
174+ ```
175+ $ git clone git@github.com:seamapi/php.git
176+ $ cd php
177+ $ composer install
178+ $ npm install
179+ ```
180+
181+ Primary development tasks are defined as [ Composer scripts] ( https://getcomposer.org/doc/articles/scripts.md )
182+ in ` composer.json ` and available via ` composer ` .
183+ View them with
184+
185+ ```
186+ $ composer run-script --list
187+ ```
188+
189+ | Task | Command |
190+ | ----------------- | ------------------ |
191+ | Run the tests | ` composer test ` |
192+ | Lint | ` composer lint ` |
193+ | Format | ` npm run format ` |
194+ | Build the package | ` composer build ` |
195+ | Generate the SDK | ` npm run generate ` |
196+
197+ Formatting is handled by [ Prettier] ( https://prettier.io/ ) via
198+ [ @prettier/plugin-php ] ( https://github.com/prettier/plugin-php ) ,
199+ so PHP, TypeScript, JSON, YAML and Markdown are all formatted by
200+ ` npm run format ` .
174201
175202### Running Tests
176203
177- You'll need to export ` SEAM_API_KEY ` to a sandbox workspace API key.
204+ Run the full suite with
205+
206+ ```
207+ $ composer test
208+ ```
209+
210+ To run a specific test file, pass it as an argument
211+
212+ ```
213+ $ composer test -- tests/MyTest.php
214+ ```
215+
216+ PHPUnit is configured in ` phpunit.xml.dist ` .
217+
218+ ### Requirements
219+
220+ This package supports PHP 8.0 and later.
221+ Continuous integration exercises the latest two releases, PHP 8.4 and 8.5.
222+
223+ ### Publishing
224+
225+ #### Automatic
226+
227+ New versions are released automatically from ` main ` by the
228+ [ Semantic Release] ( .github/workflows/semantic-release.yml ) workflow,
229+ which reads [ Conventional Commits] ( https://www.conventionalcommits.org/ )
230+ and dispatches the [ Version] ( .github/workflows/version.yml ) workflow.
231+
232+ #### Manual
233+
234+ Run the [ Version] ( .github/workflows/version.yml ) workflow with the
235+ version to cut.
236+ It runs ` npm version ` , which bumps the ` version ` field in ` package.json ` ,
237+ creates a signed ` v* ` git tag and pushes it.
238+ Pushing the tag triggers the [ Publish] ( .github/workflows/publish.yml )
239+ workflow, and [ Packagist] ( https://packagist.org/packages/seamapi/seam )
240+ picks up the new tag from its GitHub webhook.
241+
242+ > Composer has no canonical place to store a package version, since Packagist
243+ > derives it from the git tag.
244+ > This repository therefore keeps the version in ` package.json ` and lets
245+ > ` npm version ` manage the tag.
246+ > The SDK also reads that field at runtime via ` Seam\Utils\PackageVersion `
247+ > to set its ` seam-sdk-version ` header, so ` package.json ` must remain in the
248+ > published package.
0 commit comments