Skip to content

Commit

Permalink
feat: Add LiveSync (#187)
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Désiles <[email protected]>
  • Loading branch information
Venatum and jokesterfr authored Nov 20, 2023
1 parent a6d042e commit bb5c90d
Show file tree
Hide file tree
Showing 17 changed files with 290 additions and 190 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build-release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: github.event.release.draft == false
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install composer dependencies
run: composer install --no-dev -o
Expand All @@ -21,7 +21,7 @@ jobs:
VERSION: ${{ github.event.release.tag_name }}

- name: Create & upload artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
path: ./
Expand All @@ -32,7 +32,7 @@ jobs:
needs: [build]
steps:
- name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}

Expand All @@ -45,7 +45,7 @@ jobs:
CONFIG_FILE: ${{ secrets.PS_EVENTBUS_PRODUCTION_CONFIG }}

- name: Publish the production zip
uses: actions/upload-release-asset@v1.0.1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GA_ACCESS_TOKEN }}
with:
Expand All @@ -60,7 +60,7 @@ jobs:
needs: [build]
steps:
- name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}

Expand All @@ -73,7 +73,7 @@ jobs:
CONFIG_FILE: ${{ secrets.PS_EVENTBUS_INTEGRATION_CONFIG }}

- name: Publish the integration zip
uses: actions/upload-release-asset@v1.0.1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GA_ACCESS_TOKEN }}
with:
Expand All @@ -88,7 +88,7 @@ jobs:
needs: [build]
steps:
- name: Download artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}

Expand All @@ -101,7 +101,7 @@ jobs:
CONFIG_FILE: ${{ secrets.PS_EVENTBUS_PREPRODUCTION_CONFIG }}

- name: Publish the preprod zip
uses: actions/upload-release-asset@v1.0.1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GA_ACCESS_TOKEN }}
with:
Expand All @@ -117,7 +117,7 @@ jobs:
if: "!github.event.release.prerelease"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download release asset
uses: dsaltares/fetch-gh-release-asset@master
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
php_version: ["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: PHP syntax checker ${{ matrix.php_version }}
run: PHP_VERSION=${{ matrix.php_version }} make docker-php-lint

Expand All @@ -39,7 +39,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Cache vendor folder
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Cache vendor folder
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
Expand All @@ -72,7 +72,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Cache vendor folder
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
Expand All @@ -88,19 +88,19 @@ jobs:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Cache vendor folder
# uses: actions/cache@v1
# uses: actions/cache@v3
# with:
# path: vendor
# key: php-${{ hashFiles('composer.lock') }}
# - name: PHP unit with coverage
# run: make phpunit-coverage
# - name: 🎁 Publishing Allure artifact to GitHub Actions
# uses: actions/upload-artifact@v2
# uses: actions/upload-artifact@v3
# with:
# name: allure-reports
# path: allure-reports
# - name: 🎁 Publishing Code coverage report to GitHub Actions
# uses: actions/upload-artifact@v2
# uses: actions/upload-artifact@v3
# with:
# name: coverage-reports
# path: coverage-reports
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ coverage-reports
allure-reports
tests/.phpunit.result.cache
.phpunit.cache/

# Jetbrains
.idea

# Sonar
.scannerwork
sonar-project.properties

*.cache
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ composer-validate: vendor
@./composer.phar validate --no-check-publish

# target: translation-validate - Validates the translation files in translations/ directory
translation-validate:
translation-validate:
php tests/translation.test.php

# target: lint - Lint the code and expose errors
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# PS EventBus

[![Quality Control](https://github.com/PrestaShopCorp/ps_eventbus/actions/workflows/eventbus-qc-php.yml/badge.svg)](https://github.com/PrestaShopCorp/ps_eventbus/actions/workflows/eventbus-qc-php.yml)
[![Quality Check](https://github.com/PrestaShopCorp/ps_eventbus/actions/workflows/quality-check.yml/badge.svg)](https://github.com/PrestaShopCorp/ps_eventbus/actions/workflows/quality-check.yml)

`ps_eventbus` is a module companion for CloudSync.

## Compatibility matrix

| PrestaShop platform | PS EventBus |
| ------------------- | -------------- |
|---------------------|----------------|
| 8.0 | 2.x - PHP 7.1+ |
| 1.7.0-1.7.8 | 2.x - PHP 7.1+ |
| 1.6.1.x | No |
Expand All @@ -23,7 +23,7 @@ make version # update the package configuration to the current version
make zip # make a zip ready to be tested in PrestaShop (see ./dist)
```

> Pro tip: prefix all you make commands with the variables you want to override. Ie: `VERSION=v1.2.3-rc4 make version` to set the package do the desired version.
> Pro-tip: prefix all you make commands with the variables you want to override. Ie: `VERSION=v1.2.3-rc4 make version` to set the package do the desired version.
## Testing

Expand Down
8 changes: 8 additions & 0 deletions config/front/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ services:
- "%ps_eventbus.sync_api_url%"
- "@ps_eventbus"

PrestaShop\Module\PsEventbus\Api\LiveSyncApiClient:
class: PrestaShop\Module\PsEventbus\Api\LiveSyncApiClient
public: true
arguments:
- '@PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts'
- "%ps_eventbus.live_sync_api_url%"
- "@ps_eventbus"

PrestaShop\Module\PsEventbus\Api\CollectorApiClient:
class: PrestaShop\Module\PsEventbus\Api\CollectorApiClient
public: true
Expand Down
2 changes: 1 addition & 1 deletion config/front/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ services:
- '@PrestaShop\Module\PsEventbus\Repository\ShopRepository'
- '@PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts'
- '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface'
- { EVENT_BUS_SYNC_API_URL: '%ps_eventbus.sync_api_url%', EVENT_BUS_PROXY_API_URL: '%ps_eventbus.proxy_api_url%' }
- { EVENT_BUS_SYNC_API_URL: '%ps_eventbus.sync_api_url%', EVENT_BUS_LIVE_SYNC_API_URL: '%ps_eventbus.live_sync_api_url%', EVENT_BUS_PROXY_API_URL: '%ps_eventbus.proxy_api_url%' }

PrestaShop\Module\PsEventbus\Repository\ThemeRepository:
class: PrestaShop\Module\PsEventbus\Repository\ThemeRepository
Expand Down
48 changes: 24 additions & 24 deletions config/index.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?php
/**
* 2007-2020 PrestaShop.
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2020 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/*
* Copyright (c) 2007-2023 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please email
* [email protected], so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2023 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

Expand Down
3 changes: 2 additions & 1 deletion config/parameters.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Note: this file is here for documentation purpose
# It will be overrided by the Makefile
# It will be overridden by the Makefile
parameters:
ps_eventbus.proxy_api_url: "https://eventbus-proxy.psessentials.net"
ps_eventbus.sync_api_url: "https://eventbus-sync.psessentials.net"
ps_eventbus.live_sync_api_url: "https://api.cloudsync.prestashop.com/live-sync/v1"
ps_eventbus.sentry_dsn: "https://[email protected]/stuff"
ps_eventbus.sentry_env: "development"
4 changes: 2 additions & 2 deletions dev-tools.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BUILDPLATFORM=linux/amd64
ARG PHP_VERSION=8.2

FROM --platform=${BUILDPLATFORM} php:${PHP_VERSION}-alpine as dev-tools
FROM --platform=${BUILDPLATFORM} php:${PHP_VERSION}-alpine AS dev-tools

WORKDIR /src

Expand All @@ -13,7 +13,7 @@ RUN apk add -U make $PCRE_DEV && \
7*) export XDEBUG_VERSION="3.1.6";; \
*) export XDEBUG_VERSION="3.2.0";; \
esac; \
pecl channel-update pecl.php.net && \
pecl channel-update pecl.php.net && \
pecl install xdebug-${XDEBUG_VERSION} && \
docker-php-ext-enable xdebug && \
apk del $PCRE_DEV;
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.7"
version: "3"

services:
php:
Expand All @@ -9,7 +9,7 @@ services:
environment:
_PS_ROOT_DIR_: /var/www/html
node:
image: node:10.16
image: node:lts-alpine
volumes:
- ./:/var/www/html
working_dir: /var/www/html
Expand All @@ -24,7 +24,7 @@ services:
environment:
MYSQL_ROOT_PASSWORD: prestashop
MYSQL_DATABASE: prestashop
restart: always
restart: unless-stopped
healthcheck:
test: "mysqladmin ping -h127.0.0.1 -uroot -pprestashop --silent"
interval: 10s
Expand Down
Loading

0 comments on commit bb5c90d

Please sign in to comment.