tests #363
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: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [7.4, 8.0, 8.1, 8.2, 8.3] | |
| stability: [prefer-stable] | |
| name: PHP ${{ matrix.php }} - ${{ matrix.stability }} | |
| services: | |
| mysql: | |
| image: mysql:8 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: eav | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1 -u root --password=root" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pdo, pdo_mysql | |
| coverage: pcov | |
| - name: Install dependencies | |
| run: | |
| composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress | |
| - name: Wait for MySQL | |
| run: | | |
| until mysqladmin ping -h127.0.0.1 -uroot -proot --silent; do | |
| echo "Waiting for MySQL..." | |
| sleep 2 | |
| done | |
| - name: Import Database Schema & Data | |
| run: | | |
| mysql -h 127.0.0.1 -u root -proot eav < schema.sql | |
| - name: Install Scrutinizer/Ocular | |
| run: | |
| composer global require scrutinizer/ocular | |
| - name: Execute tests | |
| run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover | |
| - name: Code coverage | |
| if: ${{ github.ref == 'refs/heads/master' && github.repository == 'drobotik/eav' }} | |
| run: | |
| ~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover |