Skip to content

Commit

Permalink
worklow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Justas Vaitkus authored and Justas Vaitkus committed Nov 21, 2024
1 parent 8d75a14 commit fe41d6d
Showing 1 changed file with 43 additions and 42 deletions.
85 changes: 43 additions & 42 deletions .github/workflows/saferpayCheckouting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,60 @@ jobs:
include:
- prestashop: 'PS817'
make: 'make e2eh817'
subdomain: 'safer817'
subdomain: 'demoshop8'
port: '8002'
yml: 'docker-compose.817.yml'
url: 'https://magical-singular-trout.ngrok-free.app'
yml: 'docker-compose.8.yml'
url: 'https://demoshop8.ngrok.io'
test_spec: 'cypress/e2e/**'
steps:
- name: Checkouting
uses: actions/[email protected]

- run: wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
- name: Checkout
uses: actions/[email protected]
- run: wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
shell: bash
- run: tar -xvf ngrok-v3-stable-linux-amd64.tgz
- run: unzip -qq -o ngrok-stable-linux-amd64.zip
shell: bash
- run: ./ngrok authtoken ${{ secrets.NGROK_TOKEN }}
shell: bash
- run: ./ngrok http --region=eu --log=stdout --domain=magical-singular-trout.ngrok-free.app 8002 > ngrok.log &
shell: bash

- name: Extract ngrok URL
run: |
sleep 10 # Give ngrok some time to start up
echo "Checking if ngrok is running..."
ps aux | grep ngrok
echo "Contents of ngrok.log:"
cat ngrok.log
NGROK_URL=$(grep -o 'url=https://[^[:space:]]*' ngrok.log | cut -d= -f2 | head -n1)
echo "NGROK_URL=$NGROK_URL" >> $GITHUB_ENV
- run: ./ngrok http -region=us -subdomain=${{ matrix.subdomain }} ${{ matrix.port }} > ngrok.log &
shell: bash

- name: Use ngrok URL
run: echo "The ngrok URL is ${{ env.NGROK_URL }}"

- name: Installing composer
- name: Install composer
run: composer i

- name: Installing NPM, NPX packages
run: npm ci & npx browserslist@latest --update-db

- name: ${{ matrix.prestashop }} installing / Module Install and Uninstall testing...
- name: Install package
run: |
${{ matrix.make }}
npm ci
npm update
npx browserslist@latest --update-db
- name: ${{ matrix.prestashop }} installing / Module Install and Uninstall testing
run: |
${{ matrix.make }}
- name: Waiting for Ngrok tunnel
run: |
URL="${{ matrix.url }}"
TIMEOUT=120
start_time=$(date +%s)
while true; do
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))

if [ "$elapsed_time" -ge "$TIMEOUT" ]; then
echo "Timeout reached. Ngrok tunnel is not ready within $TIMEOUT seconds."
exit 1
fi

response=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$response" = "302" ]; then
echo "URL is returning 302 HTTP status code, Ngrok tunnel is reached, good to go!"
break # Exit the loop if the response is 302
else
echo "URL is not ready yet, because Ngrok sessions are all in use at the moment, please wait. Retrying to build the Ngrok tunnel again in 5 seconds..."
sleep 5 # Wait for 5 seconds before retrying
./ngrok http -region=us -subdomain=${{ matrix.subdomain }} ${{ matrix.port }} > ngrok.log &
fi
done


- name: Running ${{ matrix.prestashop }} Cypress E2E tests
Expand Down Expand Up @@ -103,14 +115,3 @@ jobs:
path: |
cypress/videos
cypress/screenshots
Stop-ngrok:
runs-on: ubuntu-latest
needs: Cypress-E2E-817
if: always()
steps:
- name: Stop ngrok process
run: |
pkill ngrok || echo "ngrok process not found"
shell: bash

0 comments on commit fe41d6d

Please sign in to comment.