diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index bf858c9..e6a9da4 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -5,9 +5,6 @@ on: branches: - master - develop - - 'feature/*' - - 'hotfix/*' - - 'release/*' tags: - '*' pull_request: @@ -25,7 +22,7 @@ jobs: strategy: matrix: - php-versions: [ '8.2', '8.5' ] + php-versions: [ '8.3', '8.5' ] coverage: [none] fail-fast: false @@ -100,21 +97,23 @@ jobs: 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.2", db-image: "mysql:5.7", coverage: none, always: false } - - { php-version: "8.2", db-image: "mysql:8.1", coverage: none, always: false } - - { php-version: "8.2", db-image: "mariadb:10.4", coverage: none, always: false } - - { php-version: "8.2", db-image: "mariadb:11", coverage: none, always: false } - - { php-version: "8.2", db-image: "postgres:11", coverage: none, always: false } - - { php-version: "8.2", db-image: "postgres:16", coverage: none, always: false } + #enable coverage on higher stable php version with higher PostgreSQL version + #cache must be disabled on one always enabled build (not coverage one, this already takes much time than others) #higher stable php version - - { php-version: "8.5", db-image: "mysql:5.7", coverage: none, always: true } - - { php-version: "8.5", db-image: "mysql:8.1", coverage: none, always: false } - - { php-version: "8.5", db-image: "mariadb:10.4", coverage: none, always: true } - - { php-version: "8.5", db-image: "mariadb:11", coverage: none, always: false } - - { php-version: "8.5", db-image: "postgres:11", coverage: none, always: true } - - { php-version: "8.5", db-image: "postgres:16", coverage: none, always: true } + - { php-version: "8.5", db-image: "postgres:13", coverage: none, cache: true, always: true } + - { php-version: "8.5", db-image: "postgres:17", coverage: none, cache: true, always: true } + - { php-version: "8.5", db-image: "mysql:8.0", coverage: none, cache: true, always: true } + - { php-version: "8.5", db-image: "mysql:9.1", coverage: none, cache: true, always: false } + - { php-version: "8.5", db-image: "mariadb:10.5", coverage: none, cache: false, always: true } + - { php-version: "8.5", db-image: "mariadb:11.6", coverage: none, cache: true, always: false } + #always one test with lower php version + #lower php version + - { php-version: "8.3", db-image: "postgres:13", coverage: none, cache: true, always: false } + - { php-version: "8.3", db-image: "postgres:17", coverage: none, cache: true, always: true } + - { php-version: "8.3", db-image: "mysql:8.0", coverage: none, cache: true, always: false } + - { php-version: "8.3", db-image: "mysql:9.1", coverage: none, cache: true, always: false } + - { php-version: "8.3", db-image: "mariadb:10.5", coverage: none, cache: true, always: false } + - { php-version: "8.3", db-image: "mariadb:11.6", coverage: none, cache: true, always: false } fail-fast: false env: @@ -168,37 +167,17 @@ jobs: 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 + - name: Build Galette if: env.skip != 'true' - uses: actions/checkout@v4 + uses: galette/.github/actions/build-galette@main with: - repository: galette/galette - path: galette-core - fetch-depth: 1 - ref: develop + php-version: ${{ matrix.php-version }} - name: Checkout plugin uses: actions/checkout@v4 with: path: galette-core/galette/plugins/plugin-activities - - 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 diff --git a/lib/GaletteActivities/Entity/Activity.php b/lib/GaletteActivities/Entity/Activity.php index b87effc..fbbc3a7 100644 --- a/lib/GaletteActivities/Entity/Activity.php +++ b/lib/GaletteActivities/Entity/Activity.php @@ -39,8 +39,8 @@ class Activity { use EntityHelper; - public const TABLE = 'activities'; - public const PK = 'id_activity'; + public const string TABLE = 'activities'; + public const string PK = 'id_activity'; private Db $zdb; /** @var array */ diff --git a/lib/GaletteActivities/Entity/Subscription.php b/lib/GaletteActivities/Entity/Subscription.php index 1b25c67..9613428 100644 --- a/lib/GaletteActivities/Entity/Subscription.php +++ b/lib/GaletteActivities/Entity/Subscription.php @@ -39,8 +39,8 @@ class Subscription { use EntityHelper; - public const TABLE = 'subscriptions'; - public const PK = 'id_subscription'; + public const string TABLE = 'subscriptions'; + public const string PK = 'id_subscription'; private Db $zdb; /** @var array */ diff --git a/lib/GaletteActivities/Filters/SubscriptionsList.php b/lib/GaletteActivities/Filters/SubscriptionsList.php index 22d4fac..03e0f12 100644 --- a/lib/GaletteActivities/Filters/SubscriptionsList.php +++ b/lib/GaletteActivities/Filters/SubscriptionsList.php @@ -50,9 +50,9 @@ class SubscriptionsList extends Pagination { use DatesHelper; - public const DATE_END = 0; - public const DATE_SUBSCRIPTION = 1; - public const DATE_CREATION = 2; + public const int DATE_END = 0; + public const int DATE_SUBSCRIPTION = 1; + public const int DATE_CREATION = 2; //filters private string|int|null $activity_filter; private string|int|null $member_filter; diff --git a/lib/GaletteActivities/PluginGaletteActivities.php b/lib/GaletteActivities/PluginGaletteActivities.php index 068b033..845448b 100644 --- a/lib/GaletteActivities/PluginGaletteActivities.php +++ b/lib/GaletteActivities/PluginGaletteActivities.php @@ -42,7 +42,7 @@ class PluginGaletteActivities extends GalettePlugin implements MenuProviderInterface, MemberActionProviderInterface { #[Inject] - private readonly Db $zdb; //@phpstan-ignore property.uninitializedReadonly (injected from DI) + private readonly Db $zdb; //@phpstan-ignore property.uninitializedReadonly,property.onlyRead (injected from DI) /** * Get plugins menus @@ -151,16 +151,8 @@ public function getBatchActions(): array */ public function isInstalled(): bool { - try { - $this->zdb->execute($this->zdb->select(ACTIVITIES_PREFIX . Activity::TABLE)->limit(1)); - $this->zdb->execute($this->zdb->select(ACTIVITIES_PREFIX . Subscription::TABLE)->limit(1)); - return true; - } catch (\Throwable $e) { - if (!$this->zdb->isMissingTableException($e)) { - throw $e; - } - - } - return false; + return + $this->zdb->tableExists(ACTIVITIES_PREFIX . Activity::TABLE) && + $this->zdb->tableExists(ACTIVITIES_PREFIX . Subscription::TABLE); } } diff --git a/lib/GaletteActivities/Repository/Activities.php b/lib/GaletteActivities/Repository/Activities.php index 10e836c..a46ba09 100644 --- a/lib/GaletteActivities/Repository/Activities.php +++ b/lib/GaletteActivities/Repository/Activities.php @@ -43,8 +43,8 @@ class Activities extends Repository { private int $count; - public const ORDERBY_DATE = 0; - public const ORDERBY_NAME = 1; + public const int ORDERBY_DATE = 0; + public const int ORDERBY_NAME = 1; /** * Constructor diff --git a/lib/GaletteActivities/Repository/Subscriptions.php b/lib/GaletteActivities/Repository/Subscriptions.php index 89a2d99..0823ee0 100644 --- a/lib/GaletteActivities/Repository/Subscriptions.php +++ b/lib/GaletteActivities/Repository/Subscriptions.php @@ -44,16 +44,16 @@ class Subscriptions private int $count; private float $sum; - public const ORDERBY_ACTIVITY = 0; - public const ORDERBY_MEMBER = 1; - public const ORDERBY_SUBSCRIPTIONDATE = 2; - public const ORDERBY_ENDDATE = 3; - public const ORDERBY_PAID = 3; - public const ORDERBY_AMOUNT = 4; - - public const FILTER_DC_PAID = 0; - public const FILTER_PAID = 1; - public const FILTER_NOT_PAID = 2; + public const int ORDERBY_ACTIVITY = 0; + public const int ORDERBY_MEMBER = 1; + public const int ORDERBY_SUBSCRIPTIONDATE = 2; + public const int ORDERBY_ENDDATE = 3; + public const int ORDERBY_PAID = 3; + public const int ORDERBY_AMOUNT = 4; + + public const int FILTER_DC_PAID = 0; + public const int FILTER_PAID = 1; + public const int FILTER_NOT_PAID = 2; /** * Constructor