Skip to content

Commit

Permalink
Merge branch 'main' into dynamic_field/sofort
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayaFoiger committed Jan 25, 2024
2 parents 5821804 + f1fd0b1 commit c0ccd99
Show file tree
Hide file tree
Showing 184 changed files with 7,192 additions and 1,510 deletions.
11 changes: 11 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ postman/ @juspay/hyperswitch-framework
Cargo.toml @juspay/hyperswitch-framework
Cargo.lock @juspay/hyperswitch-framework

crates/api_models/src/events/ @juspay/hyperswitch-analytics
crates/api_models/src/events.rs @juspay/hyperswitch-analytics
crates/api_models/src/analytics/ @juspay/hyperswitch-analytics
crates/api_models/src/analytics.rs @juspay/hyperswitch-analytics
crates/router/src/analytics.rs @juspay/hyperswitch-analytics
crates/router/src/events/ @juspay/hyperswitch-analytics
crates/router/src/events.rs @juspay/hyperswitch-analytics
crates/common_utils/src/events/ @juspay/hyperswitch-analytics
crates/common_utils/src/events.rs @juspay/hyperswitch-analytics
crates/analytics/ @juspay/hyperswitch-analytics

connector-template/ @juspay/hyperswitch-connector
crates/router/src/connector/ @juspay/hyperswitch-connector
crates/router/tests/connectors/ @juspay/hyperswitch-connector
Expand Down
Binary file removed .github/secrets/connector_auth.toml.gpg
Binary file not shown.
21 changes: 15 additions & 6 deletions .github/workflows/connector-ui-sanity-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,31 @@ jobs:
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) }}
uses: actions/checkout@v4

- name: Decrypt connector auth file
- name: Download Encrypted TOML from S3 and Decrypt
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) }}
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: "connector_auth.toml.gpg"
S3_SOURCE_FILE_NAME: "cf05a6ab-525e-4888-98b3-3b4a443b87c0.toml.gpg"
shell: bash
run: ./scripts/decrypt_connector_auth.sh
run: |
mkdir -p ${HOME}/target/secrets ${HOME}/target/test
aws s3 cp "${CONNECTOR_CREDS_S3_BUCKET_URI}/${S3_SOURCE_FILE_NAME}" "${HOME}/target/secrets/${DESTINATION_FILE_NAME}"
gpg --quiet --batch --yes --decrypt --passphrase="${CONNECTOR_AUTH_PASSPHRASE}" --output "${HOME}/target/test/connector_auth.toml" "${HOME}/target/secrets/${DESTINATION_FILE_NAME}"
- name: Set connector auth file path in env
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) }}
shell: bash
run: echo "CONNECTOR_AUTH_FILE_PATH=$HOME/target/test/connector_auth.toml" >> $GITHUB_ENV
run: echo "CONNECTOR_AUTH_FILE_PATH=${HOME}/target/test/connector_auth.toml" >> $GITHUB_ENV

- name: Set connector tests file path in env
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) }}
shell: bash
run: echo "CONNECTOR_TESTS_FILE_PATH=$HOME/target/test/connector_tests.json" >> $GITHUB_ENV
run: echo "CONNECTOR_TESTS_FILE_PATH=${HOME}/target/test/connector_tests.json" >> $GITHUB_ENV

- name: Set ignore_browser_profile usage in env
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) }}
Expand Down Expand Up @@ -154,9 +163,9 @@ jobs:
failed_connectors=()
for i in $(echo "$INPUT" | tr "," "\n"); do
echo $i
echo "${i}"
if ! cargo test --package test_utils --test connectors -- "${i}_ui::" --test-threads=1; then
failed_connectors+=("$i")
failed_connectors+=("${i}")
fi
done
Expand Down
86 changes: 0 additions & 86 deletions .github/workflows/conventional-commit-check.yml

This file was deleted.

30 changes: 20 additions & 10 deletions .github/workflows/postman-collection-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,37 @@ jobs:
- name: Repository checkout
uses: actions/checkout@v4

- name: Decrypt connector auth file
- name: Download Encrypted TOML from S3 and Decrypt
if: ${{ ((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')}}
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: "connector_auth.toml.gpg"
S3_SOURCE_FILE_NAME: "cf05a6ab-525e-4888-98b3-3b4a443b87c0.toml.gpg"
shell: bash
run: ./scripts/decrypt_connector_auth.sh
run: |
mkdir -p ${HOME}/target/secrets ${HOME}/target/test
aws s3 cp "${CONNECTOR_CREDS_S3_BUCKET_URI}/${S3_SOURCE_FILE_NAME}" "${HOME}/target/secrets/${DESTINATION_FILE_NAME}"
gpg --quiet --batch --yes --decrypt --passphrase="${CONNECTOR_AUTH_PASSPHRASE}" --output "${HOME}/target/test/connector_auth.toml" "${HOME}/target/secrets/${DESTINATION_FILE_NAME}"
- name: Set paths in env
if: ${{ ((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')}}
id: config_path
shell: bash
run: |
echo "CONNECTOR_AUTH_FILE_PATH=$HOME/target/test/connector_auth.toml" >> $GITHUB_ENV
echo "CONNECTOR_AUTH_FILE_PATH=${HOME}/target/test/connector_auth.toml" >> $GITHUB_ENV
- name: Fetch keys
if: ${{ ((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')}}
env:
TOML_PATH: "./config/development.toml"
run: |
LOCAL_ADMIN_API_KEY=$(yq '.secrets.admin_api_key' $TOML_PATH)
echo "ADMIN_API_KEY=$LOCAL_ADMIN_API_KEY" >> $GITHUB_ENV
LOCAL_ADMIN_API_KEY=$(yq '.secrets.admin_api_key' ${TOML_PATH})
echo "ADMIN_API_KEY=${LOCAL_ADMIN_API_KEY}" >> $GITHUB_ENV
- name: Install Rust
if: ${{ ((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')}}
Expand Down Expand Up @@ -118,7 +128,7 @@ jobs:
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
kill ${SERVER_PID}
exit 1
else
COUNT=$((COUNT+1))
Expand All @@ -141,10 +151,10 @@ jobs:
export PATH=${NEWMAN_PATH}:${PATH}
failed_connectors=()
for i in $(echo "$CONNECTORS" | tr "," "\n"); do
echo $i
if ! cargo run --bin test_utils -- --connector-name="$i" --base-url="$BASE_URL" --admin-api-key="$ADMIN_API_KEY"; then
failed_connectors+=("$i")
for i in $(echo "${CONNECTORS}" | tr "," "\n"); do
echo "${i}"
if ! cargo run --bin test_utils -- --connector-name="${i}" --base-url="${BASE_URL}" --admin-api-key="${ADMIN_API_KEY}"; then
failed_connectors+=("${i}")
fi
done
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/pr-convention-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Pull Request Convention Checks

on:
# This is a dangerous event trigger as it causes the workflow to run in the
# context of the target repository.
# Avoid checking out the head of the pull request or building code from the
# pull request whenever this trigger is used.
# Since we do not have a checkout step in this workflow, this is an
# acceptable use of this trigger.
pull_request_target:
types:
- opened
- edited
- reopened
- ready_for_review
- synchronize

merge_group:
types:
- checks_requested

env:
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10

jobs:
pr_title_conventional_commit_check:
name: Verify PR title follows conventional commit standards
runs-on: ubuntu-latest

steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- uses: baptiste0928/[email protected]
with:
crate: cocogitto

- name: Verify PR title follows conventional commit standards
if: ${{ github.event_name == 'pull_request_target' }}
shell: bash
env:
TITLE: ${{ github.event.pull_request.title }}
run: cog verify "$TITLE"

- name: Verify commit message follows conventional commit standards
if: ${{ github.event_name == 'merge_group' }}
shell: bash
run: cog verify '${{ github.event.merge_group.head_commit.message }}'

pr_linked_issues_check:
name: Verify PR contains one or more linked issues
runs-on: ubuntu-latest

steps:
- name: Skip check for merge queue
if: ${{ github.event_name == 'merge_group' }}
shell: bash
run: echo "Skipping PR linked issues check for merge queue"

- name: Generate GitHub app token
id: generate_app_token
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.HYPERSWITCH_BOT_APP_ID }}
private-key: ${{ secrets.HYPERSWITCH_BOT_APP_PRIVATE_KEY }}
owner: ${{ github.event.repository.owner.login }}

- name: Verify PR contains one or more linked issues
if: ${{ github.event_name == 'pull_request_target' }}
shell: bash
env:
GH_TOKEN: ${{ steps.generate_app_token.outputs.token }}
run: |
# GitHub does not provide information about linked issues for a pull request via the REST API.
# This information is available only within the GraphQL API.
# Obtain issue number and repository name with owner (in the `owner/repo` format) for all linked issues
query='query ($owner: String!, $repository: String!, $prNumber: Int!) {
repository(owner: $owner, name: $repository) {
pullRequest(number: $prNumber) {
closingIssuesReferences(first: 10) {
nodes {
number
repository {
nameWithOwner
}
}
}
}
}
}'
# Obtain linked issues in the `owner/repo#issue_number` format, one issue per line.
# The variable contains an empty string if the pull request has no linked issues.
linked_issues="$(
gh api graphql \
--raw-field "query=${query}" \
--field 'owner=${{ github.event.repository.owner.login }}' \
--field 'repository=${{ github.event.repository.name }}' \
--field 'prNumber=${{ github.event.pull_request.number }}' \
--jq '.data.repository.pullRequest.closingIssuesReferences.nodes[] | "\(.repository.nameWithOwner)#\(.number)"'
)"
if [[ -z "${linked_issues}" ]]; then
echo "::error::PR does not contain any linked issues"
exit 1
else
echo "PR contains at least one linked issue"
fi
while IFS= read -r issue; do
# Split `${issue}` by `#` to obtain repository with owner (in `owner/repository` format) and issue number
IFS='#' read -r repository_with_owner issue_number <<< "${issue}"
issue_state="$(gh issue view --repo "${repository_with_owner}" --json 'state' "${issue_number}" --jq '.state')"
# Transform `${issue_state}` to lowercase for comparison
if [[ "${issue_state,,}" != 'open' ]]; then
echo "::error::At least one of the linked issues is not open"
exit 1
fi
done <<< "${linked_issues}"
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ba = "ba" # ignore minor commit conversions
ede = "ede" # ignore minor commit conversions
daa = "daa" # Commit id
afe = "afe" # Commit id
Hashi = "Hashi" # HashiCorp

[files]
extend-exclude = [
Expand Down
Loading

0 comments on commit c0ccd99

Please sign in to comment.