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