Add PHPStan checks (level 1) #87
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: "Continuous integration" | |
on: | |
push: | |
branches: | |
- "master" | |
- "develop" | |
tags: | |
- "*" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
ci: | |
name: "GLPI ${{ matrix.glpi-version }} / php:${{ matrix.php-version }} / ${{ matrix.db-image }}" | |
runs-on: "ubuntu-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {glpi-version: "10.0.x", php-version: "7.4", db-image: "mysql:5.7"} | |
- {glpi-version: "10.0.x", php-version: "8.0", db-image: "mysql:8.0"} | |
- {glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.2"} | |
- {glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0"} | |
container: | |
image: "ghcr.io/glpi-project/githubactions-glpi:php-${{ matrix.php-version }}-glpi-${{ matrix.glpi-version }}" | |
options: >- | |
--volume ${{ github.workspace }}:/var/glpi/plugins:rw | |
services: | |
db: | |
image: "ghcr.io/glpi-project/githubactions-${{ matrix.db-image }}" | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
MYSQL_DATABASE: "glpi" | |
options: >- | |
--shm-size=1g | |
defaults: | |
run: | |
working-directory: "/var/glpi/plugins/oauthimap" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
with: | |
path: "oauthimap" | |
- name: "Get Composer cache directory" | |
id: "composer-cache" | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: "Restore dependencies cache" | |
uses: "actions/cache@v3" | |
with: | |
path: "${{ steps.composer-cache.outputs.dir }}" | |
key: "${{ github.job }}-${{ matrix.php-version }}-dependencies-${{ hashFiles('**/composer.lock') }}" | |
- name: "Install Composer dependencies" | |
run: | | |
composer install --ansi --no-interaction --no-progress --prefer-dist | |
- name: "PHP Parallel Lint" | |
run: | | |
vendor/bin/parallel-lint --colors --checkstyle --exclude ./vendor/ . | vendor/bin/cs2pr | |
- name: "PHP_CodeSniffer" | |
run: | | |
vendor/bin/phpcs -q --report=checkstyle | vendor/bin/cs2pr | |
- name: "PHPStan checks" | |
run: | | |
vendor/bin/phpstan analyze --ansi --memory-limit=1G --no-interaction --no-progress --error-format=checkstyle | vendor/bin/cs2pr | |
- name: "Check for missing/outdated headers" | |
run: | | |
vendor/bin/licence-headers-check --ansi --no-interaction | |
- name: "Install plugin" | |
working-directory: "/var/glpi" | |
run: | | |
bin/console database:install --ansi --no-interaction --db-name=glpi --db-host=db --db-user=root --strict-configuration | |
bin/console plugin:install --ansi --no-interaction --username=glpi oauthimap | |
bin/console plugin:activate --ansi --no-interaction oauthimap |