Fixed Quickstarts. #1186
This file contains hidden or 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
| name: Symfony quickstart | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 6 * * * | |
| defaults: | |
| run: | |
| working-directory: Symfony quickstart | |
| jobs: | |
| Symfony-quickstart: | |
| runs-on: ubuntu-latest | |
| env: | |
| php: 8.2 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup PHP ${{ env.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php }} | |
| - name: Create working directory | |
| run: mkdir --verbose "$GITHUB_WORKFLOW" | |
| working-directory: | |
| - name: Create Symfony project | |
| run: composer create-project symfony/skeleton . ^5 | |
| - name: Require IANA | |
| run: composer require --with-dependencies provider/iana | |
| - name: Require Doctrine annotations | |
| run: composer require doctrine/annotations ^1 | |
| - name: Add Porter services | |
| run: | | |
| cat <<'.' >>config/services.yaml | |
| ScriptFUSION\Porter\Porter: | |
| arguments: | |
| - '@providers' | |
| providers: | |
| class: Symfony\Component\DependencyInjection\ServiceLocator | |
| arguments: | |
| - | |
| - '@ScriptFUSION\Porter\Provider\Iana\Provider\IanaProvider' | |
| ScriptFUSION\Porter\Provider\Iana\Provider\IanaProvider: | |
| . | |
| - name: Add AppListAction | |
| run: | | |
| cat <<'.' | >src/Controller/AppListAction.php sed 's/ *//' | |
| <?php | |
| declare(strict_types=1); | |
| namespace App\Controller; | |
| use ScriptFUSION\Porter\Import\Import; | |
| use ScriptFUSION\Porter\Porter; | |
| use ScriptFUSION\Porter\Provider\Iana\Provider\Resource\IanaPortNumbers; | |
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
| use Symfony\Component\HttpFoundation\Response; | |
| use Symfony\Component\HttpFoundation\StreamedResponse; | |
| use Symfony\Component\Routing\Annotation\Route; | |
| final class AppListAction extends AbstractController | |
| { | |
| #[Route('/')] | |
| public function __invoke(Porter $porter): Response | |
| { | |
| return new StreamedResponse( | |
| function () use ($porter): void { | |
| foreach ($porter->import(new Import(new IanaPortNumbers())) as $port) { | |
| if ($port['Port Number'] === '') { | |
| continue; | |
| } | |
| echo "{$port['Port Number']}:{$port['Transport Protocol']}\n"; | |
| } | |
| }, | |
| headers: ['content-type' => 'text/plain'], | |
| ); | |
| } | |
| } | |
| . | |
| - name: Start web server | |
| run: sudo php -S localhost:80 public/index.php & | |
| - name: Download home page | |
| run: curl localhost | tee out | |
| - name: Test output contains over 13k lines | |
| run: | | |
| echo Lines: ${lines=$(wc --lines <out)} | |
| ((lines > 13000)) |