]> git.agnieray.net Git - galette.git/commitdiff
Separate lint from tests
authorJohan Cwiklinski <johan@x-tnd.be>
Fri, 24 Mar 2023 04:49:29 +0000 (05:49 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Fri, 24 Mar 2023 05:06:32 +0000 (06:06 +0100)
Fix checker for PHP 8.2

.composer-require-checker.config.json
.github/workflows/ci-linux.yml

index d2c355e1e5c06cd11e612220589901040b335a67..c8b025db18889e8bed52211ee0ba08adb1ad813a 100644 (file)
     "static", "self", "parent",
     "array", "bool", "callable", "float", "int", "iterable", "object", "string", "void",
 
+    "// random native PHP functions",
+    "// these are moved in random native extension in PHP 8.2, but this extension does not exists in previous PHP versions",
+    "mt_rand",
+    "rand",
+    "random_int",
+
     "// Galette constants (not detected as they are dynamically declared)",
     "GALETTE_ATTACHMENTS_PATH",
     "GALETTE_BASE_PATH",
index a58e45f5eca2fe83ea70fcde0c3b48e207fbad4a..b0f2f262c75614c79917734d9ce088769e6eace8 100644 (file)
@@ -11,7 +11,73 @@ on:
   pull_request:
 
 jobs:
-  ubuntu-latest:
+  lint:
+    runs-on: ubuntu-latest
+    name: "Lint on PHP ${{ matrix.php-versions }}"
+
+    strategy:
+      fail-fast: false
+      matrix:
+        php-versions: [ '8.1', '8.2' ]
+
+    steps:
+      - name: PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php-versions }}
+          tools: composer, pecl
+          coverage: ${{ matrix.coverage }}
+          extensions: apcu
+          ini-values: apc.enable_cli=1
+
+      - name: "Show versions"
+        run: |
+          php --version
+          composer --version
+
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 2
+
+      - name: Get composer cache directory
+        id: composer-cache
+        run: |
+          echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
+
+      - name: Cache dependencies
+        uses: actions/cache@v3
+        with:
+          path: ${{ steps.composer-cache.outputs.dir }}
+          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
+          restore-keys: ${{ runner.os }}-composer-
+
+      - name: Install dependencies
+        run: |
+          cd galette
+          composer install
+
+      - name: CS
+        run: |
+          galette/vendor/bin/phpcs -n -p --ignore=galette_tcpdf_config.php --standard=phpcs-rules.xml galette/lib/ tests/TestsBootstrap.php tests/Galette tests/plugins galette/webroot/index.php galette/includes/
+
+      - name: Twig CS
+        run: |
+          galette/vendor/bin/twigcs galette/templates/default --severity error --display blocking
+
+      - name: Install checker
+        working-directory: galette
+        run: composer require maglnet/composer-require-checker -W
+
+      - name: Check missing symbols
+        run: |
+          galette/vendor/bin/composer-require-checker check --config-file=.composer-require-checker.config.json galette/composer.json
+
+      - name: PHPStan checks
+        run: |
+          galette/vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress
+
+  unit-tests:
     runs-on: ubuntu-latest
 
     strategy:
@@ -93,30 +159,6 @@ jobs:
       - name: Install dependencies
         run: bin/install_deps
 
-      - name: CS
-        run: |
-          galette/vendor/bin/phpcs -n -p --ignore=galette_tcpdf_config.php --standard=phpcs-rules.xml galette/lib/ tests/TestsBootstrap.php tests/Galette tests/plugins galette/webroot/index.php galette/includes/
-
-      - name: Twig CS
-        run: |
-          galette/vendor/bin/twigcs galette/templates/default --severity error --display blocking
-        if: matrix.php-versions == '8.1'
-
-      - name: Install checker
-        working-directory: galette
-        run: composer require maglnet/composer-require-checker -W
-        if: matrix.php-versions == '8.1'
-
-      - name: Check missing symbols
-        run: |
-          galette/vendor/bin/composer-require-checker check --config-file=.composer-require-checker.config.json galette/composer.json
-        if: matrix.php-versions == '8.1'
-
-      - name: PHPStan checks
-        run: |
-          galette/vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress
-        if: matrix.php-versions == '8.1'
-
       - name: Init for PostgreSQL (update)
         env:
           POSTGRES_HOST: localhost