Skip to content

Commit

Permalink
do env var replacement for cloudflare only
Browse files Browse the repository at this point in the history
  • Loading branch information
morde08 committed Jul 17, 2024
1 parent 2351421 commit 0a2d75c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/actions/performance-tests/art.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config:
threshold: 1
publish-metrics:
- type: prometheus
pushgateway: 'https://pushgateway-testnet.rpc.zetachain.com/${CLOUDFLARE_UUID}'
pushgateway: 'https://pushgateway-testnet.rpc.zetachain.com/-=CLOUDFLARE_UUID=-'
tags:
- 'type:loadtest'
summary: true
Expand Down
41 changes: 3 additions & 38 deletions .github/workflows/ci-nightly-performance-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,11 @@ jobs:
env:
CLOUDFLARE_UUID: ${{ secrets.CLOUDFLARE_UUID }}
run: |
# Check if the inputs.endpoint starts with https:// or http://
if [[ "${{inputs.endpoint}}" =~ ^https:// ]]; then
# Set the http_request_protocol to https if the URL starts with https://
export http_request_protocol=https
elif [[ "${{inputs.endpoint}}" =~ ^http:// ]]; then
# Set the http_request_protocol to http if the URL starts with http://
export http_request_protocol=http
else
# If the URL doesn't start with either http:// or https://, print an error and exit
echo "Please input a url with either https:// or http://" && exit 1
fi
# Check if inputs.endpoint is different from the default "http://localhost:9545"
if [ "${{inputs.endpoint}}" != "http://localhost:9545" ]; then
# Check if inputs.endpoint is not empty
if [ -n "${{inputs.endpoint}}" ]; then
# If inputs.endpoint isn't different from the default and is not empty, use inputs.endpoint
export endpoint_to_test=${{inputs.endpoint}}
# Remove the protocol (http:// or https://) from endpoint_to_test
endpoint_to_test=${endpoint_to_test#http://}
endpoint_to_test=${endpoint_to_test#https://}
else
# If inputs.endpoint is empty, strip the protocol from endpoint_to_test
endpoint_to_test=${endpoint_to_test#http://}
endpoint_to_test=${endpoint_to_test#https://}
fi
else
# If inputs.endpoint is "http://localhost:9545", strip the protocol from endpoint_to_test
endpoint_to_test=${endpoint_to_test#http://}
endpoint_to_test=${endpoint_to_test#https://}
fi
# Replace -=endpoint_to_test=- placeholder in the art.yaml file with the endpoint_to_test value
sed -i "s/-=endpoint_to_test=-/${endpoint_to_test}/g" .github/actions/performance-tests/art.yaml
# Replace -=http_request_protocol=- placeholder in the art.yaml file with the http_request_protocol value
sed -i "s/-=http_request_protocol=-/${http_request_protocol}/g" .github/actions/performance-tests/art.yaml
echo "CLOUDFLARE_UUID=${{ secrets.CLOUDFLARE_UUID }}" >> ${GITHUB_ENV}
# Replace -=CLOUDFLARE_UUID=- placeholder in the art.yaml file with the correct value
sed -i "s/-=CLOUDFLARE_UUID=-/${CLOUDFLARE_UUID}/g" .github/actions/performance-tests/art.yaml
- name: "EXECUTE:PERFORMANCE:TESTS"
env:
CLOUDFLARE_UUID: ${{ secrets.CLOUDFLARE_UUID }}
run: |
# Execute Artillery to run performance tests using the specified configuration file
artillery run .github/actions/performance-tests/art.yaml \
Expand Down

0 comments on commit 0a2d75c

Please sign in to comment.