From 72522f4292fae3c27829a39d569b74403799fdf7 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 10:57:51 +0400 Subject: [PATCH 1/9] .coderabbit.yaml --- .coderabbit.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .coderabbit.yaml diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 00000000..abb069a5 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,5 @@ +reviews: + auto: true + branches: + include: + - "*" From ac0a4b36059ee2b8af14b4c343efac85d4f60189 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 11:01:44 +0400 Subject: [PATCH 2/9] test --- tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php b/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php index 4ab6d556..a81b15b3 100644 --- a/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php +++ b/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php @@ -73,7 +73,7 @@ public function testExecuteWhenLockNotAcquired(): void $this->commandTester->execute([]); $output = $this->commandTester->getDisplay(); - $this->assertStringContainsString('Another bounce processing is already running. Aborting.', $output); + $this->assertStringContainsString('Another bounce processing is already running.', $output); $this->assertSame(0, $this->commandTester->getStatusCode()); } From 3f93810325e6227f1d7ae68bc90542a4191946d1 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 11:08:18 +0400 Subject: [PATCH 3/9] test reviews --- .../Analytics/Exception/MessageIdException.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/Domain/Analytics/Exception/MessageIdException.php diff --git a/src/Domain/Analytics/Exception/MessageIdException.php b/src/Domain/Analytics/Exception/MessageIdException.php new file mode 100644 index 00000000..a47ce877 --- /dev/null +++ b/src/Domain/Analytics/Exception/MessageIdException.php @@ -0,0 +1,15 @@ + Date: Thu, 23 Oct 2025 11:12:14 +0400 Subject: [PATCH 4/9] review fix --- .coderabbit.yaml | 8 ++++---- tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.coderabbit.yaml b/.coderabbit.yaml index abb069a5..2045b00d 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,5 +1,5 @@ reviews: - auto: true - branches: - include: - - "*" + auto_review: + enabled: true + base_branches: + - ".*" diff --git a/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php b/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php index a81b15b3..4ab6d556 100644 --- a/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php +++ b/tests/Unit/Bounce/Command/ProcessBouncesCommandTest.php @@ -73,7 +73,7 @@ public function testExecuteWhenLockNotAcquired(): void $this->commandTester->execute([]); $output = $this->commandTester->getDisplay(); - $this->assertStringContainsString('Another bounce processing is already running.', $output); + $this->assertStringContainsString('Another bounce processing is already running. Aborting.', $output); $this->assertSame(0, $this->commandTester->getStatusCode()); } From 590e3e32f33607d9d6ba326b983214f903eb921c Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 11:46:38 +0400 Subject: [PATCH 5/9] remove test file --- .../Analytics/Exception/MessageIdException.php | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/Domain/Analytics/Exception/MessageIdException.php diff --git a/src/Domain/Analytics/Exception/MessageIdException.php b/src/Domain/Analytics/Exception/MessageIdException.php deleted file mode 100644 index a47ce877..00000000 --- a/src/Domain/Analytics/Exception/MessageIdException.php +++ /dev/null @@ -1,15 +0,0 @@ - Date: Thu, 23 Oct 2025 11:50:33 +0400 Subject: [PATCH 6/9] update description --- .coderabbit.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 2045b00d..80459702 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -3,3 +3,6 @@ reviews: enabled: true base_branches: - ".*" + pull_request: + summarize: true + update_description: true From 2246e490b4fb1385d09a855ac608fc0cd989a2c1 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 11:52:10 +0400 Subject: [PATCH 7/9] comment out --- .github/workflows/ci.yml | 156 ++++++++++++------------ .github/workflows/core-docs.yml | 178 ++++++++++++++-------------- .github/workflows/i18n-validate.yml | 138 ++++++++++----------- 3 files changed, 236 insertions(+), 236 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43dea8d7..6f8fd1e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,78 +1,78 @@ -name: phpList Core Build -on: [push, pull_request] -jobs: - main: - name: phpList on PHP ${{ matrix.php-versions }} [Build, Test] - runs-on: ubuntu-22.04 - env: - DB_DATABASE: phplist - DB_USERNAME: root - DB_PASSWORD: phplist - BROADCAST_DRIVER: log - services: - mysql: - image: mysql:5.7 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: false - MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }} - MYSQL_DATABASE: ${{ env.DB_DATABASE }} - ports: - - 3306/tcp - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - strategy: - fail-fast: false - matrix: - php-versions: ['8.1'] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug #optional - - name: Install Symfony CLI - run: | - curl -sS https://get.symfony.com/cli/installer | bash - mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony - symfony version - - name: Start mysql service - run: sudo /etc/init.d/mysql start - - name: Verify MySQL connection on host - run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" - - name: Set up database schema - run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < resources/Database/Schema.sql - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install Composer dependencies - run: composer install --no-progress --prefer-dist --optimize-autoloader - - name: Validating composer.json - run: composer validate --no-check-all --no-check-lock --strict; - - name: Linting all php files - run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*; - - name: Run units tests with phpunit - run: vendor/bin/phpunit tests/Unit/ --testdox - - name: Run integration tests with phpunit - run: | - export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }} - export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }} - export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} - export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} - export PHPLIST_DATABASE_HOST=127.0.0.1 - vendor/bin/phpunit tests/Integration/ - - name: Running the system tests - run: vendor/bin/phpunit tests/System/ --testdox; - - name: Running static analysis - run: vendor/bin/phpstan analyse -c phpstan.neon; - - name: Running PHPMD - run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml; - - name: Running PHP_CodeSniffer - run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; +#name: phpList Core Build +#on: [push, pull_request] +#jobs: +# main: +# name: phpList on PHP ${{ matrix.php-versions }} [Build, Test] +# runs-on: ubuntu-22.04 +# env: +# DB_DATABASE: phplist +# DB_USERNAME: root +# DB_PASSWORD: phplist +# BROADCAST_DRIVER: log +# services: +# mysql: +# image: mysql:5.7 +# env: +# MYSQL_ALLOW_EMPTY_PASSWORD: false +# MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }} +# MYSQL_DATABASE: ${{ env.DB_DATABASE }} +# ports: +# - 3306/tcp +# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 +# strategy: +# fail-fast: false +# matrix: +# php-versions: ['8.1'] +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# - name: Setup PHP, with composer and extensions +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php-versions }} +# extensions: mbstring, dom, fileinfo, mysql +# coverage: xdebug #optional +# - name: Install Symfony CLI +# run: | +# curl -sS https://get.symfony.com/cli/installer | bash +# mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony +# symfony version +# - name: Start mysql service +# run: sudo /etc/init.d/mysql start +# - name: Verify MySQL connection on host +# run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" +# - name: Set up database schema +# run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < resources/Database/Schema.sql +# - name: Get composer cache directory +# id: composer-cache +# run: echo "::set-output name=dir::$(composer config cache-files-dir)" +# - name: Cache composer dependencies +# uses: actions/cache@v3 +# with: +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- +# - name: Install Composer dependencies +# run: composer install --no-progress --prefer-dist --optimize-autoloader +# - name: Validating composer.json +# run: composer validate --no-check-all --no-check-lock --strict; +# - name: Linting all php files +# run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*; +# - name: Run units tests with phpunit +# run: vendor/bin/phpunit tests/Unit/ --testdox +# - name: Run integration tests with phpunit +# run: | +# export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }} +# export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }} +# export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} +# export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} +# export PHPLIST_DATABASE_HOST=127.0.0.1 +# vendor/bin/phpunit tests/Integration/ +# - name: Running the system tests +# run: vendor/bin/phpunit tests/System/ --testdox; +# - name: Running static analysis +# run: vendor/bin/phpstan analyse -c phpstan.neon; +# - name: Running PHPMD +# run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml; +# - name: Running PHP_CodeSniffer +# run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; diff --git a/.github/workflows/core-docs.yml b/.github/workflows/core-docs.yml index dc3a5bdf..92b2b235 100644 --- a/.github/workflows/core-docs.yml +++ b/.github/workflows/core-docs.yml @@ -1,89 +1,89 @@ -name: Publish Core Docs -on: [push, pull_request] -jobs: - make-restapi-docs: - name: Checkout phpList core and generate docs using `phpDocumentor` - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: 8.1 - extensions: mbstring, dom, fileinfo, mysql - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV - - name: Cache composer dependencies - uses: actions/cache@v3 - with: - path: ${{ env.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install current dependencies from composer.lock - run: composer install - - name: Install phpDocumentor - run: | - wget https://phpdoc.org/phpDocumentor.phar - chmod +x phpDocumentor.phar - mv phpDocumentor.phar /usr/local/bin/phpDocumentor - - name: Verify phpDocumentor version - run: phpDocumentor --version - - name: Generate documentation - run: composer run-php-documentor - - name: Zip phpDocumentor directory - run: zip -r phpdocumentor.zip docs/phpdocumentor - - name: Upload generated doc files - uses: actions/upload-artifact@v4 - with: - name: doc-files - path: phpdocumentor.zip - deploy-docs: - name: Deploy Core Docs - runs-on: ubuntu-22.04 - needs: make-restapi-docs - steps: - - name: Checkout phplist/core-docs - uses: actions/checkout@v3 - with: - repository: phpList/core-docs - fetch-depth: 0 - token: ${{ secrets.PUSH_CORE_DOCS }} - - name: Restore REST API Spec - uses: actions/download-artifact@v4 - with: - name: doc-files - - name: Unzip phpDocumentor - run: | - unzip phpdocumentor.zip - rm phpdocumentor.zip - - name: List Files - run: ls - - name: Sync old files with newly generated ones - run: rsync -av docs/phpdocumentor/* . - - name: Remove temporary directories - run: rm -rf docs - - name: Check if updates/changes - run: git status --porcelain > repo-changes.txt - - name: Check changes file - run: cat repo-changes.txt - - name: Verify updates - id: allow-deploy - run: | - if [ -s repo-changes.txt ]; then - echo "Updates made to documentation"; - echo 'DEPLOY=true' >> $GITHUB_ENV; - else - echo "No updates made to documentation. Deployment would be skipped."; - echo 'DEPLOY=false' >> $GITHUB_ENV; - fi - - name: Commit changes and deploy - if: ${{ env.DEPLOY == 'true' }} - run: | - rm repo-changes.txt - git config user.name "github-actions" - git config user.email "github-actions@restapi-docs.workflow" - git add . - git commit -s -m "phplist/core docs deployment `date`" - git push origin main --force +#name: Publish Core Docs +#on: [push, pull_request] +#jobs: +# make-restapi-docs: +# name: Checkout phpList core and generate docs using `phpDocumentor` +# runs-on: ubuntu-22.04 +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# - name: Setup PHP, with composer and extensions +# uses: shivammathur/setup-php@v2 +# with: +# php-version: 8.1 +# extensions: mbstring, dom, fileinfo, mysql +# - name: Get composer cache directory +# id: composer-cache +# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV +# - name: Cache composer dependencies +# uses: actions/cache@v3 +# with: +# path: ${{ env.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- +# - name: Install current dependencies from composer.lock +# run: composer install +# - name: Install phpDocumentor +# run: | +# wget https://phpdoc.org/phpDocumentor.phar +# chmod +x phpDocumentor.phar +# mv phpDocumentor.phar /usr/local/bin/phpDocumentor +# - name: Verify phpDocumentor version +# run: phpDocumentor --version +# - name: Generate documentation +# run: composer run-php-documentor +# - name: Zip phpDocumentor directory +# run: zip -r phpdocumentor.zip docs/phpdocumentor +# - name: Upload generated doc files +# uses: actions/upload-artifact@v4 +# with: +# name: doc-files +# path: phpdocumentor.zip +# deploy-docs: +# name: Deploy Core Docs +# runs-on: ubuntu-22.04 +# needs: make-restapi-docs +# steps: +# - name: Checkout phplist/core-docs +# uses: actions/checkout@v3 +# with: +# repository: phpList/core-docs +# fetch-depth: 0 +# token: ${{ secrets.PUSH_CORE_DOCS }} +# - name: Restore REST API Spec +# uses: actions/download-artifact@v4 +# with: +# name: doc-files +# - name: Unzip phpDocumentor +# run: | +# unzip phpdocumentor.zip +# rm phpdocumentor.zip +# - name: List Files +# run: ls +# - name: Sync old files with newly generated ones +# run: rsync -av docs/phpdocumentor/* . +# - name: Remove temporary directories +# run: rm -rf docs +# - name: Check if updates/changes +# run: git status --porcelain > repo-changes.txt +# - name: Check changes file +# run: cat repo-changes.txt +# - name: Verify updates +# id: allow-deploy +# run: | +# if [ -s repo-changes.txt ]; then +# echo "Updates made to documentation"; +# echo 'DEPLOY=true' >> $GITHUB_ENV; +# else +# echo "No updates made to documentation. Deployment would be skipped."; +# echo 'DEPLOY=false' >> $GITHUB_ENV; +# fi +# - name: Commit changes and deploy +# if: ${{ env.DEPLOY == 'true' }} +# run: | +# rm repo-changes.txt +# git config user.name "github-actions" +# git config user.email "github-actions@restapi-docs.workflow" +# git add . +# git commit -s -m "phplist/core docs deployment `date`" +# git push origin main --force diff --git a/.github/workflows/i18n-validate.yml b/.github/workflows/i18n-validate.yml index 4e49efa8..ca93ac1e 100644 --- a/.github/workflows/i18n-validate.yml +++ b/.github/workflows/i18n-validate.yml @@ -1,69 +1,69 @@ -name: I18n Validate - -on: - pull_request: - paths: - - 'resources/translations/**/*.xlf' - - 'composer.lock' - - 'composer.json' - -jobs: - validate-xliff: - runs-on: ubuntu-22.04 - - strategy: - fail-fast: false - matrix: - php: ['8.1'] - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: imap, zip - tools: composer:v2 - coverage: none - - - name: Cache Composer packages - uses: actions/cache@v4 - with: - path: | - ~/.composer/cache/files - key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer-${{ matrix.php }}- - - - name: Install dependencies (no dev autoloader scripts) - run: | - set -euo pipefail - composer install --no-interaction --no-progress --prefer-dist - - - name: Lint XLIFF with Symfony - run: | - set -euo pipefail - # Adjust the directory to match your repo layout - php bin/console lint:xliff resources/translations - - - name: Validate XLIFF XML with xmllint - run: | - set -euo pipefail - sudo apt-get update - sudo apt-get install -y --no-install-recommends libxml2-utils - # Adjust root dir; prune vendor; accept spaces/newlines safely - find resources/translations -type f -name '*.xlf' -not -path '*/vendor/*' -print0 \ - | xargs -0 -n1 xmllint --noout - - - name: Symfony translation sanity (extract dry-run) - run: | - set -euo pipefail - # Show what would be created/updated without writing files - php bin/console translation:extract en \ - --format=xlf \ - --domain=messages \ - --dump-messages \ - --no-interaction - # Note: omit --force to keep this a dry-run +#name: I18n Validate +# +#on: +# pull_request: +# paths: +# - 'resources/translations/**/*.xlf' +# - 'composer.lock' +# - 'composer.json' +# +#jobs: +# validate-xliff: +# runs-on: ubuntu-22.04 +# +# strategy: +# fail-fast: false +# matrix: +# php: ['8.1'] +# +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# +# - name: Setup PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php }} +# extensions: imap, zip +# tools: composer:v2 +# coverage: none +# +# - name: Cache Composer packages +# uses: actions/cache@v4 +# with: +# path: | +# ~/.composer/cache/files +# key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} +# restore-keys: | +# ${{ runner.os }}-composer-${{ matrix.php }}- +# +# - name: Install dependencies (no dev autoloader scripts) +# run: | +# set -euo pipefail +# composer install --no-interaction --no-progress --prefer-dist +# +# - name: Lint XLIFF with Symfony +# run: | +# set -euo pipefail +# # Adjust the directory to match your repo layout +# php bin/console lint:xliff resources/translations +# +# - name: Validate XLIFF XML with xmllint +# run: | +# set -euo pipefail +# sudo apt-get update +# sudo apt-get install -y --no-install-recommends libxml2-utils +# # Adjust root dir; prune vendor; accept spaces/newlines safely +# find resources/translations -type f -name '*.xlf' -not -path '*/vendor/*' -print0 \ +# | xargs -0 -n1 xmllint --noout +# +# - name: Symfony translation sanity (extract dry-run) +# run: | +# set -euo pipefail +# # Show what would be created/updated without writing files +# php bin/console translation:extract en \ +# --format=xlf \ +# --domain=messages \ +# --dump-messages \ +# --no-interaction +# # Note: omit --force to keep this a dry-run From 2e2cd31e4c3857573164f4773bba4635eecaf258 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 12:11:42 +0400 Subject: [PATCH 8/9] update config file --- .coderabbit.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 80459702..3cc5119b 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,8 +1,9 @@ +language: "en-US" reviews: + profile: "chill" + high_level_summary: true auto_review: enabled: true base_branches: - ".*" - pull_request: - summarize: true - update_description: true + drafts: false From ab671f0edbaa46a30ebb5a2d2948aa31ff227d58 Mon Sep 17 00:00:00 2001 From: Tatevik Date: Thu, 23 Oct 2025 12:56:09 +0400 Subject: [PATCH 9/9] Revert "comment out" This reverts commit 2246e490b4fb1385d09a855ac608fc0cd989a2c1. --- .github/workflows/ci.yml | 156 ++++++++++++------------ .github/workflows/core-docs.yml | 178 ++++++++++++++-------------- .github/workflows/i18n-validate.yml | 138 ++++++++++----------- 3 files changed, 236 insertions(+), 236 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f8fd1e1..43dea8d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,78 +1,78 @@ -#name: phpList Core Build -#on: [push, pull_request] -#jobs: -# main: -# name: phpList on PHP ${{ matrix.php-versions }} [Build, Test] -# runs-on: ubuntu-22.04 -# env: -# DB_DATABASE: phplist -# DB_USERNAME: root -# DB_PASSWORD: phplist -# BROADCAST_DRIVER: log -# services: -# mysql: -# image: mysql:5.7 -# env: -# MYSQL_ALLOW_EMPTY_PASSWORD: false -# MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }} -# MYSQL_DATABASE: ${{ env.DB_DATABASE }} -# ports: -# - 3306/tcp -# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -# strategy: -# fail-fast: false -# matrix: -# php-versions: ['8.1'] -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup PHP, with composer and extensions -# uses: shivammathur/setup-php@v2 -# with: -# php-version: ${{ matrix.php-versions }} -# extensions: mbstring, dom, fileinfo, mysql -# coverage: xdebug #optional -# - name: Install Symfony CLI -# run: | -# curl -sS https://get.symfony.com/cli/installer | bash -# mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony -# symfony version -# - name: Start mysql service -# run: sudo /etc/init.d/mysql start -# - name: Verify MySQL connection on host -# run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" -# - name: Set up database schema -# run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < resources/Database/Schema.sql -# - name: Get composer cache directory -# id: composer-cache -# run: echo "::set-output name=dir::$(composer config cache-files-dir)" -# - name: Cache composer dependencies -# uses: actions/cache@v3 -# with: -# path: ${{ steps.composer-cache.outputs.dir }} -# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} -# restore-keys: ${{ runner.os }}-composer- -# - name: Install Composer dependencies -# run: composer install --no-progress --prefer-dist --optimize-autoloader -# - name: Validating composer.json -# run: composer validate --no-check-all --no-check-lock --strict; -# - name: Linting all php files -# run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*; -# - name: Run units tests with phpunit -# run: vendor/bin/phpunit tests/Unit/ --testdox -# - name: Run integration tests with phpunit -# run: | -# export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }} -# export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }} -# export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} -# export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} -# export PHPLIST_DATABASE_HOST=127.0.0.1 -# vendor/bin/phpunit tests/Integration/ -# - name: Running the system tests -# run: vendor/bin/phpunit tests/System/ --testdox; -# - name: Running static analysis -# run: vendor/bin/phpstan analyse -c phpstan.neon; -# - name: Running PHPMD -# run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml; -# - name: Running PHP_CodeSniffer -# run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; +name: phpList Core Build +on: [push, pull_request] +jobs: + main: + name: phpList on PHP ${{ matrix.php-versions }} [Build, Test] + runs-on: ubuntu-22.04 + env: + DB_DATABASE: phplist + DB_USERNAME: root + DB_PASSWORD: phplist + BROADCAST_DRIVER: log + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }} + MYSQL_DATABASE: ${{ env.DB_DATABASE }} + ports: + - 3306/tcp + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + strategy: + fail-fast: false + matrix: + php-versions: ['8.1'] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, mysql + coverage: xdebug #optional + - name: Install Symfony CLI + run: | + curl -sS https://get.symfony.com/cli/installer | bash + mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony + symfony version + - name: Start mysql service + run: sudo /etc/init.d/mysql start + - name: Verify MySQL connection on host + run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" + - name: Set up database schema + run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < resources/Database/Schema.sql + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + - name: Validating composer.json + run: composer validate --no-check-all --no-check-lock --strict; + - name: Linting all php files + run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*; + - name: Run units tests with phpunit + run: vendor/bin/phpunit tests/Unit/ --testdox + - name: Run integration tests with phpunit + run: | + export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }} + export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }} + export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }} + export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }} + export PHPLIST_DATABASE_HOST=127.0.0.1 + vendor/bin/phpunit tests/Integration/ + - name: Running the system tests + run: vendor/bin/phpunit tests/System/ --testdox; + - name: Running static analysis + run: vendor/bin/phpstan analyse -c phpstan.neon; + - name: Running PHPMD + run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml; + - name: Running PHP_CodeSniffer + run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; diff --git a/.github/workflows/core-docs.yml b/.github/workflows/core-docs.yml index 92b2b235..dc3a5bdf 100644 --- a/.github/workflows/core-docs.yml +++ b/.github/workflows/core-docs.yml @@ -1,89 +1,89 @@ -#name: Publish Core Docs -#on: [push, pull_request] -#jobs: -# make-restapi-docs: -# name: Checkout phpList core and generate docs using `phpDocumentor` -# runs-on: ubuntu-22.04 -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Setup PHP, with composer and extensions -# uses: shivammathur/setup-php@v2 -# with: -# php-version: 8.1 -# extensions: mbstring, dom, fileinfo, mysql -# - name: Get composer cache directory -# id: composer-cache -# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV -# - name: Cache composer dependencies -# uses: actions/cache@v3 -# with: -# path: ${{ env.dir }} -# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} -# restore-keys: ${{ runner.os }}-composer- -# - name: Install current dependencies from composer.lock -# run: composer install -# - name: Install phpDocumentor -# run: | -# wget https://phpdoc.org/phpDocumentor.phar -# chmod +x phpDocumentor.phar -# mv phpDocumentor.phar /usr/local/bin/phpDocumentor -# - name: Verify phpDocumentor version -# run: phpDocumentor --version -# - name: Generate documentation -# run: composer run-php-documentor -# - name: Zip phpDocumentor directory -# run: zip -r phpdocumentor.zip docs/phpdocumentor -# - name: Upload generated doc files -# uses: actions/upload-artifact@v4 -# with: -# name: doc-files -# path: phpdocumentor.zip -# deploy-docs: -# name: Deploy Core Docs -# runs-on: ubuntu-22.04 -# needs: make-restapi-docs -# steps: -# - name: Checkout phplist/core-docs -# uses: actions/checkout@v3 -# with: -# repository: phpList/core-docs -# fetch-depth: 0 -# token: ${{ secrets.PUSH_CORE_DOCS }} -# - name: Restore REST API Spec -# uses: actions/download-artifact@v4 -# with: -# name: doc-files -# - name: Unzip phpDocumentor -# run: | -# unzip phpdocumentor.zip -# rm phpdocumentor.zip -# - name: List Files -# run: ls -# - name: Sync old files with newly generated ones -# run: rsync -av docs/phpdocumentor/* . -# - name: Remove temporary directories -# run: rm -rf docs -# - name: Check if updates/changes -# run: git status --porcelain > repo-changes.txt -# - name: Check changes file -# run: cat repo-changes.txt -# - name: Verify updates -# id: allow-deploy -# run: | -# if [ -s repo-changes.txt ]; then -# echo "Updates made to documentation"; -# echo 'DEPLOY=true' >> $GITHUB_ENV; -# else -# echo "No updates made to documentation. Deployment would be skipped."; -# echo 'DEPLOY=false' >> $GITHUB_ENV; -# fi -# - name: Commit changes and deploy -# if: ${{ env.DEPLOY == 'true' }} -# run: | -# rm repo-changes.txt -# git config user.name "github-actions" -# git config user.email "github-actions@restapi-docs.workflow" -# git add . -# git commit -s -m "phplist/core docs deployment `date`" -# git push origin main --force +name: Publish Core Docs +on: [push, pull_request] +jobs: + make-restapi-docs: + name: Checkout phpList core and generate docs using `phpDocumentor` + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + extensions: mbstring, dom, fileinfo, mysql + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV + - name: Cache composer dependencies + uses: actions/cache@v3 + with: + path: ${{ env.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install current dependencies from composer.lock + run: composer install + - name: Install phpDocumentor + run: | + wget https://phpdoc.org/phpDocumentor.phar + chmod +x phpDocumentor.phar + mv phpDocumentor.phar /usr/local/bin/phpDocumentor + - name: Verify phpDocumentor version + run: phpDocumentor --version + - name: Generate documentation + run: composer run-php-documentor + - name: Zip phpDocumentor directory + run: zip -r phpdocumentor.zip docs/phpdocumentor + - name: Upload generated doc files + uses: actions/upload-artifact@v4 + with: + name: doc-files + path: phpdocumentor.zip + deploy-docs: + name: Deploy Core Docs + runs-on: ubuntu-22.04 + needs: make-restapi-docs + steps: + - name: Checkout phplist/core-docs + uses: actions/checkout@v3 + with: + repository: phpList/core-docs + fetch-depth: 0 + token: ${{ secrets.PUSH_CORE_DOCS }} + - name: Restore REST API Spec + uses: actions/download-artifact@v4 + with: + name: doc-files + - name: Unzip phpDocumentor + run: | + unzip phpdocumentor.zip + rm phpdocumentor.zip + - name: List Files + run: ls + - name: Sync old files with newly generated ones + run: rsync -av docs/phpdocumentor/* . + - name: Remove temporary directories + run: rm -rf docs + - name: Check if updates/changes + run: git status --porcelain > repo-changes.txt + - name: Check changes file + run: cat repo-changes.txt + - name: Verify updates + id: allow-deploy + run: | + if [ -s repo-changes.txt ]; then + echo "Updates made to documentation"; + echo 'DEPLOY=true' >> $GITHUB_ENV; + else + echo "No updates made to documentation. Deployment would be skipped."; + echo 'DEPLOY=false' >> $GITHUB_ENV; + fi + - name: Commit changes and deploy + if: ${{ env.DEPLOY == 'true' }} + run: | + rm repo-changes.txt + git config user.name "github-actions" + git config user.email "github-actions@restapi-docs.workflow" + git add . + git commit -s -m "phplist/core docs deployment `date`" + git push origin main --force diff --git a/.github/workflows/i18n-validate.yml b/.github/workflows/i18n-validate.yml index ca93ac1e..4e49efa8 100644 --- a/.github/workflows/i18n-validate.yml +++ b/.github/workflows/i18n-validate.yml @@ -1,69 +1,69 @@ -#name: I18n Validate -# -#on: -# pull_request: -# paths: -# - 'resources/translations/**/*.xlf' -# - 'composer.lock' -# - 'composer.json' -# -#jobs: -# validate-xliff: -# runs-on: ubuntu-22.04 -# -# strategy: -# fail-fast: false -# matrix: -# php: ['8.1'] -# -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Setup PHP -# uses: shivammathur/setup-php@v2 -# with: -# php-version: ${{ matrix.php }} -# extensions: imap, zip -# tools: composer:v2 -# coverage: none -# -# - name: Cache Composer packages -# uses: actions/cache@v4 -# with: -# path: | -# ~/.composer/cache/files -# key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} -# restore-keys: | -# ${{ runner.os }}-composer-${{ matrix.php }}- -# -# - name: Install dependencies (no dev autoloader scripts) -# run: | -# set -euo pipefail -# composer install --no-interaction --no-progress --prefer-dist -# -# - name: Lint XLIFF with Symfony -# run: | -# set -euo pipefail -# # Adjust the directory to match your repo layout -# php bin/console lint:xliff resources/translations -# -# - name: Validate XLIFF XML with xmllint -# run: | -# set -euo pipefail -# sudo apt-get update -# sudo apt-get install -y --no-install-recommends libxml2-utils -# # Adjust root dir; prune vendor; accept spaces/newlines safely -# find resources/translations -type f -name '*.xlf' -not -path '*/vendor/*' -print0 \ -# | xargs -0 -n1 xmllint --noout -# -# - name: Symfony translation sanity (extract dry-run) -# run: | -# set -euo pipefail -# # Show what would be created/updated without writing files -# php bin/console translation:extract en \ -# --format=xlf \ -# --domain=messages \ -# --dump-messages \ -# --no-interaction -# # Note: omit --force to keep this a dry-run +name: I18n Validate + +on: + pull_request: + paths: + - 'resources/translations/**/*.xlf' + - 'composer.lock' + - 'composer.json' + +jobs: + validate-xliff: + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + php: ['8.1'] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: imap, zip + tools: composer:v2 + coverage: none + + - name: Cache Composer packages + uses: actions/cache@v4 + with: + path: | + ~/.composer/cache/files + key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer-${{ matrix.php }}- + + - name: Install dependencies (no dev autoloader scripts) + run: | + set -euo pipefail + composer install --no-interaction --no-progress --prefer-dist + + - name: Lint XLIFF with Symfony + run: | + set -euo pipefail + # Adjust the directory to match your repo layout + php bin/console lint:xliff resources/translations + + - name: Validate XLIFF XML with xmllint + run: | + set -euo pipefail + sudo apt-get update + sudo apt-get install -y --no-install-recommends libxml2-utils + # Adjust root dir; prune vendor; accept spaces/newlines safely + find resources/translations -type f -name '*.xlf' -not -path '*/vendor/*' -print0 \ + | xargs -0 -n1 xmllint --noout + + - name: Symfony translation sanity (extract dry-run) + run: | + set -euo pipefail + # Show what would be created/updated without writing files + php bin/console translation:extract en \ + --format=xlf \ + --domain=messages \ + --dump-messages \ + --no-interaction + # Note: omit --force to keep this a dry-run