ci: add GitHub Actions workflow for tests and code style

This commit is contained in:
Wallace Martins
2025-12-08 07:18:10 -03:00
parent 92c66c4b55
commit 55ef141f93
13 changed files with 177 additions and 94 deletions

71
.github/workflows/tests.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: Tests
on:
push:
branches: [dev, v1, main]
pull_request:
branches: [dev, v1, main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.2, 8.3, 8.4]
laravel: [11.*, 12.*]
stability: [prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
coverage: none
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit --testdox
code-style:
runs-on: ubuntu-latest
name: Code Style
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip
coverage: none
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Check code style
run: vendor/bin/pint --test