Update version number and autoloader #5630
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [ push, pull_request ] | |
jobs: | |
backend-tests: | |
name: PHP ${{ matrix.php }} | |
# if on pull request, only run if from a fork | |
# (our own repo is covered by the push event) | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [ "7.3", "7.4", "8.0" ] | |
env: | |
extensions: mbstring, ctype, curl, gd, apcu, memcached | |
ini: apc.enabled=1, apc.enable_cli=1, pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\"" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2 | |
with: | |
fetch-depth: 2 | |
- name: Preparations | |
run: mkdir sarif | |
- name: Install memcached | |
uses: niden/actions-memcached@3b3ecd9d0d035ea92db716dc1540a7dbe9e56349 # pin@v7 | |
- name: Install system locales | |
run: sudo apt-get update && sudo apt-get install -y locales-all | |
- name: Setup PHP cache environment | |
id: ext-cache | |
uses: shivammathur/cache-extensions@a91eaeae663cddfa4327cdc128b00eb556022a67 # pin@v1 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: ${{ env.extensions }} | |
key: php-v1 | |
- name: Cache PHP extensions | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2 | |
with: | |
path: ${{ steps.ext-cache.outputs.dir }} | |
key: ${{ steps.ext-cache.outputs.key }} | |
restore-keys: ${{ steps.ext-cache.outputs.key }} | |
- name: Setup PHP environment | |
uses: shivammathur/setup-php@e02a1810e66ae357773a8f82626c7965d13ca75c # pin@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: ${{ env.extensions }} | |
ini-values: ${{ env.ini }} | |
coverage: pcov | |
tools: phpunit:9.5.4, psalm:4.7.1 | |
- name: Setup problem matchers | |
run: | | |
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Cache analysis data | |
id: finishPrepare | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2 | |
with: | |
path: ~/.cache/psalm | |
key: backend-analysis-${{ matrix.php }} | |
- name: Run tests | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: phpunit --coverage-clover ${{ github.workspace }}/clover.xml | |
- name: Statically analyze using Psalm | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: psalm --output-format=github --php-version=${{ matrix.php }} --report=sarif/psalm.sarif --report-show-info=false | |
- name: Upload coverage results to Codecov | |
uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192 # pin@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # for better reliability if the GitHub API is down | |
fail_ci_if_error: true | |
file: ${{ github.workspace }}/clover.xml | |
flags: backend | |
env_vars: PHP | |
env: | |
PHP: ${{ matrix.php }} | |
- name: Upload code scanning results to GitHub | |
if: always() && steps.finishPrepare.outcome == 'success' | |
uses: github/codeql-action/upload-sarif@ece2addcff6617641ef7caf0016fb0fd4c2a9962 # pin@v1 | |
with: | |
sarif_file: sarif | |
backend-analysis: | |
name: Backend Analysis | |
# if on pull request, only run if from a fork | |
# (our own repo is covered by the push event) | |
if: > | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
env: | |
php: "8.0" | |
extensions: mbstring, ctype, curl, gd, apcu, memcached | |
steps: | |
- name: Checkout | |
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2 | |
- name: Preparations | |
run: mkdir sarif | |
- name: Setup PHP cache environment | |
id: ext-cache | |
uses: shivammathur/cache-extensions@a91eaeae663cddfa4327cdc128b00eb556022a67 # pin@v1 | |
with: | |
php-version: ${{ env.php }} | |
extensions: ${{ env.extensions }} | |
key: php-analysis-v1 | |
- name: Cache PHP extensions | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2 | |
with: | |
path: ${{ steps.ext-cache.outputs.dir }} | |
key: ${{ steps.ext-cache.outputs.key }} | |
restore-keys: ${{ steps.ext-cache.outputs.key }} | |
- name: Setup PHP environment | |
id: finishPrepare | |
uses: shivammathur/setup-php@e02a1810e66ae357773a8f82626c7965d13ca75c # pin@v2 | |
with: | |
php-version: ${{ env.php }} | |
extensions: ${{ env.extensions }} | |
coverage: none | |
tools: | | |
composer:2.0.13, composer-normalize:2.13.3, composer-require-checker:3.2.0, | |
composer-unused:0.7.5, phpcpd:6.0.3, phpmd:2.10.0 | |
- name: Validate composer.json/composer.lock | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: composer validate --strict --no-check-version --no-check-all | |
- name: Ensure that composer.json is normalized | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: composer-normalize --dry-run | |
- name: Check for unused Composer dependencies | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: composer unused --no-progress | |
- name: Check for duplicated code | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: phpcpd --fuzzy --exclude tests --exclude vendor . | |
- name: Statically analyze using PHPMD | |
if: always() && steps.finishPrepare.outcome == 'success' | |
run: phpmd . github phpmd.xml.dist --exclude 'dependencies/*,tests/*,vendor/*' --reportfile-sarif sarif/phpmd.sarif | |
- name: Upload code scanning results to GitHub | |
if: always() && steps.finishPrepare.outcome == 'success' | |
uses: github/codeql-action/upload-sarif@ece2addcff6617641ef7caf0016fb0fd4c2a9962 # pin@v1 | |
with: | |
sarif_file: sarif | |
coding-style: | |
name: Coding Style & Frontend Analysis | |
runs-on: ubuntu-latest | |
env: | |
php: "8.0" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2 | |
- name: Set up Node.js problem matchers | |
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # pin@v2 | |
- name: Cache npm dependencies | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: Install npm dependencies | |
run: npm ci | |
working-directory: panel | |
- name: Setup PHP environment | |
uses: shivammathur/setup-php@e02a1810e66ae357773a8f82626c7965d13ca75c # pin@v2 | |
with: | |
php-version: ${{ env.php }} | |
coverage: none | |
tools: php-cs-fixer:3.0.0 | |
- name: Cache analysis data | |
id: finishPrepare | |
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2 | |
with: | |
path: ~/.php-cs-fixer | |
key: coding-style | |
- name: Check for JavaScript coding style violations | |
if: always() && steps.finishPrepare.outcome == 'success' | |
# Use the --no-fix flag in push builds to get a failed CI status | |
run: > | |
npm run lint -- --max-warnings 0 --format stylish | |
${{ github.event_name != 'pull_request' && '--no-fix' || '' }} | |
working-directory: panel | |
- name: Create code suggestions from the coding style changes (on PR only) | |
if: > | |
always() && steps.finishPrepare.outcome == 'success' && | |
github.event_name == 'pull_request' | |
uses: reviewdog/action-suggester@48950dbe544db810d96221f012e7ac641d010820 # pin@v1 | |
with: | |
tool_name: ESLint | |
fail_on_error: 'true' | |
- name: Check for PHP coding style violations | |
if: always() && steps.finishPrepare.outcome == 'success' | |
# Use the --dry-run flag in push builds to get a failed CI status | |
run: > | |
php-cs-fixer fix --diff | |
${{ github.event_name != 'pull_request' && '--dry-run' || '' }} | |
- name: Create code suggestions from the coding style changes (on PR only) | |
if: > | |
always() && steps.finishPrepare.outcome == 'success' && | |
github.event_name == 'pull_request' | |
uses: reviewdog/action-suggester@48950dbe544db810d96221f012e7ac641d010820 # pin@v1 | |
with: | |
tool_name: PHP-CS-Fixer | |
fail_on_error: 'true' |