diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7cc92e7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +version: 2 +updates: + # Keep GitHub Actions up-to-date + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: #all in one PR + github-actions-all: + patterns: + - "*" + + # Keep NPM dependencies up-to-date + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index fceb096..34ce462 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 @@ -73,7 +70,7 @@ jobs: ../../vendor/bin/phpcs lib/ ./*.php - name: CS Fixer - if: matrix.php-versions == '8.1' + if: matrix.php-versions == '8.3' run: | cd galette-core/galette/plugins/plugin-maps ../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff @@ -109,21 +106,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: @@ -177,37 +176,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-maps - - 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/GaletteMaps/Coordinates.php b/lib/GaletteMaps/Coordinates.php index 03f0b6e..da5ecb3 100644 --- a/lib/GaletteMaps/Coordinates.php +++ b/lib/GaletteMaps/Coordinates.php @@ -39,8 +39,8 @@ class Coordinates { - public const TABLE = 'coordinates'; - public const PK = 'id_adh'; + public const string TABLE = 'coordinates'; + public const string PK = 'id_adh'; /** * Retrieve member coordinates diff --git a/lib/GaletteMaps/PluginGaletteMaps.php b/lib/GaletteMaps/PluginGaletteMaps.php index 387637a..36da5e6 100644 --- a/lib/GaletteMaps/PluginGaletteMaps.php +++ b/lib/GaletteMaps/PluginGaletteMaps.php @@ -23,7 +23,13 @@ namespace GaletteMaps; +use DI\Attribute\Inject; +use Galette\Core\Db; use Galette\Core\Login; +use Galette\Core\Plugins\InstallableInterface; +use Galette\Core\Plugins\MenuProviderInterface; +use Galette\Core\Plugins\DashboardProviderInterface; +use Galette\Core\Plugins\MemberActionProviderInterface; use Galette\Entity\Adherent; use Galette\Core\GalettePlugin; @@ -33,14 +39,17 @@ * @author Johan Cwiklinski */ -class PluginGaletteMaps extends GalettePlugin +class PluginGaletteMaps extends GalettePlugin implements InstallableInterface, MenuProviderInterface, DashboardProviderInterface, MemberActionProviderInterface { + #[Inject] + private readonly Db $zdb; //@phpstan-ignore-line injected from DI + /** * Extra menus entries * * @return array> */ - public static function getMenusContents(): array + public function getMenus(): array { /** @var Login $login */ global $login; @@ -67,7 +76,7 @@ public static function getMenusContents(): array * * @return array> */ - public static function getPublicMenusItemsList(): array + public function getPublicMenus(): array { return [ [ @@ -85,7 +94,7 @@ public static function getPublicMenusItemsList(): array * * @return array> */ - public static function getMyDashboardsContents(): array + public function getMyDashboards(): array { /** @var Login $login */ global $login; @@ -111,7 +120,7 @@ public static function getMyDashboardsContents(): array * * @return array> */ - public static function getDashboardsContents(): array + public function getDashboards(): array { return []; } @@ -121,9 +130,9 @@ public static function getDashboardsContents(): array * * @param Adherent $member Member instance * - * @return array|array[] + * @return array> */ - public static function getListActionsContents(Adherent $member): array + public function getListActions(Adherent $member): array { return [ [ @@ -149,9 +158,9 @@ public static function getListActionsContents(Adherent $member): array * * @return array> */ - public static function getDetailedActionsContents(Adherent $member): array + public function getDetailedActions(Adherent $member): array { - return static::getListActionsContents($member); + return $this->getListActions($member); } /** @@ -159,8 +168,16 @@ public static function getDetailedActionsContents(Adherent $member): array * * @return array> */ - public static function getBatchActionsContents(): array + public function getBatchActions(): array { return []; } + + /** + * Is the plugin fully installed (including database, extra configuration, etc.)? + */ + public function isInstalled(): bool + { + return $this->zdb->tableExists(MAPS_PREFIX . Coordinates::TABLE); + } }