|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + schedule: |
| 7 | + - cron: '0 0 * * *' |
| 8 | + |
| 9 | +env: |
| 10 | + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
| 11 | + |
| 12 | +jobs: |
| 13 | + security: |
| 14 | + name: Security |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + php: [ '8.1' ] # Note: This workflow requires only the LATEST version of PHP |
| 21 | + os: [ ubuntu-latest ] |
| 22 | + |
| 23 | + steps: # General Steps |
| 24 | + - name: Set Git To Use LF |
| 25 | + run: | |
| 26 | + git config --global core.autocrlf false |
| 27 | + git config --global core.eol lf |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v2 |
| 30 | + |
| 31 | + # Install PHP Dependencies |
| 32 | + - name: Setup PHP ${{ matrix.php }} |
| 33 | + uses: shivammathur/setup-php@v2 |
| 34 | + with: |
| 35 | + php-version: ${{ matrix.php }} |
| 36 | + - name: Validate Composer |
| 37 | + run: composer validate |
| 38 | + - name: Get Composer Cache Directory |
| 39 | + # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> |
| 40 | + id: composer-cache |
| 41 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 42 | + - name: Restore Composer Cache |
| 43 | + uses: actions/cache@v1 |
| 44 | + with: |
| 45 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 46 | + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
| 47 | + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- |
| 48 | + - name: Install Dependencies |
| 49 | + uses: nick-invision/retry@v1 |
| 50 | + with: |
| 51 | + timeout_minutes: 5 |
| 52 | + max_attempts: 5 |
| 53 | + command: composer update --prefer-dist --no-interaction --no-progress |
| 54 | + |
| 55 | + # Execution |
| 56 | + - name: Security Advisories |
| 57 | + run: composer require --dev roave/security-advisories:dev-latest |
| 58 | + |
| 59 | + psalm: |
| 60 | + name: Psalm |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + php: [ '8.1' ] # Note: This workflow requires only the LATEST version of PHP |
| 67 | + os: [ ubuntu-latest ] |
| 68 | + |
| 69 | + steps: # General Steps |
| 70 | + - name: Set Git To Use LF |
| 71 | + run: | |
| 72 | + git config --global core.autocrlf false |
| 73 | + git config --global core.eol lf |
| 74 | + - name: Checkout |
| 75 | + uses: actions/checkout@v2 |
| 76 | + |
| 77 | + # Install PHP Dependencies |
| 78 | + - name: Setup PHP ${{ matrix.php }} |
| 79 | + uses: shivammathur/setup-php@v2 |
| 80 | + with: |
| 81 | + php-version: ${{ matrix.php }} |
| 82 | + - name: Validate Composer |
| 83 | + run: composer validate |
| 84 | + - name: Get Composer Cache Directory |
| 85 | + # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> |
| 86 | + id: composer-cache |
| 87 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 88 | + - name: Restore Composer Cache |
| 89 | + uses: actions/cache@v1 |
| 90 | + with: |
| 91 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 92 | + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
| 93 | + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- |
| 94 | + - name: Install Dependencies |
| 95 | + uses: nick-invision/retry@v1 |
| 96 | + with: |
| 97 | + timeout_minutes: 5 |
| 98 | + max_attempts: 5 |
| 99 | + command: composer update --prefer-dist --no-interaction --no-progress |
| 100 | + |
| 101 | + # Execution |
| 102 | + - name: Static Analysis |
| 103 | + continue-on-error: true |
| 104 | + run: vendor/bin/psalm --no-cache |
| 105 | + |
| 106 | + unit-tests: |
| 107 | + name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }}) |
| 108 | + runs-on: ${{ matrix.os }} |
| 109 | + |
| 110 | + strategy: |
| 111 | + fail-fast: false |
| 112 | + matrix: |
| 113 | + php: [ '8.1' ] |
| 114 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 115 | + stability: [ prefer-lowest, prefer-stable ] |
| 116 | + |
| 117 | + steps: # General Steps |
| 118 | + - name: Set Git To Use LF |
| 119 | + run: | |
| 120 | + git config --global core.autocrlf false |
| 121 | + git config --global core.eol lf |
| 122 | + - name: Checkout |
| 123 | + uses: actions/checkout@v2 |
| 124 | + |
| 125 | + # Install PHP Dependencies |
| 126 | + - name: Setup PHP ${{ matrix.php }} |
| 127 | + uses: shivammathur/setup-php@v2 |
| 128 | + with: |
| 129 | + php-version: ${{ matrix.php }} |
| 130 | + # PHP Extras |
| 131 | + coverage: pcov |
| 132 | + tools: pecl |
| 133 | + ini-values: "memory_limit=-1" |
| 134 | + extensions: phar, ffi |
| 135 | + - name: Validate Composer |
| 136 | + run: composer validate |
| 137 | + - name: Get Composer Cache Directory |
| 138 | + # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> |
| 139 | + id: composer-cache |
| 140 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 141 | + - name: Restore Composer Cache |
| 142 | + uses: actions/cache@v1 |
| 143 | + with: |
| 144 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 145 | + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
| 146 | + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- |
| 147 | + - name: Install Dependencies |
| 148 | + uses: nick-invision/retry@v1 |
| 149 | + with: |
| 150 | + timeout_minutes: 5 |
| 151 | + max_attempts: 5 |
| 152 | + command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress |
| 153 | + |
| 154 | + # Execution |
| 155 | + - name: Execute Tests |
| 156 | + run: vendor/bin/phpunit --testdox --verbose |
0 commit comments