feat(medusa-payment-paypal,medusa-payment-stripe): speed up unit tests in CI (#6806)

* chore: shard unit tests

* chore: move paypal and stripe to swc

* chore: update actions

* chore: refactor http paypal client

* chore: added changeset

* chore: remove medusa changes
This commit is contained in:
Riqwan Thamir
2024-03-25 15:27:40 +01:00
committed by GitHub
parent 9073d7aba3
commit bacfa3e17b
14 changed files with 141 additions and 144 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Get array of workspaces
# convert NDJSON stream to an array of arrays, divided by chunk size
# The reason we do a conditional here is that github actions thinks that there is
# a secret present with the output of this and therefore refuses to share data between jobs
if [ -z "${CHUNKS}" ]; then
export CHUNKS=$(yarn workspaces list --json | jq -j '[inputs | .name]' | jq -r | jq -cM '[_nwise(length / 2 | ceil)]')
fi
# get the workspaces of the current CHUNK environment
workspaces=$(echo $CHUNKS | jq -r ".[$CHUNK]")
echo "workspaces - $workspaces"
# Initialize an empty string for the filters
filters=""
# Loop through each workspace in the array
for workspace in $(echo "$workspaces" | jq -r '.[]'); do
# Add the workspace name to the filters array as an argument
filters+=" --filter=${workspace}"
done
# Run the test in the selected chunk
yarn run test $filters