Skip to content

Commit

Permalink
Merge pull request #86 from cybex-gmbh/refactor/test-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mszulik committed Apr 22, 2024
2 parents f503d97 + bb2c466 commit d4410cd
Showing 1 changed file with 9 additions and 45 deletions.
54 changes: 9 additions & 45 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,18 @@ on:
workflow_dispatch:

jobs:
linux_tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: protector_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
execute-tests:
name: Setup testing environment and execute tests
uses: cybex-gmbh/github-workflows/.github/workflows/tests.yml@main
strategy:
fail-fast: true
matrix:
php: [ 8.2, 8.3 ]
laravel: [ 11.* ]
dependency-version: [ prefer-stable ]

name: PHP ${{ matrix.php }} with Laravel ${{ matrix.laravel }} (${{ matrix.dependency-version }})

steps:
- 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
tools: composer:v2
coverage: none

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

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update --dev --no-progress
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit -c phpunit-ci.xml.dist
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
with:
PHP_VERSION: ${{ matrix.php }}
LARAVEL_VERSION: ${{ matrix.laravel }}
DEPENDENCY_VERSION: ${{ matrix.dependency-version }}
MYSQL_DATABASE: protector_test
TEST_COMMANDS: vendor/bin/phpunit -c phpunit-ci.xml.dist

0 comments on commit d4410cd

Please sign in to comment.