mirror of
https://hk.gh-proxy.com/https://github.com/mcp-wp/ai-command.git
synced 2025-10-03 10:10:57 +08:00
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
name: Code Quality Checks
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
actionlint:
|
|
name: Lint GitHub Actions workflows
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Add problem matcher
|
|
run: |
|
|
curl -s -o .github/actionlint-matcher.json https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json
|
|
echo "::add-matcher::.github/actionlint-matcher.json"
|
|
|
|
- name: Check workflow files
|
|
uses: docker://rhysd/actionlint:latest
|
|
with:
|
|
args: -color -shellcheck=
|
|
|
|
lint:
|
|
name: Lint PHP files
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP environment
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: 'latest'
|
|
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
|
|
tools: cs2pr
|
|
env:
|
|
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Composer dependencies & cache dependencies
|
|
uses: "ramsey/composer-install@v3"
|
|
env:
|
|
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
|
with:
|
|
# Bust the cache at least once a month - output format: YYYY-MM.
|
|
custom-cache-suffix: $(date -u "+%Y-%m")
|
|
|
|
- name: Run Linter
|
|
run: vendor/bin/parallel-lint -j 10 . --show-deprecated --exclude vendor --exclude .git --exclude third-party --checkstyle | cs2pr
|
|
|
|
phpcs:
|
|
name: PHPCS
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP environment
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: 'latest'
|
|
tools: cs2pr
|
|
env:
|
|
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Composer dependencies & cache dependencies
|
|
uses: "ramsey/composer-install@v3"
|
|
env:
|
|
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
|
with:
|
|
# Bust the cache at least once a month - output format: YYYY-MM.
|
|
custom-cache-suffix: $(date -u "+%Y-%m")
|
|
|
|
- name: Run PHPCS
|
|
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr --graceful-warnings
|