Laurent Destailleur 2 years ago
parent
commit
3cd24e6e4c
2 changed files with 9 additions and 108 deletions
  1. 9 9
      .github/workflows/github_ci_php81_mysql.yml
  2. 0 99
      .github/workflows/php-cs.yml

+ 9 - 9
.github/workflows/php-mysql.yml → .github/workflows/github_ci_php81_mysql.yml

@@ -1,4 +1,4 @@
-name: GitHub CI PHPUnit Mysql
+name: GitHub CI PHP 8.1 MySQL
 
 on:
   push:
@@ -13,7 +13,7 @@ permissions:
   contents: read
 
 jobs:
-  github_ci_mysql:
+  github_ci_php81_mysql:
     runs-on: ubuntu-latest
     services:
       mysql:
@@ -121,7 +121,7 @@ jobs:
         echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
         # Ensure we catch errors
         set +e
-        echo '<?php ' > $INSTALL_FORCED_FILE
+        echo '<?php' > $INSTALL_FORCED_FILE
         echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
         # For mysql
         echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
@@ -163,7 +163,6 @@ jobs:
         pwd
         whoami
         # install apache web server
-        a2query -c
         a2query -s
         a2query -m
         ls /etc/apache2/sites-available
@@ -178,11 +177,9 @@ jobs:
         sudo chown -R www-data:www-data /etc/apache2/sites-available/
         sudo chmod -R 777 /etc/apache2/sites-available/
         sudo chown -R www-data:www-data /var/www/html/
-        #sudo chmod -R 777 /home/runner/work/
-        #ls -l /home/runner/work
         ls -l /var/www/html
-        ls -l /var/www/html/conf
-        ls -l /var/www/html/install/
+        #ls -l /var/www/html/conf
+        #ls -l /var/www/html/install/
         set +e
         sudo cat /etc/apache2/sites-enabled/000-default.conf
         sudo service apache2 restart
@@ -309,8 +306,9 @@ jobs:
         phpunitresult=$?
         echo "Phpunit return code = $phpunitresult"
         set +e     
-        
+
     - name: Code quality check - Lint
+      if: github.event_name == 'push'
       run: |
         htdocs/includes/bin/parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
           --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
@@ -319,10 +317,12 @@ jobs:
           --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
 
     - name: Code quality check - phpcs
+      if: github.event_name == 'push'
       run: |
          htdocs/includes/bin/phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;     
 
     - name: Code quality check - var-dump-check
+      if: github.event_name == 'push'
       run: |
         htdocs/includes/bin/var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
 

+ 0 - 99
.github/workflows/php-cs.yml

@@ -1,99 +0,0 @@
-name: GitHub CI Coding Style
-
-on:
-  push:
-    branches:
-      - develop
-      - 1*
-      - 2*
-#  pull_request:
-#    types: [opened]
-
-permissions:
-  contents: read
-
-jobs:
-  build:
-
-    runs-on: ubuntu-latest
-    services:
-      mysql:
-        image: mysql:5.7
-        env:
-          MYSQL_ROOT_PASSWORD: password
-        ports:
-        - 32574:3306
-
-    steps:
-    # git clone dolibarr into GITHUB_WORKSPACE = /home/runner/work/dolibarr/dolibarr
-    - uses: actions/checkout@v3
-
-    - name: Version PHP
-      run: |
-        php -i | head -
-
-    - name: Set vendor-dir
-      run: composer -n config -g vendor-dir htdocs/includes
-
-    #- name: Install packages for PHP 7.1
-    #  run: |
-    #    composer -n require phpunit/phpunit ^7.5 \
-    #      php-parallel-lint/php-parallel-lint ^1 \
-    #      php-parallel-lint/php-console-highlighter ^0 \
-    #      php-parallel-lint/php-var-dump-check ~0.4 \
-    #      squizlabs/php_codesniffer ^3
-    
-    - name: Install packages for PHP 8.1
-      run: |
-        composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
-          php-parallel-lint/php-parallel-lint ^1.2 \
-          php-parallel-lint/php-console-highlighter ^0 \
-          php-parallel-lint/php-var-dump-check ~0.4 \
-          squizlabs/php_codesniffer ^3
-
-    - name: Adding path of binaries tools installed by composer to the PATH
-      run: | 
-        export PATH="$GITHUB_WORKSPACE/htdocs/includes/bin:$PATH"
-        echo $PATH
-        ls $GITHUB_WORKSPACE/htdocs/includes/bin
-
-    - name: Version information
-      run: |
-        composer -V
-        # Check Parallel-lint version
-        echo "Parallel-lint version"
-        htdocs/includes/bin/parallel-lint -V
-        # Check PHP CodeSniffer version
-        echo "PHPCS version"
-        htdocs/includes/bin/phpcs --version | head -
-        htdocs/includes/bin/phpcs -i | head -
-        # Check PHP Vardump check version
-        echo "PHP Vardump check version"
-        htdocs/includes/bin/var-dump-check --version
-        # Check PHPUnit version
-        echo "PHPUnit version"
-        htdocs/includes/bin/phpunit --version | head -
-        # Check Apache version
-        echo "Apache version"
-        apache2 -v | head -
-        # Check Database
-        echo "Database version"
-        mysql --version | head -
-        psql --version
-        
-    - name: lint
-      run: |
-        htdocs/includes/bin/parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
-          --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
-          --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
-          --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
-          --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
-
-    - name: phpcs
-      run: |
-         htdocs/includes/bin/phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;     
-
-    - name: var-dump-check
-      run: |
-        htdocs/includes/bin/var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
-