Merge pull request #163 from Hi-Folks/upgrade/larastan-gh-actions #5
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: hi-folks/ghygen | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- features/** | |
- upgrade/** | |
jobs: | |
laravel-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
operating-system: [ubuntu-latest] | |
php-versions: [ '8.2' ] | |
dependency-stability: [ 'prefer-none' ] | |
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install NPM packages | |
run: npm i | |
- name: Build frontend | |
run: npm run build | |
- name: Install PHP versions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Install Dependencies | |
if: steps.vendor-cache.outputs.cache-hit != 'true' | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Update Dependencies with latest stable | |
if: matrix.dependency-stability == 'prefer-stable' | |
run: composer update --prefer-stable | |
- name: Update Dependencies with lowest stable | |
if: matrix.dependency-stability == 'prefer-lowest' | |
run: composer update --prefer-stable --prefer-lowest | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Run Migrations | |
# Set environment | |
env: | |
SESSION_DRIVER: array | |
DB_CONNECTION: sqlite | |
DB_DATABASE: ":memory:" | |
run: php artisan migrate | |
- name: Show dir | |
run: pwd | |
- name: PHP Version | |
run: php --version | |
# Code quality | |
- name: Execute tests (Unit and Feature tests) via PestPHP | |
# Set environment | |
env: | |
SESSION_DRIVER: array | |
DB_CONNECTION: sqlite | |
DB_DATABASE: ":memory:" | |
run: vendor/bin/pest | |
- name: Execute Code Static Analysis (PHP Stan + Larastan) | |
run: | | |
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress | |