Merge pull request #12 from lsnepomuceno/feature/update-tests #4
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
name: Laravel Brazilian Ceps | |
on: | |
push: | |
branches: [ main, dev ] | |
pull_request: | |
branches: [ main, dev ] | |
permissions: | |
contents: read | |
jobs: | |
run: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest ] | |
php-versions: [ '8.1', '8.2', '8.3' ] | |
laravel: [ '10.*','9.*' ] | |
include: | |
- laravel: 10.* | |
testbench: 8.* | |
- laravel: 9.* | |
testbench: 7.* | |
env: | |
extensions: mbstring, dom, fileinfo, openssl, json, imagick, swoole, sqlite3 | |
key: cache-v5 | |
name: PHP ${{ matrix.php-versions }} - Laravel ${{ matrix.laravel }} - ${{ matrix.operating-system}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@develop | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Setup PHP with latest versions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
env: | |
update: true | |
- name: Install Laravel Dependencies | |
run: | | |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | |
composer update --prefer-dist --no-interaction --no-suggest | |
- name: Testing PHP version | |
run: | | |
php -v | |
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}" | |
- name: Testing Composer version | |
run: | | |
composer -V | |
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}" | |
- name: Validate composer.json and composer.lock | |
run: | | |
composer validate | |
- name: Install dependencies | |
run: | | |
composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Execute tests | |
run: | | |
vendor/bin/testbench package:test |