Merge pull request #20 from liberusoftware/copilot/update-registered-… #42
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: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: mbstring, bcmath, pdo, mysql, dom, curl | |
| 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@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Start database | |
| run: sudo /etc/init.d/mysql start | |
| - name: Create database | |
| run: mysql -e "CREATE DATABASE IF NOT EXISTS liberu;" -uroot -proot | |
| - name: Copy environment file | |
| run: cp .env.testing .env | |
| - name: Install dependencies | |
| run: composer install --no-progress --prefer-dist --with-all-dependencies | |
| - name: Generate application key | |
| run: php artisan key:generate | |
| - name: Optimize Laravel | |
| run: | | |
| php artisan config:clear | |
| php artisan cache:clear | |
| php artisan route:clear | |
| php artisan config:cache | |
| - name: Run database migrations | |
| run: php artisan migrate --force | |
| - name: Seed database | |
| run: php artisan db:seed | |
| - name: Run tests | |
| run: vendor/bin/pest --coverage --coverage-clover=coverage.xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: true |