|
1 | | -name: build |
| 1 | +on: |
| 2 | + pull_request: |
| 3 | + paths-ignore: |
| 4 | + - 'docs/**' |
| 5 | + - 'README.md' |
| 6 | + - 'CHANGELOG.md' |
| 7 | + - '.gitignore' |
| 8 | + - '.gitattributes' |
| 9 | + - 'infection.json.dist' |
| 10 | + - 'psalm.xml' |
2 | 11 |
|
3 | | -on: [push, pull_request] |
| 12 | + push: |
| 13 | + paths-ignore: |
| 14 | + - 'docs/**' |
| 15 | + - 'README.md' |
| 16 | + - 'CHANGELOG.md' |
| 17 | + - '.gitignore' |
| 18 | + - '.gitattributes' |
| 19 | + - 'infection.json.dist' |
| 20 | + - 'psalm.xml' |
4 | 21 |
|
5 | | -env: |
6 | | - DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi" |
| 22 | +name: build |
7 | 23 |
|
8 | 24 | jobs: |
9 | | - phpunit: |
10 | | - name: PHP ${{ matrix.php }} (mongodb ${{ matrix.mongoext }}) on ${{ matrix.os }} |
11 | | - runs-on: ${{ matrix.os }} |
12 | | - services: |
13 | | - mongodb: |
14 | | - image: mongo:${{ matrix.mongo }} |
15 | | - ports: |
16 | | - - 27017:27017 |
17 | | - strategy: |
18 | | - fail-fast: false |
19 | | - matrix: |
20 | | - os: [ubuntu-latest] |
21 | | - php: ['7.4', '8.0', '8.1'] |
22 | | - mongo: ['4.0'] |
23 | | - mongoext: ['1.20.1'] |
24 | | - |
25 | | - steps: |
26 | | - - name: Checkout |
27 | | - uses: actions/checkout@v2 |
28 | | - - name: Install PHP |
29 | | - uses: shivammathur/setup-php@v2 |
30 | | - with: |
31 | | - php-version: ${{ matrix.php }} |
32 | | - tools: pecl |
33 | | - extensions: mongodb-${{ matrix.mongoext }} |
34 | | - ini-values: date.timezone='UTC' |
35 | | - - name: Get composer cache directory |
36 | | - id: composer-cache |
37 | | - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
38 | | - - name: Cache composer dependencies |
39 | | - uses: actions/cache@v1 |
40 | | - with: |
41 | | - path: ${{ steps.composer-cache.outputs.dir }} |
42 | | - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
43 | | - restore-keys: ${{ runner.os }}-composer- |
44 | | - - name: Install dependencies |
45 | | - run: composer update $DEFAULT_COMPOSER_FLAGS |
46 | | - - name: Run unit tests with coverage |
47 | | - run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --colors=always |
48 | | - if: matrix.php == '7.1' |
49 | | - - name: Run unit tests without coverage |
50 | | - run: vendor/bin/phpunit --verbose --colors=always |
51 | | - if: matrix.php != '7.1' |
52 | | - - name: Upload code coverage |
53 | | - run: | |
54 | | - wget https://scrutinizer-ci.com/ocular.phar |
55 | | - php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
56 | | - if: matrix.php == '7.1' |
57 | | - continue-on-error: true # if is fork |
| 25 | + phpunit: |
| 26 | + name: PHP ${{ matrix.php }} (mongodb ${{ matrix.mongoext }}) on ${{ matrix.os }} |
| 27 | + |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + |
| 30 | + services: |
| 31 | + mongodb: |
| 32 | + image: mongo:${{ matrix.mongo }} |
| 33 | + ports: |
| 34 | + - 27017:27017 |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + os: [ubuntu-latest] |
| 39 | + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] |
| 40 | + mongo: ['4.0'] |
| 41 | + mongoext: ['1.20.1'] |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout. |
| 45 | + uses: actions/checkout@v2 |
| 46 | + |
| 47 | + - name: Install PHP. |
| 48 | + uses: shivammathur/setup-php@v2 |
| 49 | + with: |
| 50 | + php-version: ${{ matrix.php }} |
| 51 | + tools: pecl |
| 52 | + extensions: mongodb-${{ matrix.mongoext }} |
| 53 | + ini-values: date.timezone='UTC' |
| 54 | + |
| 55 | + - name: Install dependencies with composer. |
| 56 | + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi |
| 57 | + |
| 58 | + - name: Run tests with phpunit. |
| 59 | + if: matrix.php != '8.1' |
| 60 | + run: vendor/bin/phpunit --colors=always |
| 61 | + |
| 62 | + - name: Run tests with phpunit and generate coverage. |
| 63 | + if: matrix.php == '8.1' |
| 64 | + run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always |
| 65 | + |
| 66 | + - name: Upload coverage to Codecov. |
| 67 | + if: matrix.php == '8.1' |
| 68 | + uses: codecov/codecov-action@v3 |
| 69 | + with: |
| 70 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 71 | + file: ./coverage.xml |
0 commit comments