Update openapi.json from web frontend workflow 2026-05-20T11:08:24Z #311
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: phpList Web Frontend Build | |
| on: [push, pull_request] | |
| jobs: | |
| main: | |
| name: phpList Base Dist on PHP ${{ matrix.php-versions }}, with dist ${{ matrix.dependencies }} [Build, Test] | |
| runs-on: ubuntu-22.04 | |
| env: | |
| DB_DATABASE: phplist | |
| DB_USERNAME: root | |
| DB_PASSWORD: phplist | |
| BROADCAST_DRIVER: log | |
| API_BASE_URL: http://api.phplist.local/ | |
| REST_API_BASE_URL: http://api.phplist.local/api/v2 | |
| services: | |
| mysql: | |
| image: mysql:5.7 | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: false | |
| MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }} | |
| MYSQL_DATABASE: ${{ env.DB_DATABASE }} | |
| ports: | |
| - 3306/tcp | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-versions: ['8.1'] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup PHP, with composer and extensions | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| extensions: mbstring, dom, fileinfo, mysql | |
| coverage: xdebug | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| - name: Install JS dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build frontend assets | |
| run: yarn encore dev | |
| - name: Install Symfony CLI | |
| run: | | |
| curl -sS https://get.symfony.com/cli/installer | bash | |
| mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony | |
| symfony version | |
| - name: Install Google Chrome | |
| run: | | |
| curl -sSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor | sudo tee /usr/share/keyrings/google.gpg > /dev/null | |
| echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list | |
| sudo apt-get update | |
| sudo apt-get install -y google-chrome-stable | |
| sudo apt install socat | |
| - name: Verify MySQL connection on host | |
| run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install PHP dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Set up database schema | |
| run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < vendor/phplist/core/resources/Database/Schema.sql | |
| - name: Validate composer.json | |
| run: composer validate --no-check-all --no-check-lock --strict | |
| - name: Lint PHP files | |
| run: find src/ tests/ public/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l | |
| - name: Run static analysis | |
| run: vendor/bin/phpstan analyse -l 5 src/ tests/ | |
| - name: Run PHPMD | |
| run: vendor/bin/phpmd src/ text vendor/phplist/core/config/PHPMD/rules.xml | |
| - name: Run PHP_CodeSniffer | |
| run: vendor/bin/phpcs --standard=vendor/phplist/core/config/PhpCodeSniffer/ src/ tests/ | |
| - name: Install Prism | |
| run: npm install -g @stoplight/prism-cli | |
| - name: Start Prism Mock Server | |
| run: | | |
| prism mock --host 127.0.0.1 --port 4010 ./openapi.json & | |
| - name: Add local hostname | |
| run: echo "127.0.0.1 api.phplist.local" | sudo tee -a /etc/hosts | |
| - name: Proxy port 80 to 4010 | |
| run: | | |
| sudo socat -d -d TCP-LISTEN:80,reuseaddr,fork TCP:127.0.0.1:4010 & | |
| - name: Wait for Prism and proxy | |
| run: | | |
| set -euo pipefail | |
| prism_ready=0 | |
| for i in $(seq 1 30); do | |
| if curl -sS -o /tmp/prism-health-body.txt -w "%{http_code}" \ | |
| -H 'Content-Type: application/json' \ | |
| -X POST http://127.0.0.1:4010/api/v2/sessions \ | |
| --data '{"login_name":"healthcheck","password":"healthcheck"}' > /tmp/prism-health-code.txt; then | |
| code=$(cat /tmp/prism-health-code.txt) | |
| if [ "$code" != "000" ]; then | |
| echo "Prism is reachable on 127.0.0.1:4010 with HTTP ${code}" | |
| prism_ready=1 | |
| break | |
| fi | |
| fi | |
| sleep 1 | |
| done | |
| if [ "$prism_ready" -ne 1 ]; then | |
| echo "Prism did not become reachable in time." | |
| exit 1 | |
| fi | |
| proxy_ready=0 | |
| for i in $(seq 1 30); do | |
| if curl -sS -o /tmp/proxy-health-body.txt -w "%{http_code}" \ | |
| -H 'Content-Type: application/json' \ | |
| -X POST http://api.phplist.local/api/v2/sessions \ | |
| --data '{"login_name":"healthcheck","password":"healthcheck"}' > /tmp/proxy-health-code.txt; then | |
| code=$(cat /tmp/proxy-health-code.txt) | |
| if [ "$code" != "000" ]; then | |
| echo "Proxy is reachable on api.phplist.local with HTTP ${code}" | |
| proxy_ready=1 | |
| break | |
| fi | |
| fi | |
| sleep 1 | |
| done | |
| if [ "$proxy_ready" -ne 1 ]; then | |
| echo "Proxy did not become reachable in time." | |
| exit 1 | |
| fi | |
| - name: Run tests with phpunit | |
| run: vendor/bin/phpunit tests | |
| - name: Upload Panther screenshots | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: panther-screenshots | |
| path: var/screenshots |