|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +on: |
| 4 | + - "pull_request" |
| 5 | + - "push" |
| 6 | + |
| 7 | +name: "CI" |
| 8 | + |
| 9 | +jobs: |
| 10 | + coding-guidelines: |
| 11 | + name: "Coding Guidelines" |
| 12 | + |
| 13 | + runs-on: "ubuntu-latest" |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: "Checkout" |
| 17 | + uses: "actions/checkout@v2" |
| 18 | + |
| 19 | + - name: "Run friendsofphp/php-cs-fixer" |
| 20 | + run: "php7.1 ./tools/php-cs-fixer fix --diff-format=udiff --dry-run --show-progress=dots --using-cache=no --verbose" |
| 21 | + |
| 22 | + type-checker: |
| 23 | + name: "Type Checker" |
| 24 | + |
| 25 | + runs-on: "ubuntu-latest" |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: "Checkout" |
| 29 | + uses: "actions/checkout@v2" |
| 30 | + |
| 31 | + - name: "Set COMPOSER_ROOT_VERSION environment variable" |
| 32 | + uses: "docker://ergebnis/composer-root-version-action:0.1.3" |
| 33 | + |
| 34 | + - name: "Update dependencies with composer" |
| 35 | + run: "php7.4 ./tools/composer update --no-ansi --no-interaction --no-progress" |
| 36 | + |
| 37 | + - name: "Run vimeo/psalm" |
| 38 | + run: "php7.4 ./tools/psalm --config=.psalm/config.xml --no-progress --shepherd --show-info=false --stats" |
| 39 | + |
| 40 | + backward-compatibility: |
| 41 | + name: Backward Compatibility |
| 42 | + |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v2 |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + |
| 51 | + - name: Fetch tags |
| 52 | + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
| 53 | + |
| 54 | + - name: Install PHP with extensions |
| 55 | + uses: shivammathur/setup-php@v2 |
| 56 | + with: |
| 57 | + php-version: 7.4 |
| 58 | + coverage: none |
| 59 | + extensions: intl |
| 60 | + |
| 61 | + - name: Run roave/backward-compatibility-check |
| 62 | + run: ./tools/roave-backward-compatibility-check --from=1.0.0 |
| 63 | + |
| 64 | + tests: |
| 65 | + name: "Tests" |
| 66 | + |
| 67 | + runs-on: "ubuntu-latest" |
| 68 | + |
| 69 | + strategy: |
| 70 | + matrix: |
| 71 | + php-version: |
| 72 | + - "7.1" |
| 73 | + - "7.2" |
| 74 | + - "7.3" |
| 75 | + - "7.4" |
| 76 | + - "8.0" |
| 77 | + |
| 78 | + dependencies: |
| 79 | + - "lowest" |
| 80 | + - "highest" |
| 81 | + |
| 82 | + steps: |
| 83 | + - name: "Checkout" |
| 84 | + uses: "actions/checkout@v2" |
| 85 | + |
| 86 | + - name: "Install PHP with extensions" |
| 87 | + uses: "shivammathur/setup-php@v1" |
| 88 | + with: |
| 89 | + php-version: "${{ matrix.php-version }}" |
| 90 | + coverage: "pcov" |
| 91 | + ini-values: memory_limit=-1 |
| 92 | + |
| 93 | + - name: "Cache dependencies installed with composer" |
| 94 | + uses: "actions/cache@v1" |
| 95 | + with: |
| 96 | + path: "~/.composer/cache" |
| 97 | + key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}" |
| 98 | + restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" |
| 99 | + |
| 100 | + - name: "Set COMPOSER_ROOT_VERSION environment variable" |
| 101 | + uses: "docker://ergebnis/composer-root-version-action:0.1.3" |
| 102 | + |
| 103 | + - name: "Install lowest dependencies with composer" |
| 104 | + if: "matrix.dependencies == 'lowest'" |
| 105 | + run: "./tools/composer update --no-ansi --no-interaction --no-progress --prefer-lowest" |
| 106 | + |
| 107 | + - name: "Install highest dependencies with composer" |
| 108 | + if: "matrix.dependencies == 'highest'" |
| 109 | + run: "./tools/composer update --no-ansi --no-interaction --no-progress" |
| 110 | + |
| 111 | + - name: "Run tests with phpunit/phpunit" |
| 112 | + run: "vendor/bin/phpunit --coverage-clover=coverage.xml" |
| 113 | + |
| 114 | + - name: "Send code coverage report to Codecov.io" |
| 115 | + env: |
| 116 | + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" |
| 117 | + run: "bash <(curl -s https://codecov.io/bash) || true" |
0 commit comments