-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 |