forked from symfony/ux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Symfony UX Turbo: content negotiation and Doctrine integration
Co-authored-by: Robin Chalas <[email protected]> Co-authored-by: Ryan Weaver <[email protected]> Co-authored-by: Nicolas Grekas <[email protected]>
- Loading branch information
1 parent
06521ce
commit 95d5f00
Showing
61 changed files
with
2,766 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
name: Symfony UX Turbo | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: zip | ||
|
||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
working-directory: src/Turbo | ||
run: composer install --prefer-dist | ||
|
||
- name: Install PHPUnit dependencies | ||
working-directory: src/Turbo | ||
run: vendor/bin/simple-phpunit --version | ||
|
||
- name: PHPStan | ||
working-directory: src/Turbo | ||
run: vendor/bin/phpstan analyse --no-progress | ||
|
||
tests-php-high-deps: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: ['7.2', '7.3', '7.4', '8.0'] | ||
fail-fast: false | ||
name: PHP ${{ matrix.php-versions }} Test on ubuntu-latest | ||
|
||
services: | ||
mercure: | ||
image: dunglas/mercure | ||
env: | ||
SERVER_NAME: :3000 | ||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeMe!' | ||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeMe!' | ||
MERCURE_EXTRA_DIRECTIVES: | | ||
anonymous | ||
cors_origins * | ||
ports: | ||
- 3000:3000 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: zip, pdo_sqlite | ||
|
||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache PHP dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install PHP dependencies | ||
working-directory: src/Turbo | ||
run: composer install --prefer-dist | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install JavaScript dependencies | ||
working-directory: src/Turbo/Tests/app | ||
run: yarn install | ||
|
||
- name: Build JavaScript | ||
working-directory: src/Turbo/Tests/app | ||
run: yarn build | ||
|
||
- name: Create DB | ||
working-directory: src/Turbo/Tests/app | ||
run: php public/index.php doctrine:schema:create | ||
|
||
- name: Run tests | ||
working-directory: src/Turbo | ||
env: | ||
SYMFONY_DEPRECATIONS_HELPER: max[direct]=0 | ||
run: vendor/bin/simple-phpunit | ||
|
||
tests-php-low-deps: | ||
runs-on: ubuntu-latest | ||
name: PHP 8.0 (lowest) Test on ubuntu-latest | ||
|
||
services: | ||
mercure: | ||
image: dunglas/mercure | ||
env: | ||
SERVER_NAME: :3000 | ||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeMe!' | ||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeMe!' | ||
MERCURE_EXTRA_DIRECTIVES: | | ||
anonymous | ||
cors_origins * | ||
ports: | ||
- 3000:3000 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: zip, pdo_sqlite | ||
|
||
- name: Get composer cache directory | ||
id: composercache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache PHP dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composercache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install PHP dependencies | ||
working-directory: src/Turbo | ||
run: composer update --prefer-dist --prefer-lowest --prefer-stable | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install JavaScript dependencies | ||
working-directory: src/Turbo/Tests/app | ||
run: yarn install | ||
|
||
- name: Build JavaScript | ||
working-directory: src/Turbo/Tests/app | ||
run: yarn build | ||
|
||
- name: Create DB | ||
working-directory: src/Turbo/Tests/app | ||
run: php public/index.php doctrine:schema:create | ||
|
||
- name: Run tests | ||
working-directory: src/Turbo | ||
env: | ||
SYMFONY_DEPRECATIONS_HELPER: max[total]=9223372036854775807 # PHP_INT_MAX | ||
run: vendor/bin/simple-phpunit |
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/Resources/assets/test export-ignore | ||
/Tests export-ignore |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/.php_cs.cache | ||
/.php_cs | ||
/.phpunit.result.cache | ||
/composer.phar | ||
/composer.lock | ||
/phpunit.xml | ||
/vendor/ | ||
/Tests/app/var | ||
/Tests/app/public/build/ | ||
node_modules/ | ||
package-lock.json | ||
yarn.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\UX\Turbo\Attribute; | ||
|
||
use Symfony\UX\Turbo\Bridge\Mercure\Broadcaster; | ||
|
||
/** | ||
* Marks the entity as broadcastable. | ||
* | ||
* @author Kévin Dunglas <[email protected]> | ||
* | ||
* @experimental | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_CLASS)] | ||
final class Broadcast | ||
{ | ||
public const ACTION_CREATE = 'create'; | ||
public const ACTION_UPDATE = 'update'; | ||
public const ACTION_REMOVE = 'remove'; | ||
|
||
/** | ||
* @var mixed[] | ||
*/ | ||
public array $options; | ||
|
||
/** | ||
* Options can be any option supported by the broadcaster. | ||
* | ||
* @see Broadcaster for the default options when using Mercure | ||
*/ | ||
public function __construct(mixed ...$options) | ||
{ | ||
$this->options = $options; | ||
} | ||
} |
Oops, something went wrong.