Skip to content

Commit

Permalink
Improve the way of testing (#349)
Browse files Browse the repository at this point in the history
* Disable caching for php packages

* Future testing for php 8.2 as experimental

* Overall improvements on the test

* Remove quite flag from composer install
  • Loading branch information
klaasnicolaas authored Sep 28, 2022
1 parent 2794606 commit ceec128
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/phpunit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=3
env:
FOLDER: ./laravel
continue-on-error: ${{ matrix.php-versions == '8.2' }}
strategy:
fail-fast: false
fail-fast: true
matrix:
operating-system: [ ubuntu-latest ]
php-versions: ['8.0', '8.1', '8.2']

laravel: [ '8.*', '9.*' ]
include:
- laravel: 9.*
Expand All @@ -52,6 +52,11 @@ jobs:
with:
node-version: '16.x'

- name: Show PHP and NPM version
run: |
npm --version
php --version
- name: Cache node_modules directory
uses: actions/cache@v3
id: node_modules-cache
Expand Down Expand Up @@ -88,12 +93,12 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Cache PHP dependencies
uses: actions/cache@v3
id: vendor-cache
with:
path: "${{env.FOLDER}}/vendor"
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
# - name: Cache PHP dependencies
# uses: actions/cache@v3
# id: vendor-cache
# with:
# path: "${{env.FOLDER}}/vendor"
# key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}

- name: Copy ENV Laravel Configuration for CI
working-directory: ${{env.FOLDER}}
Expand All @@ -103,7 +108,7 @@ jobs:
- name: Install Laravel Dependencies
working-directory: ${{env.FOLDER}}
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Show files in folder
working-directory: ${{env.FOLDER}}
Expand All @@ -125,21 +130,18 @@ jobs:
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USER: laravel_user
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: php artisan migrate

- name: PHP Version
run: php --version

- name: Execute tests (Unit and Feature tests) via PHPUnit
working-directory: ${{env.FOLDER}}
# Set environment
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USER: laravel_user
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: vendor/bin/phpunit --testdox

0 comments on commit ceec128

Please sign in to comment.