tests: runtime error for debugging #43
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: Tests | |
| on: [push, pull_request, workflow_dispatch] | |
| jobs: | |
| tests-mysql: | |
| name: Tests (PHP ${{ matrix.php }}, MySQL) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3', '8.4'] | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_DATABASE: test | |
| MYSQL_USER: arca_user | |
| MYSQL_PASSWORD: arca_pass | |
| MYSQL_ROOT_PASSWORD: root_pass | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: test | |
| DB_USERNAME: arca_user | |
| DB_PASSWORD: arca_pass | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, bcmath, soap, intl, gd, exif, iconv | |
| coverage: xdebug | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - 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 Composer dependencies | |
| run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
| - name: Wait for MySQL | |
| run: | | |
| until mysqladmin ping -h 127.0.0.1 -P 3306 -u arca_user -parca_pass --silent; do | |
| echo 'Waiting for MySQL...' | |
| sleep 2 | |
| done | |
| - name: Create MySQL database | |
| run: | | |
| mysql -h 127.0.0.1 -P 3306 -u arca_user -parca_pass -e "CREATE DATABASE IF NOT EXISTS test;" | |
| - name: Run Tests | |
| run: vendor/bin/pest --coverage-clover=coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.php == '8.3' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: mysql | |
| tests-postgresql: | |
| name: Tests (PHP ${{ matrix.php }}, PostgreSQL) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3', '8.4'] | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_DB: test | |
| POSTGRES_USER: arca_user | |
| POSTGRES_PASSWORD: arca_pass | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd="pg_isready -U arca_user -d test" --health-interval=10s --health-timeout=5s --health-retries=5 | |
| env: | |
| DB_CONNECTION: pgsql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 5432 | |
| DB_DATABASE: test | |
| DB_USERNAME: arca_user | |
| DB_PASSWORD: arca_pass | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, bcmath, soap, intl, gd, exif, iconv | |
| coverage: xdebug | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - 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 Composer dependencies | |
| run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
| - name: Wait for PostgreSQL | |
| run: | | |
| until pg_isready -h 127.0.0.1 -p 5432 -U arca_user; do | |
| echo 'Waiting for PostgreSQL...' | |
| sleep 2 | |
| done | |
| - name: Create PostgreSQL database | |
| run: | | |
| PGPASSWORD=arca_pass createdb -h 127.0.0.1 -p 5432 -U arca_user test || echo "Database already exists" | |
| - name: Run Tests | |
| run: vendor/bin/pest --coverage-clover=coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.php == '8.3' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: postgresql | |
| tests-sqlite: | |
| name: Tests (PHP ${{ matrix.php }}, SQLite) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3', '8.4'] | |
| env: | |
| DB_CONNECTION: sqlite | |
| DB_DATABASE: ":memory:" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | |
| coverage: xdebug | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - 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 Composer dependencies | |
| run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
| - name: Run Tests | |
| run: vendor/bin/pest --coverage-clover=coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.php == '8.3' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: sqlite | |
| static-analysis: | |
| name: Static Analysis (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3', '8.4'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, soap, intl, gd, exif, iconv | |
| coverage: none | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - 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 Composer dependencies | |
| run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
| - name: Run PHPStan | |
| run: vendor/bin/phpstan analyse src --level 8 |