From ced3857104af080ab9212b403a236c080152cc70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= <cedric.anne@gmail.com> Date: Fri, 3 Nov 2023 17:43:17 +0100 Subject: [PATCH 1/2] Run tests using the `ghcr.io/glpi-project/githubactions-glpi` image --- .github/workflows/continuous-integration.yml | 40 ++++++++--- composer.json | 5 +- composer.lock | 72 +++++++++++++++++--- 3 files changed, 97 insertions(+), 20 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e172cb3c..7fb69dd7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -11,23 +11,37 @@ on: workflow_dispatch: jobs: - lint: - name: "Lint" + ci: + name: "GLPI ${{ matrix.glpi-version }} / php:${{ matrix.php-version }} / ${{ matrix.db-image }}" runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: include: - - {php-version: "7.4"} + - {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/fields" 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" + path: "fields" - name: "Get Composer cache directory" id: "composer-cache" run: | @@ -42,10 +56,16 @@ jobs: composer install --ansi --no-interaction --no-progress --prefer-dist - name: "PHP Parallel Lint" run: | - vendor/bin/parallel-lint --colors --checkstyle --exclude ./vendor/ . | cs2pr + vendor/bin/parallel-lint --colors --checkstyle --exclude ./vendor/ . | vendor/bin/cs2pr - name: "PHP_CodeSniffer" run: | - vendor/bin/phpcs -q --report=checkstyle | cs2pr + vendor/bin/phpcs -q --report=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 fields + bin/console plugin:activate --ansi --no-interaction fields diff --git a/composer.json b/composer.json index 2a585bb2..e397a660 100644 --- a/composer.json +++ b/composer.json @@ -4,9 +4,10 @@ "symfony/yaml": "^5.4" }, "require-dev": { - "glpi-project/tools": "^0.6", + "glpi-project/tools": "^0.7", "php-parallel-lint/php-parallel-lint": "^1.3", - "squizlabs/php_codesniffer": "^3.6" + "squizlabs/php_codesniffer": "^3.6", + "staabm/annotate-pull-request-from-checkstyle": "^1.8" }, "config": { "optimize-autoloader": true, diff --git a/composer.lock b/composer.lock index dd2eb416..f2e01ac5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2a7360182e8cc8ad1b72d964a2117b49", + "content-hash": "e7b52ea8f4c0643518b861d285d70084", "packages": [ { "name": "symfony/deprecation-contracts", @@ -234,22 +234,26 @@ "packages-dev": [ { "name": "glpi-project/tools", - "version": "0.6.4", + "version": "0.7.1", "source": { "type": "git", "url": "https://github.com/glpi-project/tools.git", - "reference": "8ef917fa2967e716eaed198bb803f418a80cd621" + "reference": "4bc5a725d9f4da0ee946ad3cbdd54a782d2f40fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/glpi-project/tools/zipball/8ef917fa2967e716eaed198bb803f418a80cd621", - "reference": "8ef917fa2967e716eaed198bb803f418a80cd621", + "url": "https://api.github.com/repos/glpi-project/tools/zipball/4bc5a725d9f4da0ee946ad3cbdd54a782d2f40fb", + "reference": "4bc5a725d9f4da0ee946ad3cbdd54a782d2f40fb", "shasum": "" }, "require": { "symfony/console": "^5.4 || ^6.0", "twig/twig": "^3.3" }, + "require-dev": { + "nikic/php-parser": "^4.13", + "phpstan/phpstan-src": "^1.10" + }, "bin": [ "bin/extract-locales", "bin/licence-headers-check", @@ -258,7 +262,7 @@ "type": "library", "autoload": { "psr-4": { - "Glpi\\": "src/" + "GlpiProject\\Tools\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -282,7 +286,7 @@ "issues": "https://github.com/glpi-project/tools/issues", "source": "https://github.com/glpi-project/tools" }, - "time": "2023-07-27T12:32:25+00:00" + "time": "2023-10-16T11:40:35+00:00" }, { "name": "php-parallel-lint/php-parallel-lint", @@ -446,6 +450,58 @@ }, "time": "2023-02-22T23:07:41+00:00" }, + { + "name": "staabm/annotate-pull-request-from-checkstyle", + "version": "1.8.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/annotate-pull-request-from-checkstyle.git", + "reference": "082e7f859860f6e79094b6ec86606bd6d0fe9014" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/annotate-pull-request-from-checkstyle/zipball/082e7f859860f6e79094b6ec86606bd6d0fe9014", + "reference": "082e7f859860f6e79094b6ec86606bd6d0fe9014", + "shasum": "" + }, + "require": { + "ext-libxml": "*", + "ext-simplexml": "*", + "php": "^5.3 || ^7.0 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16.1" + }, + "bin": [ + "cs2pr" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Markus Staab" + } + ], + "keywords": [ + "Github Actions", + "continous integration", + "dev" + ], + "support": { + "issues": "https://github.com/staabm/annotate-pull-request-from-checkstyle/issues", + "source": "https://github.com/staabm/annotate-pull-request-from-checkstyle/tree/1.8.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2023-05-08T15:56:45+00:00" + }, { "name": "symfony/console", "version": "v5.4.26", @@ -1208,5 +1264,5 @@ "platform-overrides": { "php": "7.4.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 00d9e6d6990517f9dd38cfdf56d0b60ddf6e2e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= <cedric.anne@gmail.com> Date: Fri, 3 Nov 2023 17:50:29 +0100 Subject: [PATCH 2/2] Replace deprecated usage of `::set-output` --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7fb69dd7..6af6c64e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -45,7 +45,7 @@ jobs: - name: "Get Composer cache directory" id: "composer-cache" run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: "Restore dependencies cache" uses: "actions/cache@v3" with: