Skip to content

Adyen Magento 2 Payment Plugin E2E tests #66

Adyen Magento 2 Payment Plugin E2E tests

Adyen Magento 2 Payment Plugin E2E tests #66

Workflow file for this run

name: Magento-Hyva E2E Pipeline
run-name: Adyen Magento 2 Payment Plugin E2E tests
on:
# push:
workflow_dispatch:
pull_request:
types: [opened, synchronize, ready_for_review]
pull_request_target:
types: [opened, synchronize, ready_for_review]
jobs:
build:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository)
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
runs-on:
group: larger-runners
labels: ubuntu-latest-8-cores
timeout-minutes: 25
env:
PHP_VERSION: "8.1"
MAGENTO_VERSION: "2.4.5"
ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}}
ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}}
ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}}
ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
DONATION_ACCOUNT: ${{secrets.DONATION_ACCOUNT}}
SSH_PRIVATE_KEY: ${{secrets.GITLAB_SSH_KEY}}
DEPLOY_SAMPLEDATA: 1
steps:
- uses: actions/checkout@v3
# - name: Set up SSH
# env:
# SSH_PRIVATE_KEY: ${{ secrets.GITLAB_SSH_KEY }}
# run: |
# mkdir -p /root/.ssh
# echo "$SSH_PRIVATE_KEY" > /root/.ssh/hyva_id_rsa
# chmod 600 ~/.ssh/hyva_id_rsa
# ssh-keyscan gitlab.hyva.io >> /root/.ssh/known_hosts
# export HYVA_KEY_PATH="/root/.ssh/hyva_id_rsa"
# echo "HYVA_KEY_PATH=$HYVA_KEY_PATH" >> $GITHUB_ENV
# unset SSH_PRIVATE_KEY
#
# - name: Build the container and install Magento
# run: docker compose -f .github/docker-compose.yml run --rm web make magento
#
# - name: Check .ssh folder contents
# run: docker compose -f .github/docker-compose.yml run --rm web ls -la /root/.ssh
#
# - name: Check .ssh/config
# run: docker compose -f .github/docker-compose.yml run --rm web cat /root/.ssh/config
#
# - name: Validate the SSH key
# run: docker compose -f .github/docker-compose.yml run --rm web ssh -v [email protected]
#
## - name: Check Hyva install
# run: docker compose -f .github/docker-compose.yml run --rm web /tmp/install_hyva.sh
- name: Ensure composer cache directory exists
run: |
sudo mkdir -p /var/www/.cache/composer
sudo chown -R www-data:www-data /var/www/.cache/composer
- name: Install Magento
run: docker compose -f .github/docker-compose.yml run --rm web make magento
- name: Start web server in background
run: docker compose -f .github/docker-compose.yml up -d web
- name: Setup permissions
run: docker exec magento2-hyva-container make fs
- name: Check install
run: docker exec magento2-hyva-container make sys-check
- name: Install plugin
run: docker exec -u www-data magento2-hyva-container make plugin
- name: Kill Cron Jobs
run: docker exec magento2-hyva-container /etc/init.d/cron stop
#todo Break here and check if everything was successful (verbose logging?)
#todo ?? Create zip of .vendor so it can be used in the local version?
- name: Checkout developer module
uses: actions/checkout@v3
with:
repository: Adyen/adyen-magento2-dev
ref: "main"
token: ${{ secrets.ADYEN_AUTOMATION_BOT_TEST_ACCESS_TOKEN }}
path: Developer
- name: Make the folder for dev module
run: docker exec -u www-data magento2-hyva-container mkdir -p /var/www/html/app/code/Adyen
- name: Copy dev module into Docker container
run: docker cp ./Developer magento2-hyva-container:/var/www/html/app/code/Adyen
- name: Change ownership of developer module folder
run: docker exec magento2-hyva-container chown -R www-data:www-data /var/www/html/app/code/Adyen/Developer
- name: Enable developer module
run: docker exec -u www-data magento2-hyva-container make dev-module
- name: Switch to production mode
run: docker exec -u www-data magento2-hyva-container make production
- name: Setup permissions
run: docker exec magento2-hyva-container make fs
- name: Run E2E tests
run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh standard
env:
INTEGRATION_TESTS_BRANCH: hyva-develop
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
MAGENTO_ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
MAGENTO_BASE_URL: ${{secrets.MAGENTO_BASE_URL}}
PAYPAL_USERNAME: ${{secrets.PLAYWRIGHT_PAYPAL_USERNAME}}
PAYPAL_PASSWORD: ${{secrets.PLAYWRIGHT_PAYPAL_PASSWORD}}
WEBHOOK_USERNAME: admin
WEBHOOK_PASSWORD: 1234
- name: Archive test result artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: html-report
path: test-report