Refresh README for current functionality (#15) #17
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.3", "8.4"] | |
| db: ["mysql", "postgres"] | |
| services: | |
| mysql: | |
| image: mariadb:10.11 | |
| ports: | |
| - "3306:3306" | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: "1" | |
| postgres: | |
| image: postgres:16 | |
| ports: | |
| - "5432:5432" | |
| env: | |
| POSTGRES_DB: categorytest | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: pdo, pdo_mysql, pdo_pgsql | |
| - name: Install dependencies | |
| run: composer install --no-interaction --no-progress | |
| - name: Static analysis | |
| run: vendor/bin/phpstan analyse -c phpstan.neon | |
| - name: Format check | |
| run: vendor/bin/php-cs-fixer fix --dry-run --diff | |
| - name: Configure DB env | |
| run: | | |
| if [ "${{ matrix.db }}" = "mysql" ]; then | |
| echo "MODEL_ORM_TEST_DSN=mysql:host=127.0.0.1;port=3306" >> "$GITHUB_ENV" | |
| echo "MODEL_ORM_TEST_USER=root" >> "$GITHUB_ENV" | |
| echo "MODEL_ORM_TEST_PASS=" >> "$GITHUB_ENV" | |
| else | |
| echo "MODEL_ORM_TEST_DSN=pgsql:host=127.0.0.1;port=5432;dbname=categorytest" >> "$GITHUB_ENV" | |
| echo "MODEL_ORM_TEST_USER=postgres" >> "$GITHUB_ENV" | |
| echo "MODEL_ORM_TEST_PASS=postgres" >> "$GITHUB_ENV" | |
| fi | |
| - name: Wait for database | |
| run: | | |
| if [ "${{ matrix.db }}" = "mysql" ]; then | |
| for i in {1..30}; do | |
| nc -z 127.0.0.1 3306 && break | |
| sleep 1 | |
| done | |
| else | |
| for i in {1..30}; do | |
| nc -z 127.0.0.1 5432 && break | |
| sleep 1 | |
| done | |
| fi | |
| - name: Run tests | |
| run: vendor/bin/phpunit -c phpunit.xml.dist |