|
| 1 | +name: PHPCSFixer |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + paths: |
| 8 | + - '**.php' |
| 9 | + - '.github/workflows/phpcsfixer.yml' |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - develop |
| 13 | + paths: |
| 14 | + - '**.php' |
| 15 | + - '.github/workflows/phpcsfixer.yml' |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + name: PHP ${{ matrix.php-versions }} Coding Standards |
| 20 | + runs-on: ubuntu-latest |
| 21 | + if: "!contains(github.event.head_commit.message, '[ci skip]')" |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + php-versions: ['7.3', '7.4', '8.0'] |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: Set up PHP |
| 32 | + uses: shivammathur/setup-php@v2 |
| 33 | + with: |
| 34 | + php-version: ${{ matrix.php-versions }} |
| 35 | + extensions: json, tokenizer |
| 36 | + coverage: none |
| 37 | + env: |
| 38 | + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + |
| 40 | + - name: Get composer cache directory |
| 41 | + id: composer-cache |
| 42 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 43 | + |
| 44 | + - name: Cache composer dependencies |
| 45 | + uses: actions/cache@v2 |
| 46 | + with: |
| 47 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 48 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} |
| 49 | + restore-keys: ${{ runner.os }}-composer- |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + composer -q config -g github-oauth.github.com "${{ secrets.GITHUB_TOKEN }}" |
| 54 | + if [ -f composer.lock ]; then |
| 55 | + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 56 | + else |
| 57 | + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 58 | + fi |
| 59 | +
|
| 60 | + - name: Check code for standards compliance |
| 61 | + run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff |
0 commit comments