Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
ci(cypress): add extended cypress workflow for PR and merge queue (#12122)
Mani Chandra18c57ab82a01
diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.ymlindex b293b16b73..23de36e017 100644--- a/.github/workflows/cypress-tests-runner.yml+++ b/.github/workflows/cypress-tests-runner.yml@@ -23,6 +23,9 @@ env:OPTIONAL_PAYMENTS_CONNECTORS_BATCH_3: "loonio zift airwallex fiuu"ALPHA_PAYMENTS_CONNECTORS: "celero silverflow"PLATFORM_CONNECTORS: "stripe cybersource"+ EXTENDED_PAYMENTS_CONNECTORS_BATCH_1: "bluesnap gigadat loonio nmi"+ EXTENDED_PAYMENTS_CONNECTORS_BATCH_2: "paypal redsys zift"+ EXTENDED_PAYOUTS_CONNECTORS: "adyenplatform wise"RUST_BACKTRACE: shortRUSTUP_MAX_RETRIES: 10RUN_TESTS: ${{ ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)) || (github.event_name == 'merge_group')}}@@ -439,6 +442,254 @@ jobs:exit 1fi+ prepare-extended-matrix:+ name: Prepare Extended Connectors matrix to run cypress tests+ if: |+ github.event_name == 'merge_group' ||+ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'S-test-ready'))+ runs-on: ubuntu-latest+ outputs:+ extended-matrix: ${{ steps.set-extended-matrix.outputs.matrix }}+ steps:+ - name: Set matrix for extended connectors batches+ id: set-extended-matrix+ shell: bash+ run: |+ {+ echo "matrix<<EOF"+ echo '{+ "batch": [+ {+ "name": "extended-payments-batch-1",+ "payments_connectors": "'"${EXTENDED_PAYMENTS_CONNECTORS_BATCH_1}"'",+ "payouts_connectors": "",+ "parallel": 4,+ "report_artifact_name": "cypress-extended-test-results-payments-1",+ "server_logs_artifact": "extended-server-logs-payments-1"+ },+ {+ "name": "extended-payments-batch-2",+ "payments_connectors": "'"${EXTENDED_PAYMENTS_CONNECTORS_BATCH_2}"'",+ "payouts_connectors": "",+ "parallel": 3,+ "report_artifact_name": "cypress-extended-test-results-payments-2",+ "server_logs_artifact": "extended-server-logs-payments-2"+ },+ {+ "name": "extended-payouts",+ "payments_connectors": "",+ "payouts_connectors": "'"${EXTENDED_PAYOUTS_CONNECTORS}"'",+ "parallel": 2,+ "report_artifact_name": "cypress-extended-test-results-payouts",+ "server_logs_artifact": "extended-server-logs-payouts"+ }+ ]+ }'+ echo "EOF"+ } >> "$GITHUB_OUTPUT"++ extended-cypress-tests:+ name: Run extended Cypress tests+ needs: [build-hyperswitch, prepare-extended-matrix]+ runs-on: hyperswitch-runners+ strategy:+ fail-fast: false+ matrix: ${{ fromJson(needs.prepare-extended-matrix.outputs['extended-matrix']) }}+ env:+ # Use `sccache` for caching compilation artifacts+ RUSTC_WRAPPER: sccache++ services:+ redis:+ image: "public.ecr.aws/docker/library/redis:alpine"+ options: >-+ --health-cmd "redis-cli ping"+ --health-interval 10s+ --health-timeout 5s+ --health-retries 5+ ports:+ - 6379:6379+ postgres:+ image: "public.ecr.aws/docker/library/postgres:alpine"+ env:+ POSTGRES_USER: db_user+ POSTGRES_PASSWORD: db_pass+ POSTGRES_DB: hyperswitch_db+ options: >-+ --health-cmd pg_isready+ --health-interval 10s+ --health-timeout 5s+ --health-retries 5+ ports:+ - 5432:5432++ steps:+ - name: Checkout repository+ uses: actions/checkout@v5++ - name: Install Rust+ uses: dtolnay/rust-toolchain@master+ with:+ toolchain: stable 2 weeks ago+ components: rustfmt++ - name: Install sccache+ uses: taiki-e/install-action@v2+ with:+ tool: sccache+ checksum: true++ - name: Download hyperswitch server artifact+ uses: actions/download-artifact@v8+ with:+ name: hyperswitch-server+ path: target/debug++ - name: Make server executable+ run: chmod +x target/debug/router++ - name: Download Encrypted TOML from S3 and Decrypt+ env:+ AWS_ACCESS_KEY_ID: ${{ secrets.CONNECTOR_CREDS_AWS_ACCESS_KEY_ID }}+ AWS_REGION: ${{ secrets.CONNECTOR_CREDS_AWS_REGION }}+ AWS_SECRET_ACCESS_KEY: ${{ secrets.CONNECTOR_CREDS_AWS_SECRET_ACCESS_KEY }}+ CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}+ CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}+ DESTINATION_FILE_NAME: "creds.json.gpg"+ S3_SOURCE_FILE_NAME: "68bba6ea-3c75-440f-9c4b-00a30ecbb79d.json.gpg"+ shell: bash+ run: |+ mkdir -p ".github/secrets" ".github/test"++ aws s3 cp "${CONNECTOR_CREDS_S3_BUCKET_URI}/${S3_SOURCE_FILE_NAME}" ".github/secrets/${DESTINATION_FILE_NAME}"+ gpg --quiet --batch --yes --decrypt --passphrase="${CONNECTOR_AUTH_PASSPHRASE}" --output ".github/test/creds.json" ".github/secrets/${DESTINATION_FILE_NAME}"++ - name: Set paths in env+ shell: bash+ run: |+ echo "CYPRESS_CONNECTOR_AUTH_FILE_PATH=${{ github.workspace }}/.github/test/creds.json" >> $GITHUB_ENV+ echo "SERVER_LOG_PATH=${{ github.workspace }}/server-logs.txt" >> $GITHUB_ENV++ - name: Fetch keys+ env:+ TOML_PATH: "./config/development.toml"+ run: |+ LOCAL_ADMIN_API_KEY=$(yq '.secrets.admin_api_key' ${TOML_PATH})+ echo "CYPRESS_ADMINAPIKEY=${LOCAL_ADMIN_API_KEY}" >> $GITHUB_ENV++ - name: Install Diesel CLI+ uses: baptiste0928/[email protected]+ with:+ crate: diesel_cli+ features: postgres+ args: --no-default-features++ - name: Install Just+ uses: taiki-e/install-action@v2+ with:+ tool: just+ checksum: true++ - name: Install Node.js+ uses: actions/setup-node@v4+ with:+ node-version: "24"++ - name: Install Cypress and dependencies+ run: |+ npm ci --prefix ./cypress-tests++ - name: Run database migrations+ shell: bash+ env:+ DATABASE_URL: postgres://db_user:db_pass@localhost:5432/hyperswitch_db+ run: just migrate run --locked-schema++ - name: Insert card info into the database+ run: |+ PGPASSWORD=db_pass psql --host=localhost --port=5432 --username=db_user --dbname=hyperswitch_db --command "\copy cards_info FROM '.github/data/cards_info.csv' DELIMITER ',' CSV HEADER;"++ - name: Insert GSM info into the database+ run: |+ PGPASSWORD=db_pass psql --host=localhost --port=5432 --username=db_user --dbname=hyperswitch_db --command "\copy gateway_status_map FROM '.github/data/gateway_status_map.csv' DELIMITER ',' CSV HEADER;"++ - name: Setup Local Server+ env:+ ROUTER__APPLEPAY_DECRYPT_KEYS__APPLE_PAY_PPC: ${{ secrets.APPLE_PAY_PAYMENT_PROCESSING_CERTIFICATE }}+ ROUTER__APPLEPAY_DECRYPT_KEYS__APPLE_PAY_PPC_KEY: ${{ secrets.APPLE_PAY_PAYMENT_PROCESSING_CERTIFICATE_KEY }}+ ROUTER__APPLEPAY_DECRYPT_KEYS__APPLE_PAY_MERCHANT_CERT: ${{ secrets.APPLE_PAY_MERCHANT_CERTIFICATE }}+ ROUTER__APPLEPAY_DECRYPT_KEYS__APPLE_PAY_MERCHANT_CERT_KEY: ${{ secrets.APPLE_PAY_MERCHANT_CERTIFICATE_KEY }}+ SERVER_LOG_PATH: ${{ github.workspace }}/server-logs.txt+ run: |+ # Start the server in the background++ target/debug/router >> "${{ env.SERVER_LOG_PATH }}" 2>&1 &+ SERVER_PID=$!+ echo "PID=${SERVER_PID}" >> $GITHUB_ENV++ # Wait for the server to start in port 8080+ COUNT=0+ while ! nc -z localhost 8080; do+ if [ $COUNT -gt 12 ]; then # Wait for up to 2 minutes (12 * 10 seconds)+ echo "Server did not start within a reasonable time. Exiting."+ kill ${SERVER_PID}+ exit 1+ else+ COUNT=$((COUNT+1))+ sleep 10+ fi+ done++ - name: Run Cypress tests+ env:+ CYPRESS_BASEURL: "http://localhost:8080"+ ROUTER__SERVER__WORKERS: 4+ PAYMENTS_CONNECTORS: "${{ matrix.batch.payments_connectors }}"+ PAYOUTS_CONNECTORS: "${{ matrix.batch.payouts_connectors }}"+ shell: bash -leuo pipefail {0}+ run: |+ scripts/execute_cypress.sh --parallel ${{ matrix.batch.parallel }}++ kill "${{ env.PID }}"++ - name: Upload server logs on failure+ if: failure()+ uses: actions/upload-artifact@v7+ with:+ name: ${{ matrix.batch.server_logs_artifact }}+ path: ${{ env.SERVER_LOG_PATH }}+ if-no-files-found: ignore+ retention-days: 1++ - name: Upload Cypress test results+ if: failure()+ uses: actions/upload-artifact@v7+ with:+ name: ${{ matrix.batch.report_artifact_name }}+ path: |+ cypress-tests/cypress/reports/+ retention-days: 1++ extended-cypress-tests-consolidated-result:+ name: Extended Cypress Tests — Consolidated Result+ needs: [extended-cypress-tests]+ runs-on: ubuntu-latest+ if: ${{ !cancelled() }}+ steps:+ - name: Evaluate Matrix Results+ shell: bash+ run: |+ RESULT="${{ needs.extended-cypress-tests.result }}"++ echo "extended-cypress-tests result: $RESULT"++ if [ "$RESULT" == "success" ] || [ "$RESULT" == "skipped" ]; then+ echo "Extended cypress tests passed (or skipped upstream)."+ exit 0+ else+ echo "Extended cypress tests failed."+ exit 1+ fiprepare-optional-matrix:name: Prepare Optional Connectors matrix to run cypress tests