Update ci.yml #50
This file contains 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
on: push | |
name: tests | |
jobs: | |
linux_tests: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
services: | |
memcached: | |
image: memcached:1.6-alpine | |
ports: | |
- 11211:11211 | |
mysql: | |
image: mysql:8.4 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: forge | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
strategy: | |
fail-fast: true | |
matrix: | |
php: ['8.2', '8.3'] | |
stability: [prefer-lowest, prefer-stable] | |
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} | |
steps: | |
- name: Verify unittest DB exists | |
run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -e "SHOW DATABASES LIKE 'forge'" | |
- name: Show MySQL Database | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
run: | | |
mysql --host $DB_HOST --port $DB_PORT -uroot -e "SHOW DATABASES" | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, memcached, pcov | |
ini-values: error_reporting=E_ALL | |
tools: composer:v2 | |
coverage: pcov | |
- name: Set Minimum PHP 8.2 Versions | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer require guzzlehttp/guzzle:^7.9 --no-interaction --no-update | |
if: matrix.php >= 8.2 | |
# - name: Set Minimum PHP 8.1 Versions | |
# uses: nick-fields/retry@v2 | |
# with: | |
# timeout_minutes: 5 | |
# max_attempts: 5 | |
# command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 --no-interaction --no-update | |
# if: matrix.php >= 8.1 | |
- name: Install dependencies | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress | |
- name: Execute tests | |
run: vendor/bin/phpunit --coverage-clover './clover.xml' | |
env: | |
DB_CONNECTION: testing | |
DB_HOST: 127.0.0.1 | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
DB_USERNAME: root | |
DB_PASSWORD: "" | |
DB_DATABASE: forge | |
- name: Upload coverage to Codecov | |
if: ${{ matrix.stability == 'prefer-stable' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: . | |
fail_ci_if_error: true | |
files: ./clover.xml | |
name: codecov-umbrella | |
path_to_write_report: ./codecov_report.txt | |
verbose: true | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs | |
path: | | |
./codecov_report.txt | |
vendor/orchestra/testbench-core/laravel/storage/logs | |
!vendor/**/.gitignore | |