Skip to content

Commit

Permalink
E2E workflow (#36)
Browse files Browse the repository at this point in the history
* E2E Workflow
  • Loading branch information
aashwin-rvvup authored May 20, 2024
1 parent 5b8384f commit 0ef40fe
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 7 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: E2E Tests Workflow
on:
pull_request:
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
inputs:
rvvupHyvaCheckoutVersion:
description: 'Rvvup Hyva Checkout Version'
required: true
default: 'dev-main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
end-2-end-tests:
strategy:
matrix:
include:
- MAGENTO_VERSION: 2.4.5
- MAGENTO_VERSION: 2.4.6
- MAGENTO_VERSION: 2.4.7

env:
MAGENTO_VERSION: ${{ matrix.MAGENTO_VERSION }}
RVVUP_HYVA_CHECKOUT_VERSION: ${{ github.event.inputs.rvvupHyvaCheckoutVersion || format('dev-{0}', github.head_ref || github.ref_name) }}
MAGENTO_REPO_PUBLIC_KEY: ${{ secrets.REPO_PUB_KEY }}
MAGENTO_REPO_PRIVATE_KEY: ${{ secrets.REPO_SEC_KEY }}
RVVUP_API_KEY: ${{ secrets.RVVUP_API_KEY }}
HYVA_SSH_PRIVATE_KEY: ${{ secrets.HYVA_SSH_PRIVATE_KEY }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Start Docker
run: |
docker compose up -d --build
- name: Install dependencies
run: npm install
- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Wait for Magento Store
uses: mydea/[email protected]
with:
url: http://local.dev.rvvuptech.com:89/magento_version
method: GET
expected-status: "200"
timeout: "500"
interval: "5"

- name: Run Playwright tests
run: TEST_BASE_URL=http://local.dev.rvvuptech.com:89 npx playwright test

- name: Prepare logs
if: always()
run: |
mkdir -p logs
docker-compose logs > logs/container_logs.log
docker cp magento-hyva-checkout-magento-1:/bitnami/magento/var/log logs
- uses: actions/upload-artifact@v4
if: always()
with:
name: results-${{ matrix.MAGENTO_VERSION }}-${{ github.run_number }}
path: |
playwright-report/
var/log/
magento.log
nginx-proxy.log
13 changes: 9 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ services:
- 'rvvup_hyva_data_mariadb:/bitnami/mariadb'
magento:
ports:
- '80:8080'
- '443:8443'
- '89:8080'
- '8443:8443'
environment:
- BITNAMI_DEBUG=true
- MAGENTO_HOST=localhost
- MAGENTO_DATABASE_HOST=mariadb
- MAGENTO_DATABASE_PORT_NUMBER=3306
- MAGENTO_DATABASE_USER=bn_magento
Expand All @@ -23,7 +22,7 @@ services:
- ELASTICSEARCH_PORT_NUMBER=9200
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MAGENTO_HOST=local.dev.rvvuptech.com
- MAGENTO_HOST=local.dev.rvvuptech.com:89
- MAGENTO_USERNAME=admin
- MAGENTO_PASSWORD=password1
- [email protected]
Expand All @@ -32,6 +31,8 @@ services:
- MAGENTO_REPO_PUBLIC_KEY=$MAGENTO_REPO_PUBLIC_KEY
- MAGENTO_REPO_PRIVATE_KEY=$MAGENTO_REPO_PRIVATE_KEY
- HYVA_SSH_PRIVATE_KEY=$HYVA_SSH_PRIVATE_KEY
- MAGENTO_SMTP_HOST=mailpit
- MAGENTO_SMTP_PORT=1025
build:
context: .
dockerfile: Dockerfile
Expand All @@ -44,6 +45,10 @@ services:
image: docker.io/bitnami/elasticsearch:7
volumes:
- 'rvvup_hyva_elasticsearch_data:/bitnami/elasticsearch/data'
mailpit:
image: docker.io/axllent/mailpit:v1.18
ports:
- '9925:8025'
volumes:
rvvup_hyva_data_mariadb:
driver: local
Expand Down
9 changes: 9 additions & 0 deletions docker/scripts/configure-base-store.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@ bin/magento config:set currency/options/default GBP
bin/magento config:set general/locale/timezone Europe/London
bin/magento config:set general/locale/code en_GB
bin/magento sampledata:deploy

echo "Configuring SMTP settings to point to $MAGENTO_SMTP_HOST:$MAGENTO_SMTP_PORT"
bin/magento config:set system/smtp/disable 0
bin/magento config:set system/smtp/transport smtp
bin/magento config:set system/smtp/host $MAGENTO_SMTP_HOST
bin/magento config:set system/smtp/port $MAGENTO_SMTP_PORT

bin/magento sampledata:deploy

composer require n98/magerun2-dist
6 changes: 3 additions & 3 deletions run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ start=$(date +%s)
docker compose up -d --build
attempt=1
while true; do
http_status=$(curl -o /dev/null -s -w "%{http_code}\n" -I "http://local.dev.rvvuptech.com/magento_version")
http_status=$(curl -o /dev/null -s -w "%{http_code}\n" -I "http://local.dev.rvvuptech.com:89/magento_version")

if [ "$http_status" -eq 200 ]; then
echo -e "\rServer responded with 200 OK / Time taken: $(($(date +%s) - start)) seconds, continuing..."
Expand All @@ -16,7 +16,7 @@ while true; do
done

if [ "$1" == "--ui" ]; then
ENV TEST_BASE_URL=http://local.dev.rvvuptech.com npx playwright test --ui
ENV TEST_BASE_URL=http://local.dev.rvvuptech.com:89 npx playwright test --ui
else
ENV TEST_BASE_URL=http://local.dev.rvvuptech.com npx playwright test
ENV TEST_BASE_URL=http://local.dev.rvvuptech.com:89 npx playwright test
fi

0 comments on commit 0ef40fe

Please sign in to comment.