Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Jun 7, 2024
2 parents 6fa0597 + e3924cf commit fe137b8
Show file tree
Hide file tree
Showing 48 changed files with 1,714 additions and 1,150 deletions.
30 changes: 16 additions & 14 deletions .composer-require-checker.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"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",
Expand All @@ -24,14 +30,18 @@
"GALETTE_CARD_ROWS",
"GALETTE_CARD_WIDTH",
"GALETTE_COMPAT_VERSION",
"GALETTE_SYSCONFIG_PATH",
"GALETTE_CONFIG_PATH",
"GALETTE_DATA_PATH",
"GALETTE_DB_VERSION",
"GALETTE_DOCUMENTS_PATH",
"GALETTE_DOWNLOADS_URI",
"GALETTE_EXPORTS_PATH",
"GALETTE_FILES_PATH",
"GALETTE_IMPORTS_PATH",
"GALETTE_LOGS_PATH",
"GALETTE_MODE",
"GALETTE_DEBUG",
"GALETTE_NIGHTLY",
"GALETTE_PHOTOS_PATH",
"GALETTE_PLUGINS_PATH",
Expand All @@ -49,11 +59,6 @@
"GALETTE_PGSQL_MIN",
"GALETTE_DISPLAY_VERSION",
"GALETTE_PHP_MIN",
"_T",
"__",
"_Tn",
"_Tx",
"_Tnx",

"// Galette db constants (not detected as they are dynamically declared)",
"HOST_DB",
Expand All @@ -68,12 +73,14 @@

"//know but not detected Galette function,",
"remove_remarks",
"custom_html_entity_decode",
"get_form_value",
"get_numeric_form_value",
"isValidWebUrl",
"remove_remarks",
"split_sql_file",
"_T",
"__",
"_Tn",
"_Tx",
"_Tnx",

"// XHProf PECL extension",
"XHProfRuns_Default",
Expand All @@ -92,12 +99,7 @@
"DI\\Container",
"DI\\ContainerBuilder",
"DI\\Bridge\\Slim\\App",

"// Should not error (not used) but...",
"mt_rand",
"rand",
"random_int",

"DI\\Attribute\\Inject",

"// Not detected, do not know why.",
"Psr\\Http\\Server\\RequestHandlerInterface"
Expand Down
167 changes: 159 additions & 8 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@ on:
- 'feature/*'
- 'hotfix/*'
- 'release/*'
tags:
- '*'
pull_request:
# Enable manual run
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
ubuntu-latest:
lint:
runs-on: ubuntu-latest
name: "Lint on PHP ${{ matrix.php-versions }}"

strategy:
matrix:
php-versions: [ '8.1', '8.2' ]
php-versions: [ '8.1', '8.3' ]
coverage: [none]
fail-fast: false

name: PHP ${{ matrix.php-versions }} on ubuntu-latest

steps:
- name: PHP
uses: shivammathur/setup-php@v2
Expand All @@ -31,15 +38,15 @@ jobs:
coverage: ${{ matrix.coverage }}

- name: Checkout Galette core
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: galette/galette
path: galette-core
fetch-depth: 1
ref: develop

- name: Checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: galette-core/galette/plugins/plugin-paypal

Expand All @@ -49,7 +56,7 @@ jobs:
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -63,10 +70,154 @@ jobs:
- name: CS
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/phpcs -n -p --standard=../../../phpcs-rules.xml lib/ ./*.php
../../vendor/bin/phpcs lib/ ./*.php
- name: Twig CS
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/twigcs templates/default --severity error --display blocking
- name: Check missing symbols
run: |
cd galette-core/galette/plugins/plugin-paypal
composer require maglnet/composer-require-checker -W
vendor/bin/composer-require-checker check --config-file=.composer-require-checker.config.json ../../composer.json
if: matrix.php-versions == '8.3'

- name: PHPStan checks
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress
- name: Headers checks
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/docheader --docheader=../../../.docheader check lib ./*.php
unit-tests:
runs-on: ubuntu-latest

strategy:
matrix:
include:
#always tests higher stable php version with lower db version
#enable coverage on higher stable php version with higher postrgesql version
#lower php version
- { php-version: "8.1", db-image: "mysql:5.7", coverage: none, always: false }
- { php-version: "8.1", db-image: "mysql:8.1", coverage: none, always: false }
- { php-version: "8.1", db-image: "mariadb:10.4", coverage: none, always: false }
- { php-version: "8.1", db-image: "mariadb:11", coverage: none, always: false }
- { php-version: "8.1", db-image: "postgres:11", coverage: none, always: false }
- { php-version: "8.1", db-image: "postgres:16", coverage: none, always: false }
#higher stable php version
- { php-version: "8.3", db-image: "mysql:5.7", coverage: none, always: true }
- { php-version: "8.3", db-image: "mysql:8.1", coverage: none, always: false }
- { php-version: "8.3", db-image: "mariadb:10.4", coverage: none, always: true }
- { php-version: "8.3", db-image: "mariadb:11", coverage: none, always: false }
- { php-version: "8.3", db-image: "postgres:11", coverage: none, always: true }
- { php-version: "8.3", db-image: "postgres:16", coverage: none, always: true }
fail-fast: false

env:
skip: ${{ matrix.always == false && (github.event_name == 'pull_request' || github.repository != 'galette/galette-paypal' || !(github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags'))) }}
DB: ${{ matrix.db-image }}

services:
# Label used to access the service container
db:
# Docker Hub image
image: ${{ matrix.db-image }}
# Provide env variables for both mysql and pgsql
env:
POSTGRES_USER: galette_tests
POSTGRES_PASSWORD: g@l3tte
POSTGRES_DB: galette_tests
MYSQL_USER: galette_tests
MYSQL_PASSWORD: g@l3tte
MYSQL_ROOT_PASSWORD: g@l3tte
MYSQL_DATABASE: galette_tests
# Open network ports for both mysql and pgsql
ports:
- 3306:3306
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd="bash -c 'if [[ -n $(command -v pg_isready) ]]; then pg_isready; else if [[ -n $(command -v mysqladmin) ]]; then mysqladmin ping; else mariadb-admin ping; fi fi'"
--health-interval=10s
--health-timeout=5s
--health-retries=10
name: PHP ${{ matrix.php-version }} ${{ matrix.db-image }} ${{ (matrix.always == false && (github.event_name == 'pull_request' || github.repository != 'galette/galette' || !(github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')))) && ' (skipped)' || matrix.coverage == 'xdebug' && ' (with coverage)' || ''}}

steps:
- name: PHP
if: env.skip != 'true'
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"
if: env.skip != 'true'
run: |
php --version
composer --version
echo "node $(node --version)"
echo "npm $(npm --version)"
docker exec ${{ job.services.db.id }} bash -c "if [[ -n \$(command -v psql) ]]; then psql --version; else if [[ -n \$(command -v mysql) ]]; then mysql --version; else mariadb --version; fi fi"
- name: Checkout Galette core
if: env.skip != 'true'
uses: actions/checkout@v4
with:
repository: galette/galette
path: galette-core
fetch-depth: 1
ref: develop

- name: Checkout plugin
uses: actions/checkout@v4
with:
path: galette-core/galette/plugins/plugin-paypal

- name: "Restore dependencies cache"
if: env.skip != 'true'
uses: actions/cache@v4
with:
path: |
~/.composer/cache/
~/.npm/_cacache/
key: "${{ runner.os }}-galette-${{ matrix.php-version }}-${{ hashFiles('galette/composer.lock', 'package-lock.json') }}"
restore-keys: |
${{ runner.os }}-galette-${{ matrix.php-version }}-
- name: Install dependencies
if: env.skip != 'true'
run: |
cd galette-core
bin/install_deps
- name: Init for PostgreSQL
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
run: |
PGPASSWORD=g@l3tte psql -d galette_tests -a -f galette-core/galette/install/scripts/pgsql.sql -U galette_tests -h localhost
PGPASSWORD=g@l3tte psql -d galette_tests -a -f galette-core/galette/plugins/plugin-paypal/scripts/pgsql.sql -U galette_tests -h localhost
if: env.skip != 'true' && startsWith(matrix.db-image, 'postgres')

- name: Init for MariaDB
run: |
mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306
mysql -e 'use galette_tests; source galette-core/galette/install/scripts/mysql.sql;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306
mysql -e 'use galette_tests; source galette-core/galette/plugins/plugin-paypal/scripts/mysql.sql;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306
if: env.skip != 'true' && (startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb'))

- name: Unit tests
if: env.skip != 'true'
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/GalettePaypal/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.exvim*
dist/
tempcache/
tests/coverage/
22 changes: 4 additions & 18 deletions _config.inc.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Configuration file for Paypal plugin
*
* PHP version 5
*
* Copyright © 2011-2014 The Galette Team
* Copyright © 2003-2024 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
* This file is part of Galette (https://galette.eu).
*
* Galette is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -23,16 +17,8 @@
*
* You should have received a copy of the GNU General Public License
* along with Galette. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugins
* @package GalettePaypal
*
* @author Johan Cwiklinski <[email protected]>
* @copyright 2011-2014 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @version SVN: $Id$
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2011-06-01
*/

declare(strict_types=1);

define('PAYPAL_PREFIX', 'paypal_');
24 changes: 6 additions & 18 deletions _define.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
* Configuration file for Paypal plugin
*
* PHP version 5
*
* Copyright © 2011-2023 The Galette Team
* Copyright © 2003-2024 The Galette Team
*
* This file is part of Galette (https://galette.eu).
*
Expand All @@ -23,24 +17,18 @@
*
* You should have received a copy of the GNU General Public License
* along with Galette. If not, see <http://www.gnu.org/licenses/>.
*
* @category Plugins
* @package GalettePaypal
*
* @author Johan Cwiklinski <[email protected]>
* @copyright 2011-2023 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link https://galette.eu
*/

declare(strict_types=1);

$this->register(
'Galette Paypal', //Name
'Paypal integration', //Short description
'Johan Cwiklinski', //Author
'2.0.0', //Version
'1.0.0', //Galette compatible version
'2.1.0', //Version
'1.1.0', //Galette compatible version
'paypal', //routing name and translation domain
'2023-12-07', //Release date
'2024-06-08', //Release date
[ //Permissions needed
'paypal_preferences' => 'staff',
'store_paypal_preferences' => 'staff',
Expand Down
Loading

0 comments on commit fe137b8

Please sign in to comment.