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): make 2 batches of stable connectors mandatory (#11590)
CHALLA NISHANTH BABUb92657604785
diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.ymlindex e02f19e485..18dad565f8 100644--- a/.github/workflows/cypress-tests-runner.yml+++ b/.github/workflows/cypress-tests-runner.yml@@ -16,15 +16,14 @@ concurrency:env:CARGO_INCREMENTAL: 0CARGO_NET_RETRY: 10- PAYMENTS_CONNECTORS: "stripe cybersource"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_1: "cryptopay finix nexixpay"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_2: "adyen checkout zift"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_3: "airwallex finix noon"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_4: "nmi fiuu gigadat"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_5: "worldpayxml worldpay loonio"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_6: "authorizedotnet cashtocode volt"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_7: "paypal novalnet redsys"- OPTIONAL_PAYMENTS_CONNECTORS_BATCH_8: "paypal nuvei"+ MANDATORY_PAYMENTS_CONNECTORS_BATCH_1: "cybersource stripe authorizedotnet"+ MANDATORY_PAYMENTS_CONNECTORS_BATCH_2: "adyen nexixpay nmi"+ OPTIONAL_PAYMENTS_CONNECTORS_BATCH_1: "cashtocode loonio fiuu"+ OPTIONAL_PAYMENTS_CONNECTORS_BATCH_2: "gigadat zift resys"+ OPTIONAL_PAYMENTS_CONNECTORS_BATCH_3: "worldpay braintree cryptopay"+ OPTIONAL_PAYMENTS_CONNECTORS_BATCH_4: "finix airwallex checkout"+ OPTIONAL_PAYMENTS_CONNECTORS_BATCH_5: "paypal worldpayxml volt"+ OPTIONAL_PAYMENTS_CONNECTORS_BATCH_6: "novalnet noon"ALPHA_PAYMENTS_CONNECTORS: "celero silverflow"RUST_BACKTRACE: shortRUSTUP_MAX_RETRIES: 10@@ -97,7 +96,7 @@ jobs: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+ runs-on: hyperswitch-runnersenv:# Use `sccache` for caching compilation artifactsRUSTC_WRAPPER: sccache@@ -139,7 +138,7 @@ jobs:- name: Build projectif: ${{ env.RUN_TESTS == 'true' }}- run: cargo build --package router --bin router --jobs 3+ run: cargo build --package router --bin router --jobs 2- name: Upload binary artifactif: ${{ env.RUN_TESTS == 'true' }}@@ -149,74 +148,55 @@ jobs:overwrite: truepath: target/debug/routerretention-days: 1-- build-hyperswitch-runners:- name: Build hyperswitch server(hyperswitch-runners)++ prepare-mandatory-matrix:+ name: Prepare Mandatory Connectors matrix to run cypress testsif: |github.event_name == 'merge_group' ||(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'S-test-ready'))runs-on: hyperswitch-runners- env:- # Use `sccache` for caching compilation artifacts- RUSTC_WRAPPER: sccache- steps:- - name: Skip tests for PRs from forks+ outputs:+ mandatory-matrix: ${{ steps.set-mandatory-matrix.outputs.matrix }}+ steps:+ - name : Set matrix for mandatory connectors batches+ id: set-mandatory-matrixshell: bash- if: ${{ env.RUN_TESTS == 'false' }}- run: echo 'Skipping tests for PRs from forks'-- - name: Checkout repository- if: ${{ env.RUN_TESTS == 'true' }}- uses: actions/checkout@v5-- - name: Install mold linker- if: ${{ env.RUN_TESTS == 'true' }}- uses: rui314/setup-mold@v1- with:- make-default: true-- - name: Install Rust- if: ${{ env.RUN_TESTS == 'true' }}- uses: dtolnay/rust-toolchain@master- with:- toolchain: stable 2 weeks ago- components: clippy-- - name: Install Protoc- if: ${{ env.RUN_TESTS == 'true' }}- uses: arduino/setup-protoc@v3- with:- repo-token: ${{ secrets.GITHUB_TOKEN }}-- - name: Install sccache- if: ${{ env.RUN_TESTS == 'true' }}- uses: taiki-e/install-action@v2- with:- tool: sccache- checksum: true-- - name: Build project- if: ${{ env.RUN_TESTS == 'true' }}- run: cargo build --package router --bin router+ run: |+ {+ echo "matrix<<EOF"+ echo '{+ "batch": [+ {+ "name": "batch-1",+ "connectors": "'"${MANDATORY_PAYMENTS_CONNECTORS_BATCH_1}"'",+ "parallel": 3,+ "report_artifact_name": "cypress-mandatory-test-results-batch-1",+ "server_logs_artifact": "server-logs-batch-1"+ },+ {+ "name": "batch-2",+ "connectors": "'"${MANDATORY_PAYMENTS_CONNECTORS_BATCH_2}"'",+ "parallel": 3,+ "report_artifact_name": "cypress-mandatory-test-results-batch-2",+ "server_logs_artifact": "server-logs-batch-2"+ }+ ]+ }'+ echo "EOF"+ } >> "$GITHUB_OUTPUT"- - name: Upload binary artifact- if: ${{ env.RUN_TESTS == 'true' }}- uses: actions/upload-artifact@v7- with:- name: hyperswitch-server-hyperswitch-runners- overwrite: true- path: target/debug/router- retention-days: 1-- runner:+ mandatory-cypress-tests:name: Run mandatory Cypress tests- needs: build-hyperswitch+ needs: [build-hyperswitch, prepare-mandatory-matrix]if: |- github.event_name == 'merge_group' ||- (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'S-test-ready'))+ (github.event_name == 'merge_group' ||+ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'S-test-ready')))permissions:pull-requests: write- runs-on: ubuntu-latest+ runs-on: hyperswitch-runners+ strategy:+ fail-fast: false+ matrix: ${{ fromJson(needs.prepare-mandatory-matrix.outputs['mandatory-matrix']) }}env:# Use `sccache` for caching compilation artifactsRUSTC_WRAPPER: sccache@@ -302,6 +282,7 @@ jobs:shell: bashrun: |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 keysif: ${{ env.RUN_TESTS == 'true' }}@@ -361,14 +342,15 @@ jobs: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.txtrun: |# Start the server in the background- target/debug/router &+ 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+ # Wait for the server to start in port 8080COUNT=0while ! nc -z localhost 8080; doif [ $COUNT -gt 12 ]; then # Wait for up to 2 minutes (12 * 10 seconds)@@ -386,235 +368,72 @@ jobs:env:CYPRESS_BASEURL: "http://localhost:8080"ROUTER__SERVER__WORKERS: 4+ PAYMENTS_CONNECTORS: "${{ matrix.batch.connectors }}"shell: bash -leuo pipefail {0}run: |- scripts/execute_cypress.sh+ scripts/execute_cypress.sh --parallel ${{ matrix.batch.parallel }}kill "${{ env.PID }}"++ - name: Upload server logs on failure+ if: env.RUN_TESTS == 'true' && 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 resultsif: env.RUN_TESTS == 'true' && failure()uses: actions/upload-artifact@v7with:- name: cypress-test-results-mandatory-github-runners+ name: ${{ matrix.batch.report_artifact_name }}path: |cypress-tests/cypress/reports/retention-days: 1- - name: Remove S-test-ready label on failure of mandatory Cypress tests- if: failure() && env.RUN_TESTS == 'true' && github.event_name != 'merge_group'- env:- GH_TOKEN: ${{ github.token }}- run: |- gh pr edit ${{ github.event.pull_request.number }} --remove-label "S-test-ready" --repo ${{ github.repository }}-- runner-hyperswitch-runners:- name: Run mandatory Cypress tests (hyperswitch-runners)- needs: build-hyperswitch-runners+ mandatory-cypress-tests-consolidated-result:+ name: Mandatory Cypress Tests — Consolidated Result+ needs: [mandatory-cypress-tests]+ runs-on: ubuntu-latestif: |- github.event_name == 'merge_group' ||- (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'S-test-ready'))+ (github.event_name == 'merge_group' ||+ (github.event_name == 'pull_request' &&+ contains(github.event.pull_request.labels.*.name, 'S-test-ready'))) && !cancelled()permissions:pull-requests: write- runs-on: hyperswitch-runners- 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: Skip tests for PRs from forks- if: ${{ env.RUN_TESTS == 'false' }}- shell: bash- run: echo 'Skipping tests for PRs from forks'-- - name: Checkout repository- if: ${{ env.RUN_TESTS == 'true' }}- uses: actions/checkout@v5-- - name: Install Rust- if: ${{ env.RUN_TESTS == 'true' }}- uses: dtolnay/rust-toolchain@master- with:- toolchain: stable 2 weeks ago- components: rustfmt-- - name: Install sccache- if: ${{ env.RUN_TESTS == 'true' }}- uses: taiki-e/install-action@v2- with:- tool: sccache- checksum: true-- - name: Download hyperswitch server artifact- if: ${{ env.RUN_TESTS == 'true' }}- uses: actions/download-artifact@v8- with:- name: hyperswitch-server-hyperswitch-runners- path: target/debug-- - name: Make server executable- if: ${{ env.RUN_TESTS == 'true' }}- run: chmod +x target/debug/router-- - name: Download Encrypted TOML from S3 and Decrypt- if: ${{ env.RUN_TESTS == 'true' }}- 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- if: ${{ env.RUN_TESTS == 'true' }}+ - name: Evaluate Matrix Resultsshell: 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- if: ${{ env.RUN_TESTS == 'true' }}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- if: ${{ env.RUN_TESTS == 'true' }}- uses: baptiste0928/[email protected]- with:- crate: diesel_cli- features: postgres- args: --no-default-features-- - name: Install Just- if: ${{ env.RUN_TESTS == 'true' }}- uses: taiki-e/install-action@v2- with:- tool: just- checksum: true-- - name: Install Node.js- if: ${{ env.RUN_TESTS == 'true' }}- uses: actions/setup-node@v4- with:- node-version: "24"-- - name: Install Cypress and dependencies- if: ${{ env.RUN_TESTS == 'true' }}- run: |- npm ci --prefix ./cypress-tests-- - name: Run database migrations- if: ${{ env.RUN_TESTS == 'true' }}- 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- if: ${{ env.RUN_TESTS == 'true' }}+ GH_TOKEN: ${{ github.token }}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;"+ RESULT="${{ needs.mandatory-cypress-tests.result }}"+ RUN_TESTS_VAL="${{ env.RUN_TESTS }}"- - name: Insert GSM info into the database- if: ${{ env.RUN_TESTS == 'true' }}- 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;"+ echo "mandatory-cypress-tests result: $RESULT"+ echo "Run tests env: $RUN_TESTS_VAL"- - name: Setup Local Server- if: ${{ env.RUN_TESTS == 'true' }}- 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: |- touch "${{ env.SERVER_LOG_PATH }}"- # Start the server in the background-- target/debug/router >> "${{ env.SERVER_LOG_PATH }}" 2>&1 &- SERVER_PID=$!- echo "PID=${SERVER_PID}" >> $GITHUB_ENV+ if [ "$RUN_TESTS_VAL" == "false" ]; then+ echo "Tests were skipped (Fork PR). Marking as success."+ exit 0+ fi- # 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+ if [ "$RESULT" == "success" ]; then+ echo "All mandatory tests passed."+ exit 0+ else+ echo "Mandatory tests failed."+ if [ "${{ github.event_name }}" != "merge_group" ]; then+ echo "Removing 'S-test-ready' label from the PR."+ gh pr edit ${{ github.event.pull_request.number }} --remove-label "S-test-ready" --repo ${{ github.repository }}fi- done-- - name: Run Cypress tests- if: ${{ env.RUN_TESTS == 'true' }}- env:- CYPRESS_BASEURL: "http://localhost:8080"- ROUTER__SERVER__WORKERS: 4- shell: bash -leuo pipefail {0}- run: |- scripts/execute_cypress.sh --parallel 2-- kill "${{ env.PID }}"-+ exit 1+ fi- - name: Upload server logs on failure- if: env.RUN_TESTS == 'true' && failure()- uses: actions/upload-artifact@v7- with:- name: hyperswitch-runners-server-logs- path: ${{ env.SERVER_LOG_PATH }}- if-no-files-found: ignore- retention-days: 1-- - name: Upload Cypress test results- if: env.RUN_TESTS == 'true' && failure()- uses: actions/upload-artifact@v7- with:- name: cypress-test-results-mandatory-hyperswitch-runners- path: |- cypress-tests/cypress/reports/- retention-days: 1- prepare-matrix:+ prepare-optional-matrix:name: Prepare Optional Connectors matrix to run cypress testsif: github.event_name == 'merge_group'runs-on: hyperswitch-runners@@ -670,13 +489,6 @@ jobs:"parallel": 3,"report_artifact_name": "cypress-test-results-batch-6","server_logs_artifact": "server-logs-batch-6"- },- {- "name": "batch-7",- "connectors": "'"${OPTIONAL_PAYMENTS_CONNECTORS_BATCH_7}"'",- "parallel": 3,- "report_artifact_name": "cypress-test-results-batch-7",- "server_logs_artifact": "server-logs-batch-7"}]}'@@ -686,11 +498,11 @@ jobs:runner-optional-connectors:name: Run Optional Connectors Cypress testsif: github.event_name == 'merge_group'- needs: [ build-hyperswitch-runners, prepare-matrix ]+ needs: [ build-hyperswitch, prepare-optional-matrix ]runs-on: hyperswitch-runnersstrategy:fail-fast: false- matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}+ matrix: ${{ fromJson(needs.prepare-optional-matrix.outputs.matrix) }}env:# Use `sccache` for caching compilation artifactsRUSTC_WRAPPER: sccache@@ -738,7 +550,7 @@ jobs:- name: Download hyperswitch server artifactuses: actions/download-artifact@v8with:- name: hyperswitch-server-hyperswitch-runners+ name: hyperswitch-serverpath: target/debug- name: Make server executable@@ -852,7 +664,7 @@ jobs:uses: actions/upload-artifact@v7with:name: ${{ matrix.batch.server_logs_artifact }}- path: ${{ env.SERVER_LOG_PATH }}+ path: ${{ env.SERVER_LOG_PATH }}if-no-files-found: ignoreretention-days: 1@@ -867,7 +679,7 @@ jobs:runner_alpha:name: Run optional Cypress tests for alpha connectors- needs: build-hyperswitch-runners+ needs: build-hyperswitchif: |github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'S-test-ready')runs-on: hyperswitch-runners@@ -912,7 +724,7 @@ jobs:if: ${{ env.RUN_TESTS == 'true' }}uses: actions/download-artifact@v8with:- name: hyperswitch-server-hyperswitch-runners+ name: hyperswitch-serverpath: target/debug- name: Make server executable