|
| 1 | +--- |
| 2 | + |
| 3 | +on: # yamllint disable-line rule:truthy |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +name: 🧹 Fix PHP coding standards |
| 9 | + |
| 10 | +jobs: |
| 11 | + commit-linting: |
| 12 | + timeout-minutes: 4 |
| 13 | + runs-on: ubuntu-latest |
| 14 | + concurrency: |
| 15 | + cancel-in-progress: true |
| 16 | + group: commit-linting-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + pull-requests: read |
| 20 | + steps: |
| 21 | + - name: 📦 Check out the codebase |
| 22 | + |
| 23 | + |
| 24 | + - name: 🧐 Lint commits using "commitlint" |
| 25 | + |
| 26 | + with: |
| 27 | + configFile: ${{ github.workspace }}/.github/.commitlint.config.mjs |
| 28 | + failOnWarnings: false |
| 29 | + failOnErrors: true |
| 30 | + helpURL: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint' |
| 31 | + |
| 32 | + yaml-linting: |
| 33 | + timeout-minutes: 4 |
| 34 | + runs-on: ubuntu-latest |
| 35 | + concurrency: |
| 36 | + cancel-in-progress: true |
| 37 | + group: yaml-linting-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 38 | + permissions: |
| 39 | + contents: read |
| 40 | + pull-requests: read |
| 41 | + steps: |
| 42 | + - name: 📦 Check out the codebase |
| 43 | + |
| 44 | + |
| 45 | + - name: 🧐 Lint YAML files |
| 46 | + |
| 47 | + with: |
| 48 | + config_file: .github/.yamllint.yaml |
| 49 | + file_or_dir: '.' |
| 50 | + strict: true |
| 51 | + |
| 52 | + markdown-linting: |
| 53 | + timeout-minutes: 4 |
| 54 | + runs-on: ubuntu-latest |
| 55 | + concurrency: |
| 56 | + cancel-in-progress: true |
| 57 | + group: markdown-linting-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 58 | + steps: |
| 59 | + - name: 📦 Check out the codebase |
| 60 | + |
| 61 | + |
| 62 | + - name: 🧐 Lint Markdown files |
| 63 | + uses: DavidAnson/[email protected] |
| 64 | + with: |
| 65 | + config: '.github/.markdownlint.json' |
| 66 | + globs: | |
| 67 | + **/*.md |
| 68 | + !CHANGELOG.md |
| 69 | +
|
| 70 | + composer-linting: |
| 71 | + timeout-minutes: 4 |
| 72 | + runs-on: ${{ matrix.os }} |
| 73 | + concurrency: |
| 74 | + cancel-in-progress: true |
| 75 | + group: composer-linting-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 76 | + strategy: |
| 77 | + matrix: |
| 78 | + os: |
| 79 | + - ubuntu-latest |
| 80 | + php-version: |
| 81 | + - '8.2' |
| 82 | + dependencies: |
| 83 | + - locked |
| 84 | + permissions: |
| 85 | + contents: write |
| 86 | + steps: |
| 87 | + - name: 🛠️ Setup PHP |
| 88 | + uses: shivammathur/[email protected] |
| 89 | + with: |
| 90 | + php-version: ${{ matrix.php-version }} |
| 91 | + extensions: none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, phar, fileinfo, curl |
| 92 | + ini-values: error_reporting=E_ALL |
| 93 | + coverage: none |
| 94 | + tools: phive |
| 95 | + |
| 96 | + - name: 📦 Check out the codebase |
| 97 | + |
| 98 | + |
| 99 | + - name: 🛠️ Setup problem matchers |
| 100 | + run: | |
| 101 | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 102 | +
|
| 103 | + - name: 🤖 Validate composer.json and composer.lock |
| 104 | + run: composer validate --ansi --strict |
| 105 | + |
| 106 | + - name: 🔍 Get composer cache directory |
| 107 | + uses: wayofdev/gh-actions/actions/composer/[email protected] |
| 108 | + |
| 109 | + - name: ♻️ Restore cached dependencies installed with composer |
| 110 | + |
| 111 | + with: |
| 112 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 113 | + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} |
| 114 | + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- |
| 115 | + |
| 116 | + - name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer |
| 117 | + uses: wayofdev/gh-actions/actions/composer/[email protected] |
| 118 | + with: |
| 119 | + dependencies: ${{ matrix.dependencies }} |
| 120 | + |
| 121 | + - name: 📥 Install dependencies with phive |
| 122 | + uses: wayofdev/gh-actions/actions/phive/[email protected] |
| 123 | + with: |
| 124 | + phive-home: '.phive' |
| 125 | + trust-gpg-keys: 0xC00543248C87FB13,0x033E5F8D801A2F8D |
| 126 | + |
| 127 | + - name: 🔍 Run ergebnis/composer-normalize |
| 128 | + run: .phive/composer-normalize --ansi --dry-run |
| 129 | + |
| 130 | + coding-standards: |
| 131 | + timeout-minutes: 4 |
| 132 | + runs-on: ${{ matrix.os }} |
| 133 | + concurrency: |
| 134 | + cancel-in-progress: true |
| 135 | + group: coding-standards-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 136 | + strategy: |
| 137 | + matrix: |
| 138 | + os: |
| 139 | + - ubuntu-latest |
| 140 | + php-version: |
| 141 | + - '8.2' |
| 142 | + dependencies: |
| 143 | + - locked |
| 144 | + permissions: |
| 145 | + contents: write |
| 146 | + steps: |
| 147 | + - name: ⚙️ Set git to use LF line endings |
| 148 | + run: | |
| 149 | + git config --global core.autocrlf false |
| 150 | + git config --global core.eol lf |
| 151 | +
|
| 152 | + - name: 🛠️ Setup PHP |
| 153 | + uses: shivammathur/[email protected] |
| 154 | + with: |
| 155 | + php-version: ${{ matrix.php-version }} |
| 156 | + extensions: none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, curl |
| 157 | + ini-values: error_reporting=E_ALL |
| 158 | + coverage: none |
| 159 | + |
| 160 | + - name: 📦 Check out the codebase |
| 161 | + |
| 162 | + |
| 163 | + - name: 🛠️ Setup problem matchers |
| 164 | + run: | |
| 165 | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 166 | +
|
| 167 | + - name: 🤖 Validate composer.json and composer.lock |
| 168 | + run: composer validate --ansi --strict |
| 169 | + |
| 170 | + - name: 🔍 Get composer cache directory |
| 171 | + uses: wayofdev/gh-actions/actions/composer/[email protected] |
| 172 | + |
| 173 | + - name: ♻️ Restore cached dependencies installed with composer |
| 174 | + |
| 175 | + with: |
| 176 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 177 | + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} |
| 178 | + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- |
| 179 | + |
| 180 | + - name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer |
| 181 | + uses: wayofdev/gh-actions/actions/composer/[email protected] |
| 182 | + with: |
| 183 | + dependencies: ${{ matrix.dependencies }} |
| 184 | + |
| 185 | + - name: 🛠️ Prepare environment |
| 186 | + run: make prepare |
| 187 | + |
| 188 | + - name: 🚨 Run coding standards task |
| 189 | + run: composer cs:fix |
| 190 | + env: |
| 191 | + PHP_CS_FIXER_IGNORE_ENV: true |
| 192 | + |
| 193 | + - name: 📤 Commit and push changed files back to GitHub |
| 194 | + uses: stefanzweifel/[email protected] |
| 195 | + with: |
| 196 | + commit_message: 'style(php-cs-fixer): lint php files and fix coding standards' |
| 197 | + branch: ${{ github.head_ref }} |
| 198 | + commit_author: 'github-actions <[email protected]>' |
| 199 | + env: |
| 200 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments