|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "master" |
| 8 | + tags: |
| 9 | + - "**" |
| 10 | + |
| 11 | +name: "Continuous Integration" |
| 12 | + |
| 13 | +jobs: |
| 14 | + coding-standards: |
| 15 | + name: "Coding Standards" |
| 16 | + |
| 17 | + runs-on: "ubuntu-latest" |
| 18 | + |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + php-version: |
| 22 | + - "5.3" |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: "Checkout" |
| 26 | + uses: "actions/checkout@v2" |
| 27 | + |
| 28 | + - name: "Install PHP with extensions" |
| 29 | + uses: "shivammathur/setup-php@v2" |
| 30 | + with: |
| 31 | + coverage: "none" |
| 32 | + extensions: "intl" |
| 33 | + php-version: "${{ matrix.php-version }}" |
| 34 | + |
| 35 | + - name: "Determine composer cache directory" |
| 36 | + id: "determine-composer-cache-directory" |
| 37 | + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" |
| 38 | + |
| 39 | + - name: "Cache dependencies installed with composer" |
| 40 | + uses: "actions/cache@v1" |
| 41 | + with: |
| 42 | + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" |
| 43 | + key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}" |
| 44 | + restore-keys: "php-${{ matrix.php-version }}-composer-" |
| 45 | + |
| 46 | + - name: "Install dependencies with composer" |
| 47 | + run: "composer install --no-interaction --no-progress --no-suggest" |
| 48 | + |
| 49 | + - name: "Run squizlabs/php_codesniffer" |
| 50 | + run: "vendor/bin/phpcs --standard=PSR2 src -n" |
| 51 | + |
| 52 | + tests: |
| 53 | + name: "Tests" |
| 54 | + |
| 55 | + runs-on: "ubuntu-latest" |
| 56 | + |
| 57 | + strategy: |
| 58 | + matrix: |
| 59 | + php-version: |
| 60 | + - "5.3" |
| 61 | + - "5.4" |
| 62 | + - "5.5" |
| 63 | + - "5.6" |
| 64 | + - "7.0" |
| 65 | + - "7.1" |
| 66 | + - "7.2" |
| 67 | + - "7.3" |
| 68 | + - "7.4" |
| 69 | + |
| 70 | + steps: |
| 71 | + - name: "Checkout" |
| 72 | + uses: "actions/checkout@v2" |
| 73 | + |
| 74 | + - name: "Install PHP with extensions" |
| 75 | + uses: "shivammathur/setup-php@v2" |
| 76 | + with: |
| 77 | + coverage: "none" |
| 78 | + extensions: "intl" |
| 79 | + ini-values: "memory_limit=-1" |
| 80 | + php-version: "${{ matrix.php-version }}" |
| 81 | + |
| 82 | + - name: "Determine composer cache directory" |
| 83 | + id: "determine-composer-cache-directory" |
| 84 | + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" |
| 85 | + |
| 86 | + - name: "Cache dependencies installed with composer" |
| 87 | + uses: "actions/cache@v1" |
| 88 | + with: |
| 89 | + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" |
| 90 | + key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}" |
| 91 | + restore-keys: "php-${{ matrix.php-version }}-composer-" |
| 92 | + |
| 93 | + - name: "Install dependencies with composer" |
| 94 | + run: "composer install --no-interaction --no-progress --no-suggest" |
| 95 | + |
| 96 | + - name: "Run tests with phpunit/phpunit" |
| 97 | + run: "vendor/bin/phpunit" |
| 98 | + |
| 99 | + code-coverage: |
| 100 | + name: "Code Coverage" |
| 101 | + |
| 102 | + runs-on: "ubuntu-latest" |
| 103 | + |
| 104 | + strategy: |
| 105 | + matrix: |
| 106 | + php-version: |
| 107 | + - "7.4" |
| 108 | + |
| 109 | + steps: |
| 110 | + - name: "Checkout" |
| 111 | + uses: "actions/checkout@v2" |
| 112 | + |
| 113 | + - name: "Install PHP with extensions" |
| 114 | + uses: "shivammathur/setup-php@v2" |
| 115 | + with: |
| 116 | + coverage: "xdebug" |
| 117 | + extensions: "intl" |
| 118 | + ini-values: "memory_limit=-1" |
| 119 | + php-version: "${{ matrix.php-version }}" |
| 120 | + |
| 121 | + - name: "Determine composer cache directory" |
| 122 | + id: "determine-composer-cache-directory" |
| 123 | + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" |
| 124 | + |
| 125 | + - name: "Cache dependencies installed with composer" |
| 126 | + uses: "actions/cache@v1" |
| 127 | + with: |
| 128 | + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" |
| 129 | + key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}" |
| 130 | + restore-keys: "php-${{ matrix.php-version }}-composer-" |
| 131 | + |
| 132 | + - name: "Install dependencies with composer" |
| 133 | + run: "composer install --no-interaction --no-progress --no-suggest" |
| 134 | + |
| 135 | + - name: "Create build directory" |
| 136 | + run: "mkdir -p .build/logs" |
| 137 | + |
| 138 | + - name: "Collect code coverage with Xdebug and phpunit/phpunit" |
| 139 | + run: "vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml" |
| 140 | + |
| 141 | + - name: "Send code coverage report to Codecov.io" |
| 142 | + env: |
| 143 | + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" |
| 144 | + run: "bash <(curl -s https://codecov.io/bash)" |
0 commit comments