|
| 1 | +name: Tests |
| 2 | + |
| 3 | +# Run this workflow every time a new commit pushed to your repository |
| 4 | +on: |
| 5 | + push: |
| 6 | + paths-ignore: |
| 7 | + - '**/*.md' |
| 8 | + pull_request: |
| 9 | + paths-ignore: |
| 10 | + - '**/*.md' |
| 11 | + |
| 12 | +jobs: |
| 13 | + tests: |
| 14 | + runs-on: ${{ matrix.operating-system }} |
| 15 | + if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + operating-system: [ubuntu-20.04] |
| 21 | + php-versions: ['7.4', '8.0', '8.1'] |
| 22 | + dependencies: ['no', 'low', 'beta'] |
| 23 | + include: |
| 24 | + - operating-system: ubuntu-20.04 |
| 25 | + php-versions: '8.0' |
| 26 | + continue-on-error: true |
| 27 | + |
| 28 | + name: PHP ${{ matrix.php-versions }} - ${{ matrix.dependencies }} |
| 29 | + |
| 30 | + env: |
| 31 | + extensions: curl json libxml dom |
| 32 | + key: cache-v1 # can be any string, change to clear the extension cache. |
| 33 | + |
| 34 | + steps: |
| 35 | + |
| 36 | + # Checks out a copy of your repository on the ubuntu machine |
| 37 | + - name: Checkout code |
| 38 | + uses: actions/checkout@v2 |
| 39 | + |
| 40 | + - name: Setup cache environment |
| 41 | + id: extcache |
| 42 | + uses: shivammathur/cache-extensions@v1 |
| 43 | + with: |
| 44 | + php-version: ${{ matrix.php-versions }} |
| 45 | + extensions: ${{ env.extensions }} |
| 46 | + key: ${{ env.key }} |
| 47 | + |
| 48 | + - name: Cache PHP Extensions |
| 49 | + uses: actions/cache@v2 |
| 50 | + with: |
| 51 | + path: ${{ steps.extcache.outputs.dir }} |
| 52 | + key: ${{ steps.extcache.outputs.key }} |
| 53 | + restore-keys: ${{ steps.extcache.outputs.key }} |
| 54 | + |
| 55 | + - name: Cache Composer Dependencies |
| 56 | + uses: actions/cache@v1 |
| 57 | + with: |
| 58 | + path: ~/.composer/cache/files |
| 59 | + key: dependencies-composer-${{ hashFiles('composer.json') }} |
| 60 | + |
| 61 | + - name: Setup PHP Action |
| 62 | + uses: shivammathur/setup-php@2.8.0 |
| 63 | + with: |
| 64 | + php-version: ${{ matrix.php-versions }} |
| 65 | + extensions: ${{ env.extensions }} |
| 66 | + coverage: xdebug |
| 67 | + tools: pecl, composer |
| 68 | + |
| 69 | + - name: PHP Show modules |
| 70 | + run: php -m |
| 71 | + |
| 72 | + - name: Get composer cache directory |
| 73 | + id: composer-cache |
| 74 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 75 | + |
| 76 | + - name: Cache dependencies |
| 77 | + uses: actions/cache@v2 |
| 78 | + with: |
| 79 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 80 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 81 | + restore-keys: ${{ runner.os }}-composer- |
| 82 | + |
| 83 | + - name: Install Composer dependencies |
| 84 | + if: ${{ matrix.dependencies != 'low' }} |
| 85 | + run: composer update --no-interaction |
| 86 | + |
| 87 | + - name: Install Composer dependencies |
| 88 | + if: ${{ matrix.dependencies == 'low' }} |
| 89 | + run: composer update -vvv --prefer-lowest --prefer-stable --no-interaction |
| 90 | + |
| 91 | + - name: Validate files |
| 92 | + run: composer validate-files |
| 93 | + |
| 94 | + - name: Check Style |
| 95 | + run: composer check-code-style |
| 96 | + |
| 97 | + # - name: Run tests |
| 98 | + # run: composer run-tests |
0 commit comments