Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github workflow e2e matrix: prestashop version & php version #301

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2cd2535
github workflow e2e matrix: prestashop version & php version
davidPrestashop May 29, 2024
46990c8
Merge branch 'main' into test/ci-ps-php-versions
Clap404 Jun 10, 2024
88040bc
Merge remote-tracking branch 'origin/main' into test/ci-ps-php-versions
davidPrestashop Jun 17, 2024
2ca519e
docker mariadb lts/healthcheck
davidPrestashop Jun 18, 2024
bb4067f
Merge remote-tracking branch 'origin/test/ci-ps-php-versions' into te…
davidPrestashop Jun 18, 2024
3394a1f
github workflow e2e matrix: prestashop & php versions
davidPrestashop Jun 20, 2024
815ce74
Merge remote-tracking branch 'origin/main' into test/ci-ps-php-versions
davidPrestashop Jun 26, 2024
a52b37a
actions/workflows e2e matrix: prestashop & php versions
davidPrestashop Jun 26, 2024
ba3b52e
actions/workflows e2e matrix: prestashop & php versions
davidPrestashop Jul 5, 2024
32c01ff
Merge remote-tracking branch 'origin/main' into test/ci-ps-php-versions
davidPrestashop Jul 19, 2024
a3aa085
matrix
davidPrestashop Jul 19, 2024
83b22d4
oups
davidPrestashop Jul 19, 2024
618b81a
e2e PR & workflow_dispatch
davidPrestashop Jul 19, 2024
3f864f2
pS1.6.x php versions compatibility
davidPrestashop Jul 19, 2024
c5d9211
pS1.6.x php versions compatibility
davidPrestashop Jul 19, 2024
5226066
slack
davidPrestashop Jul 19, 2024
e15efe4
Merge remote-tracking branch 'origin/main' into test/ci-ps-php-versions
davidPrestashop Sep 3, 2024
e57dbad
Merge remote-tracking branch 'origin/main' into test/ci-ps-php-versions
davidPrestashop Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/actions/e2e/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
name: 'e2e tests'

description: ''
inputs:
ps-version:
description: Prestashop version
required: true
php-version:
description: Php version
required: true
node-builder-version:
description: Node builder version
required: true
docker-compose-version:
description: Docker compose version
required: true

runs:
using: composite
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- uses: pnpm/action-setup@v3
with:
version: latest

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-builder-version }}
cache: "pnpm"
cache-dependency-path: e2e/pnpm-lock.yaml

- name: Cache vendor folder
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

- name: Install docker compose
shell: bash
run: |
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
rm -f $DOCKER_CONFIG/cli-plugins/docker-compose
curl -SL https://github.com/docker/compose/releases/download/${{ inputs.docker-compose-version }}/docker-compose-linux-x86_64 \
-o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

- name: Install dependencies and setup e2e
shell: bash
run: pnpm install --no-optional --force
working-directory: e2e

- name: Setup e2e-env with Prestashop ${{ inputs.ps-version }} & Php ${{ inputs.php-version }}
shell: bash
run: |
FLASHLIGHT_BASE_IMAGE="prestashop/prestashop-flashlight"
if [[ "${{ inputs.ps-version }}" != "latest" ]]; then
sed -i 's+${FLASHLIGHT_BASE_IMAGE}:latest/${FLASHLIGHT_BASE_IMAGE}:${{inputs.ps-version}}-${{inputs.php-version}}/g' .env.dist
fi;
cp .env.dist .env
docker compose build
docker compose up --detach --wait
working-directory: e2e-env

- name: Run e2e:tests with Prestashop ${{ inputs.ps-version }} & Php ${{ inputs.php-version }}
shell: bash
run: pnpm test:e2e
working-directory: e2e

- name: More logs on failure
shell: bash
if: failure()
run: |
echo "========= Shop healthcheck =============="
curl -s -L 'http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiHealthCheck' | jq .
echo "========= Containers logs =========="
docker compose logs cloudsync-mock prestashop
docker compose down -v
working-directory: e2e-env
116 changes: 116 additions & 0 deletions .github/workflows/e2e-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: E2e PR

on:
workflow_call:
inputs:
ps-version:
description: 'Prestashop version (if latest no Php version needed).'
type: string
required: false
default: latest
php-version:
description: 'Php version'
type: string
required: false
default: 8.1
workflow_dispatch:
inputs:
ps-version:
description: 'Prestashop version (if latest no Php version needed) \n
Compatibility: \n
ps8.x.x with php 8.1, 8.0, 7.4, 7.3, 7.2, 7.1 \n
ps1.7.8.x with 7.4, 7.3, 7.2, 7.1 \n
ps1.7.7.x with 7.3, 7.2, 7.1 \n
ps1.7.5.x & ps1.7.6.x with php 7.2, 7.1, 7.0 \n
ps1.7.0.x to ps1.7.4.x with php 7.1, 7.0
ps1.6.1.x with php 7.1, 7.0, 5.6, 5.5, 5.4, 5.3, 5.2'
default: 'latest'
type: choice
options:
- latest
- 8.1.7
- 8.0.5
- 1.7.8.11
- 1.7.7.8
- 1.7.6.9
- 1.7.5.2
- 1.7.4.4
- 1.7.3.4
- 1.7.2.5
- 1.7.1.2
- 1.7.0.6
- 1.6.1.24
php-version:
description: 'Php version'
default: '8.1'
type: choice
options:
- 8.1
- 8.0
- 7.4
- 7.3
- 7.2
- 7.1
- 7.0
- 5.6
- 5.5
- 5.4
- 5.3
- 5.2

env:
DOCKER_COMPOSE_VERSION: v2.27.0
NODE_BUILDER_VERSION: "20"

jobs:
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: latest

- name: Auth Docker GCP
uses: ./.github/actions/auth-docker-gcp
with:
workload-identity-provider: ${{ secrets.WI_PROVIDER_INTEGRATION }}
service-account: ${{ secrets.WI_SA_INTEGRATION }}

- name: e2e tests
uses: ./.github/actions/e2e
with:
ps-version: ${{ inputs.ps-version }}
php-version: ${{ inputs.php-version }}
docker-compose-version: ${{ env.DOCKER_COMPOSE_VERSION }}
node-builder-version: ${{ env.NODE_BUILDER_VERSION }}

- name: Slack notification on failures
if: github.event_name == 'schedule' && failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: EC1111
SLACK_TITLE: E2E Capture tests PS$${{ inputs.ps-version }} & Php${{ inputs.php-version }}
SLACK_MESSAGE: The latest E2E Capture tests failed :(
SLACK_FOOTER: 'Review the last github actions here: https://github.com/PrestaShopCorp/cloudsync/actions/workflows/e2e.yml'
SLACK_USERNAME: QABot
SLACK_CHANNEL: squad-cloudsync-qa
SLACK_ICON: https://avatars.githubusercontent.com/u/56089550?s=48&v=4

- name: Slack notification on success
if: github.event_name == 'schedule' && success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: 0CAD34
SLACK_TITLE: E2E Capture tests PS${{ matrix.ps-version }} & Php${{ matrix.php-version }}
SLACK_MESSAGE: ✓ The latest E2E Capture tests just passed!
SLACK_FOOTER: ''
SLACK_USERNAME: QABot
SLACK_CHANNEL: squad-cloudsync-qa
SLACK_ICON: https://avatars.githubusercontent.com/u/56089550?s=48&v=4
87 changes: 87 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: E2e

env:
DOCKER_COMPOSE_VERSION: v2.27.0
NODE_BUILDER_VERSION: "20"

jobs:
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- ps-version: 8.1.7
php-version: 8.2
- ps-version: 8.0.5
php-version: 8.2
- ps-version: 1.7.8.11
php-version: 7.4
- ps-version: 1.7.7.8
php-version: 7.3
- ps-version: 1.7.6.9
php-version: 7.2
- ps-version: 1.7.5.2
php-version: 7.2
- ps-version: 1.7.4.4
php-version: 7.1
- ps-version: 1.7.3.4
php-version: 7.1
- ps-version: 1.7.2.5
php-version: 7.1
- ps-version: 1.7.1.2
php-version: 7.1
- ps-version: 1.7.0.6
php-version: 7.1
- ps-version: 1.6.1.24
php-version: 7.1

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: latest

- name: Auth Docker GCP
uses: ./.github/actions/auth-docker-gcp
with:
workload-identity-provider: ${{ secrets.WI_PROVIDER_INTEGRATION }}
service-account: ${{ secrets.WI_SA_INTEGRATION }}

- name: e2e tests
uses: ./.github/actions/e2e
with:
ps-version: ${{ matrix.ps-version }}
php-version: ${{ matrix.php-version }}
docker-compose-version: ${{ env.DOCKER_COMPOSE_VERSION }}
node-builder-version: ${{ env.NODE_BUILDER_VERSION }}

- name: Slack notification on failures
if: github.event_name == 'schedule' && failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: EC1111
SLACK_TITLE: E2E Capture tests PS${{ matrix.ps-version }} & Php${{ matrix.php-version }}
SLACK_MESSAGE: The latest E2E Capture tests failed :(
SLACK_FOOTER: 'Review the last github actions here: https://github.com/PrestaShopCorp/cloudsync/actions/workflows/e2e.yml'
SLACK_USERNAME: QABot
SLACK_CHANNEL: squad-cloudsync-qa
SLACK_ICON: https://avatars.githubusercontent.com/u/56089550?s=48&v=4

- name: Slack notification on success
if: github.event_name == 'schedule' && success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: 0CAD34
SLACK_TITLE: E2E Capture tests PS${{ matrix.ps-version }} & Php${{ matrix.php-version }}
SLACK_MESSAGE: ✓ The latest E2E Capture tests just passed!
SLACK_FOOTER: ''
SLACK_USERNAME: QABot
SLACK_CHANNEL: squad-cloudsync-qa
SLACK_ICON: https://avatars.githubusercontent.com/u/56089550?s=48&v=4
7 changes: 7 additions & 0 deletions e2e-env/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ COMPOSE_PROJECT_NAME=ps_eventbus
DOCKER_IMAGE_PRESTASHOP=prestashop/prestashop-flashlight:latest
DOCKER_VERSION_MARIADB=lts

# e2e test dataset : default uses dataset from prestashop flashlight docker image, uses dataset from dataset
# folder otherwise
TEST_DATASET=default

# Infrastructure port binding on the host
HOST_PORT_BIND_PRESTASHOP=8000
HOST_PORT_BIND_MYSQL=3306
Expand All @@ -14,3 +18,6 @@ SYNC_API_PORT=3232
COLLECTOR_API_PORT=3333
LIVE_SYNC_API_PORT=3434
WS_PORT=8080

PS_EVENTBUS_VERSION=v3.0.12
PS_ACCOUNTS_MOCK_VERSION=v1.0.4
13 changes: 9 additions & 4 deletions e2e-env/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
prestashop:
image: ${DOCKER_IMAGE_PRESTASHOP:?See e2e-env/.env.dist}
container_name: prestashop
depends_on:
mysql:
condition: service_healthy
Expand Down Expand Up @@ -33,8 +34,9 @@ services:

mysql:
image: mariadb:${DOCKER_VERSION_MARIADB:?See e2e-env/.env.dist}
container_name: mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect"]
test: [ "CMD", "healthcheck.sh", "--connect" ]
environment:
- MYSQL_HOST=mysql
- MYSQL_USER=prestashop
Expand All @@ -49,6 +51,7 @@ services:

phpmyadmin:
image: phpmyadmin:latest
container_name: phpmyadmin
depends_on:
mysql:
condition: service_healthy
Expand All @@ -67,10 +70,11 @@ services:
build:
context: ./cloudsync-mock
dockerfile: Dockerfile
container_name: cloudsync-mock
environment:
- RUN_IN_DOCKER=1
healthcheck:
test: ["CMD", "curl", "-sI", "http://localhost:8080"]
test: [ "CMD", "curl", "-sI", "http://localhost:8080" ]
volumes:
- ./cloudsync-mock/src:/home/node/src:ro
ports:
Expand All @@ -83,11 +87,12 @@ services:

reverse-proxy:
image: nginx:stable-alpine
container_name: reverse-proxy
healthcheck:
test: ["CMD", "curl", "-sI", "http://localhost:80/nginx_status"]
test: [ "CMD", "curl", "-sI", "http://localhost:80/nginx_status" ]
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro,cached
command: [nginx-debug, "-g", "daemon off;"]
command: [ nginx-debug, "-g", "daemon off;" ]
networks:
- prestashop
ports:
Expand Down
16 changes: 16 additions & 0 deletions e2e-env/init-scripts/1-install_ps_eventbus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
set -eu
cd "$(dirname $0)" || exit 1

# Download and install the module's zip
echo "* [ps_eventbus] downloading..."
wget -q -O /tmp/ps_eventbus.zip "https://github.com/PrestaShopCorp/ps_eventbus/releases/download/${PS_EVENTBUS_VERSION}/ps_eventbus-${PS_EVENTBUS_VERSION}.zip"
echo "* [ps_eventbus] unziping..."
unzip -qq /tmp/ps_eventbus.zip -d /var/www/html/modules
echo "* [ps_eventbus] installing the module..."
cd "$PS_FOLDER"
php -d memory_limit=-1 bin/console prestashop:module --no-interaction install "ps_eventbus"

# Override the default parameters with the E2E settings
wget -O "/var/www/html/modules/ps_eventbus/config/parameters.yml" \
"https://raw.githubusercontent.com/PrestaShopCorp/ps_eventbus/main/config/parameters.yml"
12 changes: 12 additions & 0 deletions e2e-env/init-scripts/2-install_ps_accounts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -eu
cd "$(dirname $0)" || exit 1

echo "* [ps_accounts_mock] downloading..."
echo "https://github.com/PrestaShopCorp/ps_accounts_mock/releases/download/${PS_ACCOUNTS_MOCK_VERSION}/ps_accounts_mock-${PS_ACCOUNTS_MOCK_VERSION}.zip"
wget -q -O /tmp/ps_accounts.zip "https://github.com/PrestaShopCorp/ps_accounts_mock/releases/download/${PS_ACCOUNTS_MOCK_VERSION}/ps_accounts_mock-${PS_ACCOUNTS_MOCK_VERSION}.zip"
echo "* [ps_accounts_mock] unziping..."
unzip -qq /tmp/ps_accounts.zip -d /var/www/html/modules
echo "* [ps_accounts_mock] installing the module..."
cd "$PS_FOLDER"
php -d memory_limit=-1 bin/console prestashop:module --no-interaction install "ps_accounts"
Loading