|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "master" |
| 8 | + schedule: |
| 9 | + - cron: "0 17 * * *" |
| 10 | + |
| 11 | +jobs: |
| 12 | + coding-standard: |
| 13 | + runs-on: ubuntu-18.04 |
| 14 | + name: Coding Standard |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Install PHP |
| 20 | + uses: shivammathur/[email protected] |
| 21 | + with: |
| 22 | + php-version: 7.4 |
| 23 | + coverage: none |
| 24 | + extensions: json |
| 25 | + tools: cs2pr |
| 26 | + |
| 27 | + - name: Get Composer Cache Directory |
| 28 | + id: composer-cache |
| 29 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 30 | + |
| 31 | + - name: Cache dependencies |
| 32 | + uses: actions/cache@v1 |
| 33 | + with: |
| 34 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 35 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 36 | + restore-keys: ${{ runner.os }}-composer- |
| 37 | + |
| 38 | + - name: Install Dependencies |
| 39 | + run: composer install ${DEPENDENCIES} |
| 40 | + |
| 41 | + - name: Coding Standard |
| 42 | + run: vendor/bin/phpcs -q --report=checkstyle | cs2pr |
| 43 | + |
| 44 | + phpstan: |
| 45 | + runs-on: ubuntu-18.04 |
| 46 | + name: PHPStan |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v2 |
| 50 | + |
| 51 | + - name: Install PHP |
| 52 | + uses: shivammathur/[email protected] |
| 53 | + with: |
| 54 | + php-version: 7.4 |
| 55 | + coverage: none |
| 56 | + extensions: json |
| 57 | + tools: cs2pr |
| 58 | + |
| 59 | + - name: Get Composer Cache Directory |
| 60 | + id: composer-cache |
| 61 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 62 | + |
| 63 | + - name: Cache dependencies |
| 64 | + uses: actions/cache@v1 |
| 65 | + with: |
| 66 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 67 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 68 | + restore-keys: ${{ runner.os }}-composer- |
| 69 | + |
| 70 | + - name: Install Dependencies |
| 71 | + run: composer install ${DEPENDENCIES} |
| 72 | + |
| 73 | + - name: PHPStan |
| 74 | + run: vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr |
| 75 | + |
| 76 | + coverage: |
| 77 | + runs-on: ubuntu-18.04 |
| 78 | + name: Code Coverage |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + with: |
| 83 | + ref: ${{ github.ref }} |
| 84 | + |
| 85 | + - name: Install PHP |
| 86 | + uses: shivammathur/[email protected] |
| 87 | + with: |
| 88 | + php-version: 7.4 |
| 89 | + coverage: pcov |
| 90 | + extensions: json |
| 91 | + |
| 92 | + - name: Get Composer Cache Directory |
| 93 | + id: composer-cache |
| 94 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 95 | + |
| 96 | + - name: Cache dependencies |
| 97 | + uses: actions/cache@v1 |
| 98 | + with: |
| 99 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 100 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 101 | + restore-keys: ${{ runner.os }}-composer- |
| 102 | + |
| 103 | + - name: Install Dependencies |
| 104 | + run: composer install ${DEPENDENCIES} |
| 105 | + |
| 106 | + - name: Code coverage |
| 107 | + run: | |
| 108 | + ./vendor/bin/phpunit --coverage-clover /tmp/coverage/clover.xml |
| 109 | +
|
| 110 | + - name: Report to Coveralls |
| 111 | + env: |
| 112 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 113 | + COVERALLS_RUN_LOCALLY: 1 |
| 114 | + run: vendor/bin/php-coveralls --coverage_clover /tmp/coverage/clover.xml --json_path /tmp/coverage/coveralls.json |
| 115 | + |
| 116 | + tests: |
| 117 | + name: Tests |
| 118 | + runs-on: ubuntu-18.04 |
| 119 | + strategy: |
| 120 | + matrix: |
| 121 | + php: [ 7.3, 7.4 ] |
| 122 | + dependencies: [ "", --prefer-lowest ] |
| 123 | + |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v2 |
| 126 | + |
| 127 | + - name: Install PHP |
| 128 | + uses: shivammathur/[email protected] |
| 129 | + with: |
| 130 | + php-version: ${{ matrix.php }} |
| 131 | + coverage: none |
| 132 | + extensions: json, mbstring |
| 133 | + - name: Get Composer Cache Directory |
| 134 | + id: composer-cache |
| 135 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 136 | + |
| 137 | + - name: Cache dependencies |
| 138 | + uses: actions/cache@v1 |
| 139 | + with: |
| 140 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 141 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 142 | + restore-keys: ${{ runner.os }}-composer- |
| 143 | + |
| 144 | + - name: Install Dependencies |
| 145 | + run: composer install ${DEPENDENCIES} |
| 146 | + |
| 147 | + - name: Run tests |
| 148 | + run: | |
| 149 | + export $ENV |
| 150 | + ./vendor/bin/phpunit |
| 151 | + env: |
| 152 | + ENV: ${{ matrix.env}} |
0 commit comments