Release #57
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End-2-end | |
on: | |
pull_request: | |
types: | |
- opened | |
- labeled | |
concurrency: e2e-tests | |
jobs: | |
secrets-gate: | |
# Only run tests if the pull request is opened or labeled with run_e2e_tests | |
if: ${{ github.event.label.name == 'run_e2e_tests' || github.event.action != 'labeled' }} | |
runs-on: ubuntu-latest | |
outputs: | |
is-secret-set: ${{ steps.is-secret-set.outputs.is_mollie_api_key_test_set }} | |
steps: | |
- id: is-secret-set | |
env: | |
MOLLIE_API_KEY_TEST: ${{ secrets.MOLLIE_API_KEY_TEST }} | |
if: "${{ env.MOLLIE_API_KEY_TEST != '' }}" | |
run: echo "is_mollie_api_key_test_set=true" >> $GITHUB_OUTPUT | |
# Remove flag used to trigger the e2e tests | |
remove_flag: | |
if: ${{ contains(github.event.*.labels.*.name, 'run_e2e_tests') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Remove run E2E tests label | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: ${{ github.event.issue.number || github.event.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: "run_e2e_tests" | |
}) | |
e2e-tests: | |
needs: | |
- secrets-gate | |
# Only run this job if the secret is set | |
if: needs.secrets-gate.outputs.is-secret-set == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- PHP_VERSION: php74-fpm | |
MAGENTO_VERSION: 2.3.7-p3 | |
- PHP_VERSION: php81-fpm | |
MAGENTO_VERSION: 2.4.6 | |
runs-on: ubuntu-latest | |
env: | |
PHP_VERSION: ${{ matrix.PHP_VERSION }} | |
MAGENTO_VERSION: ${{ matrix.MAGENTO_VERSION }} | |
MOLLIE_API_KEY_TEST: ${{ secrets.MOLLIE_API_KEY_TEST }} | |
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }} | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
CYPRESS_TESTRAIL_DOMAIN: ${{ secrets.TESTRAIL_DOMAIN }} | |
CYPRESS_TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }} | |
CYPRESS_TESTRAIL_PASSWORD: ${{ secrets.TESTRAIL_PASSWORD }} | |
CYPRESS_TESTRAIL_PROJECT_ID: 5 | |
CYPRESS_TESTRAIL_MILESTONE_ID: 37 | |
CYPRESS_TESTRAIL_RUN_NAME: "Github Workflow, ${{ github.head_ref || github.ref_name }}, PHP version: ${{ matrix.PHP_VERSION }}, Magento version: ${{ matrix.MAGENTO_VERSION }}" | |
CYPRESS_TESTRAIL_RUN_CLOSE: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Start the Magento container | |
run: | | |
openssl req -x509 -newkey rsa:4096 -keyout .github/workflows/templates/nginx-proxy/magento.test.key -out .github/workflows/templates/nginx-proxy/magento.test.crt -days 365 -nodes -subj "/CN=magento.test" && \ | |
docker-compose -f .github/workflows/templates/docker-compose.yml up -d | |
# Get the URL from ngrok | |
docker-compose -f .github/workflows/templates/docker-compose.yml logs ngrok | |
MAGENTO_URL=$(docker exec magento-project-community-edition /bin/bash -c "curl -s ngrok:4040/api/tunnels |jq -r \".tunnels[0].public_url\"") | |
echo "magento_url=$MAGENTO_URL" >> $GITHUB_ENV | |
- name: Upload the code into the docker container | |
run: | | |
sed -i '/version/d' ./composer.json && \ | |
docker cp $(pwd) magento-project-community-edition:/data/extensions/ && \ | |
docker exec magento-project-community-edition ./install-composer-package mollie/magento2:@dev | |
- name: Activate the extension | |
run: | | |
docker exec magento-project-community-edition ./retry "php bin/magento module:enable Mollie_Payment" | |
docker exec magento-project-community-edition ./retry "php bin/magento setup:upgrade" | |
docker exec magento-project-community-edition /bin/bash /data/configure-mollie.sh | |
docker exec magento-project-community-edition ./retry "bin/magento config:set payment/mollie_general/use_webhooks custom_url" | |
docker exec magento-project-community-edition ./retry "bin/magento config:set payment/mollie_general/custom_webhook_url ${{ env.magento_url }}/mollie/checkout/webhook" | |
- name: Prepare Magento | |
run: | | |
docker exec magento-project-community-edition /bin/bash ./change-base-url https://magento.test/ | |
docker exec magento-project-community-edition ./retry "php bin/magento setup:di:compile" | |
docker exec magento-project-community-edition ./retry "php bin/magento setup:static-content:deploy -f" | |
docker exec magento-project-community-edition ./retry "php bin/magento indexer:reindex" | |
- name: Start all containers and check if we can reach Magento (and warmup cache) | |
run: | | |
docker exec e2e curl -k -s -o /dev/null -w "%{http_code}" https://magento.test/ | |
docker exec e2e curl -k -s -o /dev/null -w "%{http_code}" ${{ env.magento_url }} | |
- name: Run Cypress | |
run: | | |
# Copy the .git folder for Cypress | |
docker cp .git e2e:/e2e/.git | |
docker exec e2e cypress run --browser chrome --config defaultCommandTimeout=20000 | |
- name: Dump docker-compose logs | |
if: always() | |
run: | | |
docker-compose -f .github/workflows/templates/docker-compose.yml logs magento > magento.log && \ | |
docker-compose -f .github/workflows/templates/docker-compose.yml logs ngrok > ngrok.log && \ | |
docker-compose -f .github/workflows/templates/docker-compose.yml logs e2e > e2e.log | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: E2E logs - ${{ matrix.PHP_VERSION }} - ${{ matrix.MAGENTO_VERSION }} | |
path: | | |
Test/End-2-end/cypress/videos | |
Test/End-2-end/cypress/screenshots | |
magento-logs | |
magento.log | |
nginx-proxy.log | |
e2e.log |