phpstan lvl 1 #75
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: | |
lint: | |
name: "Lint" | |
runs-on: "ubuntu-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {php-version: "7.4"} | |
- {php-version: "8.1"} | |
- {php-version: "8.2"} | |
- {php-version: "8.3-rc"} | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup PHP" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "${{ matrix.php-version }}" | |
coverage: "none" | |
tools: "composer, cs2pr" | |
- 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/ . | cs2pr | |
- name: "PHP_CodeSniffer" | |
run: | | |
vendor/bin/phpcs -q --report=checkstyle | cs2pr | |
- name: "Check for missing/outdated headers" | |
run: | | |
vendor/bin/licence-headers-check --ansi --no-interaction | |
tests: | |
name: "Test on GLPI ${{ matrix.glpi-version }} with PHP ${{ matrix.php-version }}" | |
runs-on: "ubuntu-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {glpi-version: "10.0", php-version: "7.4", db-image: "mysql:8.0"} | |
- {glpi-version: "10.0", php-version: "8.2", db-image: "mysql:8.0"} | |
- {glpi-version: "main", php-version: "8.2", db-image: "mysql:8.0"} | |
services: | |
app: | |
image: "ghcr.io/glpi-project/githubactions-php:${{ matrix.php-version }}" | |
options: >- | |
--volume /glpi:/var/glpi:rw | |
db: | |
image: "ghcr.io/glpi-project/githubactions-${{ matrix.db-image }}" | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
MYSQL_DATABASE: "glpi" | |
options: >- | |
--shm-size=1g | |
steps: | |
- name: "Checkout plugin" | |
uses: "actions/checkout@v4" | |
- 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: "Deploy source into app container" | |
run: | | |
curl --silent https://nightly.glpi-project.org/glpi/${{ matrix.glpi-version }}.tar.gz | sudo tar --extract --ungzip --strip 1 --directory /glpi | |
sudo cp --no-target-directory --preserve --recursive `pwd` /glpi/plugins/oauthimap | |
sudo setfacl --recursive --modify u:1000:rwx /glpi | |
- name: "Install" | |
run: | | |
docker exec ${{ job.services.app.id }} bin/console glpi:database:install --ansi --no-interaction --db-name=glpi --db-host=db --db-user=root --strict-configuration | |
docker exec ${{ job.services.app.id }} bin/console glpi:plugin:install --ansi --no-interaction --username=glpi oauthimap | |
docker exec ${{ job.services.app.id }} bin/console glpi:plugin:activate --ansi --no-interaction oauthimap | |
- name: "PHPStan checks" | |
run: docker exec ${{ job.services.app.id }} bash -c "cd plugins/oauthimap && php vendor/bin/phpstan analyze --ansi --memory-limit=1G --no-interaction --no-progress" |