|
| 1 | +name: PHPUnit Tests |
| 2 | +on: [push] |
| 3 | +jobs: |
| 4 | + phpunit: |
| 5 | + runs-on: ubuntu-latest |
| 6 | + strategy: |
| 7 | + matrix: |
| 8 | + php-versions: ['7.3', '7.4'] |
| 9 | + prefer-lowest: ['','--prefer-lowest'] |
| 10 | + name: PHP ${{ matrix.php-versions }} ${{ matrix.prefer-lowest }} |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v2 |
| 14 | + |
| 15 | + - name: Setup PHP |
| 16 | + uses: shivammathur/setup-php@v2 |
| 17 | + with: |
| 18 | + php-version: ${{ matrix.php-versions }} |
| 19 | + extensions: gd |
| 20 | + coverage: pcov |
| 21 | + env: |
| 22 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + |
| 24 | + - name: Get composer cache directory |
| 25 | + id: composer-cache |
| 26 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 27 | + |
| 28 | + - name: Cache dependencies |
| 29 | + uses: actions/cache@v2 |
| 30 | + with: |
| 31 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 32 | + key: ${{ runner.os }}-${{ matrix.php-version }}${{ matrix.prefer-lowest }}-composer-${{ hashFiles('**/composer.json') }} |
| 33 | + restore-keys: ${{ runner.os }}-${{ matrix.php-version }}${{ matrix.prefer-lowest }}-composer- |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + run: composer update --prefer-dist ${{ matrix.prefer-lowest }} |
| 37 | + env: |
| 38 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + |
| 40 | + - name: Run phpunit |
| 41 | + run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml -v |
| 42 | + env: |
| 43 | + S3_KEY: ${{ secrets.S3_KEY }} |
| 44 | + S3_SECRET: ${{ secrets.S3_SECRET }} |
| 45 | + S3_REGION: ${{ secrets.S3_REGION }} |
| 46 | + S3_BUCKET: ${{ secrets.S3_BUCKET }} |
| 47 | + |
| 48 | + - name: Upload coverage results to Coveralls |
| 49 | + env: |
| 50 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + COVERALLS_PARALLEL: true |
| 52 | + COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} ${{ matrix.prefer-lowest }} |
| 53 | + run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml |
| 54 | + |
| 55 | + finish-coverage: |
| 56 | + needs: phpunit |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - name: Coveralls Finished |
| 60 | + uses: coverallsapp/github-action@master |
| 61 | + with: |
| 62 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + parallel-finished: true |
0 commit comments