|
| 1 | +# GithHub Actions Workflow generated with Ghygen |
| 2 | +# Original configuration: https://ghygen.hi-folks.dev?code=5eeae8ee67de18c6bb0ec00188b0c617 |
| 3 | +name: Laravel Git Hooks |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - main |
| 9 | + - develop |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + - develop |
| 14 | + |
| 15 | +jobs: |
| 16 | + laravel-tests: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + operating-system: [ ubuntu-latest ] |
| 22 | + php-versions: [ '8.1','8.0','7.4' ] |
| 23 | + dependency-stability: [ 'prefer-none' ] |
| 24 | + |
| 25 | + laravel: [ '10.*' ] |
| 26 | + include: |
| 27 | + - laravel: 10.* |
| 28 | + testbench: 8.* |
| 29 | + |
| 30 | + name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}} |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + - name: Setup Node.js |
| 35 | + uses: actions/setup-node@v3 |
| 36 | + with: |
| 37 | + node-version: '19.x' |
| 38 | + - name: Cache node_modules directory |
| 39 | + uses: actions/cache@v3 |
| 40 | + id: node_modules-cache |
| 41 | + with: |
| 42 | + path: node_modules |
| 43 | + key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }} |
| 44 | + - name: Install NPM packages |
| 45 | + if: steps.node_modules-cache.outputs.cache-hit != 'true' |
| 46 | + run: npm ci |
| 47 | + - name: Build frontend |
| 48 | + run: npm run development |
| 49 | + - name: Install PHP versions |
| 50 | + uses: shivammathur/setup-php@v2 |
| 51 | + with: |
| 52 | + php-version: ${{ matrix.php-versions }} |
| 53 | + - name: Get Composer Cache Directory 2 |
| 54 | + id: composer-cache |
| 55 | + run: | |
| 56 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 57 | + - uses: actions/cache@v3 |
| 58 | + id: actions-cache |
| 59 | + with: |
| 60 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 61 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 62 | + restore-keys: | |
| 63 | + ${{ runner.os }}-composer- |
| 64 | + - name: Cache PHP dependencies |
| 65 | + uses: actions/cache@v3 |
| 66 | + id: vendor-cache |
| 67 | + with: |
| 68 | + path: vendor |
| 69 | + key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} |
| 70 | + - name: Install Laravel Dependencies |
| 71 | + run: | |
| 72 | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update |
| 73 | + composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest |
| 74 | +
|
| 75 | + - name: Update Dependencies with latest stable |
| 76 | + if: matrix.dependency-stability == 'prefer-stable' |
| 77 | + run: composer update --prefer-stable |
| 78 | + - name: Update Dependencies with lowest stable |
| 79 | + if: matrix.dependency-stability == 'prefer-lowest' |
| 80 | + run: composer update --prefer-stable --prefer-lowest |
| 81 | + |
| 82 | + |
| 83 | + - name: Show dir |
| 84 | + run: pwd |
| 85 | + - name: PHP Version |
| 86 | + run: php --version |
| 87 | + |
| 88 | + # Code quality |
| 89 | + |
| 90 | + - name: Execute tests (Unit and Feature tests) via PestPHP |
| 91 | + # Set environment |
| 92 | + env: |
| 93 | + SESSION_DRIVER: array |
| 94 | + |
| 95 | + run: vendor/bin/pest |
| 96 | + |
| 97 | + |
| 98 | + - name: Execute Code Sniffer via Laravel Pint |
| 99 | + run: vendor/bin/pint --test src config |
0 commit comments