Skip to content

Commit

Permalink
Merge branch 'main' into feature/ECP-9196-change-guest-shopperReferen…
Browse files Browse the repository at this point in the history
…ce-to-cartId
  • Loading branch information
candemiralp authored Sep 27, 2024
2 parents e2b96b1 + 4c4378c commit c8b668e
Show file tree
Hide file tree
Showing 113 changed files with 4,136 additions and 806 deletions.
4 changes: 2 additions & 2 deletions .github/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ flush:
enable-express:
bin/magento module:enable Adyen_ExpressCheckout
bin/magento setup:upgrade
bin/magento config:set payment/adyen_express/show_google_pay_on "1,2,3"
bin/magento config:set payment/adyen_express/show_apple_pay_on "1,2,3"
bin/magento config:set payment/adyen_googlepay/express_show_on "1,2,3"
bin/magento config:set payment/adyen_applepay/express_show_on "1,2,3"
bin/magento cache:clean

# Full plugin setup
Expand Down
2 changes: 1 addition & 1 deletion .github/docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
playwright:
image: mcr.microsoft.com/playwright:v1.40.1
image: mcr.microsoft.com/playwright:v1.47.2
shm_size: 1gb
ipc: host
cap_add:
Expand Down
2 changes: 1 addition & 1 deletion .github/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
MARIADB_USER: magento
MARIADB_PASSWORD: magento
elastic:
image: elasticsearch:7.17.13
image: elasticsearch:7.17.23
container_name: elasticsearch
networks:
- backend
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
name: "CodeQL"

on:
push:
branches: [ "develop", "develop-6", "develop-7", "develop-8", "main", "main-6", "main-7", "main-8" ]
pull_request:
branches: [ "develop", "main" ]
paths-ignore:
- 'view/base/web/js/*'
schedule:
- cron: "6 1 * * 0"
- 'view/base/web/js/**'

jobs:
analyze:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e-test-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
expressBranch:
description: "Express Checkout Repository Pipeline"
required: true
default: "develop"
default: "main"
testGroup:
description: "Test group"
required: true
Expand Down Expand Up @@ -42,11 +42,11 @@ jobs:
- uses: actions/checkout@v3

- name: Install Magento
run: docker-compose -f .github/docker-compose.yml run --rm web make 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
run: docker compose -f .github/docker-compose.yml up -d web

- name: Setup permissions
run: docker exec magento2-container make fs

Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
run: docker exec magento2-container make fs

- name: Run E2E tests
run: docker-compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh ${{inputs.testGroup}}
run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh ${{inputs.testGroup}}
env:
INTEGRATION_TESTS_BRANCH: ${{inputs.testBranch}}
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/e2e-test-express-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ run-name: Adyen Magento 2 Express Checkout Plugin E2E tests
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
branches: [main]
pull_request_target:
branches: [main]

jobs:
build:
if: |
${{
github.event.pull_request.draft == false &&
(github.actor != 'renovate[bot]' || github.actor != 'lgtm-com[bot]')
}}
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) || (github.event_name == 'workflow_dispatch')
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
Expand All @@ -32,10 +30,10 @@ jobs:
- uses: actions/checkout@v3

- name: Install Magento
run: docker-compose -f .github/docker-compose.yml run --rm web make 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
run: docker compose -f .github/docker-compose.yml up -d web

- name: Setup permissions
run: docker exec magento2-container make fs
Expand All @@ -59,7 +57,7 @@ jobs:
run: docker exec magento2-container make fs

- name: Run E2E tests
run: docker-compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh express-checkout
run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh express-checkout
env:
INTEGRATION_TESTS_BRANCH: develop
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Magento 2 E2E Pipeline
run-name: Adyen Magento 2 Payment Plugin E2E tests

on:
pull_request:
types: [opened, synchronize, ready_for_review]
pull_request_target:
types: [opened, synchronize, ready_for_review]
on: [pull_request, pull_request_target]

jobs:
build:
Expand All @@ -29,10 +24,10 @@ jobs:
- uses: actions/checkout@v3

- name: Install Magento
run: docker-compose -f .github/docker-compose.yml run --rm web make 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
run: docker compose -f .github/docker-compose.yml up -d web

- name: Setup permissions
run: docker exec magento2-container make fs
Expand Down Expand Up @@ -72,7 +67,7 @@ jobs:
run: docker exec magento2-container make fs

- name: Run E2E tests
run: docker-compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh standard
run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh standard
env:
INTEGRATION_TESTS_BRANCH: develop
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/graphql-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- uses: actions/checkout@v3

- name: Install Magento
run: docker-compose -f .github/docker-compose.yml run --rm web make 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
run: docker compose -f .github/docker-compose.yml up -d web

- name: Setup permissions
run: docker exec magento2-container make fs
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ on:
pull_request:
pull_request_target:
workflow_dispatch:
push:
branches: [develop]

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) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch')
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) || (github.event_name == 'workflow_dispatch')
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
runs-on: ubuntu-latest

Expand Down
190 changes: 190 additions & 0 deletions .github/workflows/marketplace-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: Marketplace Automation

on:
workflow_dispatch:
release:
types: [published]

jobs:
marketplace-automation:
runs-on: ubuntu-latest
# environment: internal

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

- name: Fetch the latest release
id: fetch_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# for test only
# response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/releases/latest")
# for live only
response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}")
release_url=$(echo $response | jq -r '.zipball_url')
release_notes=$(echo $response | jq -r '.body')
release_tagname=$(echo $response | jq -r '.tag_name')
# Remove 'v' prefix if it exists
if [[ $release_tagname == v* ]]; then
release_tagname=${release_tagname#v}
fi
echo "LATEST_RELEASE_URL=$release_url" >> $GITHUB_OUTPUT
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
echo "$release_notes" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "TAG_NAME=$release_tagname" >> $GITHUB_OUTPUT
echo "Latest Release URL: $release_url"
echo "Release Notes: $release_notes"
echo "Tag name: $release_tagname"
- name: Download the latest release
run: |
curl -L ${{ steps.fetch_release.outputs.LATEST_RELEASE_URL }} -o source.zip
unzip source.zip
rm source.zip
- name: Create Archive
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'adyen-magento2-main.zip'
exclusions: '*.git* *.DS_Store'

- name: List files for verification
run: |
ls -la
- name: Prepare the request payload
run: |
touch file-payload && \
echo "--UNIQUE_BOUNDARY_TOKEN" > file-payload && \
echo 'Content-Disposition: form-data; name="file[]"; filename="adyen-magento2-main.zip"' >> file-payload && \
echo 'Content-Type: application/zip' >> file-payload && \
echo '' >> file-payload && \
cat adyen-magento2-main.zip >> file-payload && \
echo '' >> file-payload && \
echo "--UNIQUE_BOUNDARY_TOKEN--" >> file-payload
- name: Get session token
id: get_session_token
env:
BASE_URL: ${{ secrets.ADOBE_EQP_API_URL }}
ADOBE_CLIENT_ID: ${{ secrets.ADOBE_CLIENT_ID }}
ADOBE_CLIENT_SECRET: ${{ secrets.ADOBE_CLIENT_SECRET }}
run: |
response=$(curl -X POST \
-u "${ADOBE_CLIENT_ID}:${ADOBE_CLIENT_SECRET}" \
-H 'Content-Type: application/json' \
-d '{ "grant_type" : "session" }' \
${BASE_URL}/rest/v1/app/session/token)
SESSION_TOKEN=$(echo $response | jq -r '.ust')
echo "SESSION_TOKEN=$SESSION_TOKEN" >> $GITHUB_OUTPUT
echo "Session Token Response: $response"
- name: Upload zip to adobe and get upload id
id: upload_and_fetch
env:
SESSION_TOKEN: ${{ steps.get_session_token.outputs.SESSION_TOKEN }}
BASE_URL: ${{ secrets.ADOBE_EQP_API_URL }}
run: |
# Upload the file
upload_response=$(curl -X POST \
-H "Authorization: Bearer $SESSION_TOKEN" \
-H 'Content-Type: multipart/form-data; boundary=UNIQUE_BOUNDARY_TOKEN' \
--data-binary @file-payload \
"${BASE_URL}/rest/v1/files/uploads")
# Check if the upload was successful
if echo "$upload_response" | grep -q 'error'; then
echo "Upload failed: $upload_response"
exit 1
else
echo "Upload successful: $upload_response"
fi
# Extract upload ID from JSON response
upload_id=$(echo $upload_response | jq -r '.[0].file_upload_id')
echo "Upload ID: $upload_id"
echo "FILE_UPLOAD_ID=$upload_id" >> $GITHUB_OUTPUT
- name: Prepare JSON Payload
id: prepare_payload
env:
NEW_VERSION: ${{ steps.fetch_release.outputs.TAG_NAME }}
#NEW_VERSION: "11.0.11"
FILE_UPLOAD_ID: ${{ steps.upload_and_fetch.outputs.FILE_UPLOAD_ID }}
THIS_RELEASE_NOTES: ${{ steps.fetch_release.outputs.RELEASE_NOTES }}
run: |
# Read the JSON template and replace placeholders with actual values
cp .github/workflows/payload-template.json updated-payload.json
# Replace placeholders with actual values
sed -i "s/VERSION/${NEW_VERSION}/g" updated-payload.json
sed -i "s/FILE_UPLOAD_ID/${FILE_UPLOAD_ID}/g" updated-payload.json
# Step 1: Prepare the release notes
echo "$THIS_RELEASE_NOTES" > temp_release_notes.txt
# Step 2: Remove specific line and emojis
sed -e '/<!-- Release notes generated using configuration in .github\/release.yml at main -->/d' \
-e 's/💎//g' \
-e 's/🖇️//g' \
temp_release_notes.txt > cleaned_release_notes.txt
# Step 3: Read the cleaned content into a variable
THIS_RELEASE_NOTES=$(cat cleaned_release_notes.txt)
# Step 4: Update the JSON file with the cleaned release notes
jq --arg notes "$THIS_RELEASE_NOTES" '.[0].release_notes = $notes' updated-payload.json > updated-payload.tmp && mv updated-payload.tmp updated-payload.json
# Step 5: Clean up temporary files
rm temp_release_notes.txt cleaned_release_notes.txt
# Update the JSON payload with the release notes
# jq --arg notes "$THIS_RELEASE_NOTES" '.[0].release_notes = $notes' updated-payload.json > updated-payload.tmp && mv updated-payload.tmp updated-payload.json
cat updated-payload.json
- name: Submit the package
env:
SESSION_TOKEN: ${{ steps.get_session_token.outputs.SESSION_TOKEN }}
BASE_URL: ${{ secrets.ADOBE_EQP_API_URL }}
run: |
# Sleep and wait for malware check to finish
sleep_duration=120
sleep $sleep_duration
# Make the POST request and capture the response
response_body=$(curl -s -X POST \
-H "Authorization: Bearer $SESSION_TOKEN" \
-H "Content-Type: application/json" \
--data @updated-payload.json \
"${BASE_URL}/rest/v1/products/packages")
if [ -n "response_body" ]; then
echo "Response body: $response_body" # For debugging
# Extract the "code" field from the JSON response
code=$(echo "$response_body" | jq -r '.[0].code // empty')
if [ -n "$code" ]; then
echo "$code"
if [ "$code" -eq 1321 ]; then
echo "The package is submitted as a draft and waiting for malware check."
fi
fi
else
echo "SUCCESS"
fi
6 changes: 5 additions & 1 deletion .github/workflows/mftf-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ on:
workflow_dispatch:
pull_request:
branches: [main]
pull_request_target:
branches: [main]

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' }}
strategy:
matrix:
include:
Expand All @@ -26,7 +30,7 @@ jobs:
- uses: actions/checkout@v3

- name: Start services
run: docker-compose -f .github/docker-compose.yml -f .github/docker-compose.mftf.yml up -d
run: docker compose -f .github/docker-compose.yml -f .github/docker-compose.mftf.yml up -d

# Temp solution to wait for install script to run
- name: Sleep for 120 seconds
Expand Down
Loading

0 comments on commit c8b668e

Please sign in to comment.