Skip to content

Commit

Permalink
BC-5468 udpate yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
UzaeirKhan committed Nov 6, 2023
1 parent 01db6cd commit e140a32
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ on:
jobs:
configure-load-secrets-and-run_tests:
runs-on: ubuntu-latest
# outputs:
# tag: ${{ steps.setting_url.outputs.TAG }}
outputs:
tag: ${{ steps.read_variables.outputs.TAG }}

steps:
- name: Checkout
Expand Down Expand Up @@ -93,6 +93,7 @@ jobs:
done
- name: Read JSON files and set environment variables
id: read_variables
run: |
instances=(brb dbc nbc)
environments=(dev ref)
Expand All @@ -101,10 +102,39 @@ jobs:
for environment in "${environments[@]}"; do
file_path="${{ github.workspace }}/e2e-system-tests/env_variables/file-${environment}-${instance}.json"
while IFS="=" read -r key value; do
# if [[ ! "$key" =~ ^CYPRESS_(BRB|NBC|DEFAULT)_ ]]; then
if [[ ! "$key" =~ ^CYPRESS_(BRB|NBC|DEFAULT)_ ]]; then
echo "Setting $key"
echo "$key=$value" >> $GITHUB_ENV
# fi
else
workflow_name="${{ github.workflow }}"
if [[ $workflow_name == *"manual"* ]]; then
echo "This is a manual workflow"
echo "CYPRESS_BRB=${{ github.event.inputs.instance1 }}" >> $GITHUB_ENV
echo "$CYPRESS_BRB"
echo "CYPRESS_NBC=${{ github.event.inputs.instance2 }}" >> $GITHUB_ENV
echo "$CYPRESS_NBC"
echo "CYPRESS_DEFAULT=${{ github.event.inputs.instance3 }}" >> $GITHUB_ENV
echo "$CYPRESS_DEFAULT"
echo "TAG=tag:stable:ci" >> $GITHUB_OUTPUT
echo "$TAG"
elif [[ $workflow_name == *"automatic"* || $workflow_name == *"scheduled"* ]]; then
echo "This is an automatic or scheduled workflow"
echo "Setting URL's $key"
echo "$key=$value" >> $GITHUB_ENV
echo "TAG=tag:stable:ci" >> $GITHUB_OUTPUT
echo "$TAG"
else
echo "This is a remote workflow"
echo "CYPRESS_BRB=${{ inputs.cypress_brb }}" >> $GITHUB_ENV
echo "$CYPRESS_BRB"
echo "CYPRESS_NBC=${{ inputs.cypress_nbc }}" >> $GITHUB_ENV
echo "$CYPRESS_NBC"
echo "CYPRESS_DEFAULT=${{ inputs.cypress_default }}" >> $GITHUB_ENV
echo "$CYPRESS_DEFAULT"
echo "TAG=tag:stable:pr:ci" >> $GITHUB_OUTPUT
echo "$TAG"
fi
fi
done < <(jq -r 'to_entries | .[] | .key + "=" + .value' "$file_path")
done
done
Expand All @@ -125,8 +155,8 @@ jobs:
uses: cypress-io/github-action@v5
with:
working-directory: e2e-system-tests
# command: npm run ${{ steps.setting_url.outputs.tag }}
command: npm run tag:stable:ci
command: npm run ${{ steps.read_variables.outputs.tag }}
# command: npm run tag:stable:ci
browser: chrome
env:
DEBUG: "@cypress/github-action"
Expand Down

0 comments on commit e140a32

Please sign in to comment.