Skip to content

Wait for deployment of app to finish before executing e2e tests #92

Wait for deployment of app to finish before executing e2e tests

Wait for deployment of app to finish before executing e2e tests #92

Workflow file for this run

name: Synpress tests
on:
pull_request:
# types: [closed]
branches: [main, wait-for-deploy-e2e]
jobs:
check-workflow-status:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.check.outputs.status }}
steps:
- name: Check workflow status
id: check
run: |
status=""
count=0
while [[ "$status" != "completed" && $count -lt 100 ]]; do
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs")
echo $response
status=$(echo $response | jq -r '.workflow_runs[] | select(.name=="Centrifuge App") | .status')
if [ $count -eq 10 ]; then
echo "Workflow not completed in 100 minutes, exiting..."
exit 1
fi
if [[ "$status" != "completed" ]]; then
echo "Workflow not completed, waiting..."
sleep 60
count=$((count+1))
fi
done
echo "::set-output name=status::$status"
cypress-run:
needs: check-workflow-status
if: ${{ needs.check-workflow-status.outputs.status == 'completed' }}
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Run xvfb and fluxbox
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
env:
DISPLAY: :0.0
- uses: iamsauravsharma/[email protected]
with:
# input-prefix: '' # Optional (default: '')
file-path: 'centrifuge-app/.env' # Optional (default : '.env')
# output-prefix: 'OUTPUT_' # Optional (default: '')
env: # env available for only this steps
CYPRESS_PRIVATE_KEY: ${{secrets.CYPRESS_PRIVATE_KEY}}
PRIVATE_KEY: ${{secrets.CYPRESS_PRIVATE_KEY}}
NETWORK_NAME: centrifuge
RPC_URL: https://fullnode.development.cntrfg.com
CHAIN_ID: 2000
SYMBOL: DEVEL
IS_TESTNET: true
DEBUG: true
- name: Synpress run
uses: cypress-io/github-action@v6
with:
working-directory: centrifuge-app
install-command: yarn
command: yarn run e2e:run:ci
browser: chrome
config-file: synpress.config.ts
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
env:
# pass the Cypress Cloud record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_PRIVATE_KEY: ${{ secrets.CYPRESS_PRIVATE_KEY }}
PRIVATE_KEY: ${{ secrets.CYPRESS_PRIVATE_KEY }}
CYPRESS_BASE_URL: https://app-dev.k-f.dev
DISPLAY: :0.0