Skip to content

Commit

Permalink
Update tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MohmmedAshraf committed Feb 28, 2024
1 parent 69ec487 commit f6ebc3d
Showing 1 changed file with 28 additions and 42 deletions.
70 changes: 28 additions & 42 deletions .github/workflows/tests.yml
@@ -1,65 +1,51 @@
name: Tests
name: run-tests

on:
- push
- pull_request

jobs:
tests:
runs-on: ubuntu-latest

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1, 8.0, 7.4]
laravel: ['8.*', '9.*', '10.*', '11.*']
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: ^6.23
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: ^9.0
exclude:
- laravel: 9.*
php: 7.4
- laravel: 10.*
php: 7.4
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 7.4
os: [ ubuntu-latest ]
php: [ 8.0, 8.1, 8.2 ]
stability: [ prefer-stable ]

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
coverage: none

- name: Install dependencies
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Validate Composer
run: composer validate

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Restore Composer Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.stability }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.stability }}-composer

- name: Install Dependencies
uses: nick-invision/retry@v2.8.3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit

0 comments on commit f6ebc3d

Please sign in to comment.