|
| 1 | +name: End-to-End Tests |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [opened, synchronize] |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - develop |
| 8 | + - main |
| 9 | + workflow_dispatch: |
| 10 | +jobs: |
| 11 | + check-secrets: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + e2e-erigon-url: ${{ steps.e2e-erigon-url.outputs.defined }} |
| 15 | + e2e-cypress-record-key: ${{ steps.e2e-cypress-record-key.outputs.defined }} |
| 16 | + steps: |
| 17 | + - name: Check if E2E_ERIGON_URL is available |
| 18 | + id: e2e-erigon-url |
| 19 | + env: |
| 20 | + E2E_ERIGON_URL: ${{ secrets.E2E_ERIGON_URL }} |
| 21 | + if: "${{ env.E2E_ERIGON_URL != '' }}" |
| 22 | + run: echo "defined=true" >> $GITHUB_OUTPUT |
| 23 | + - name: Check if E2E_CYPRESS_RECORD_KEY is available |
| 24 | + id: e2e-cypress-record-key |
| 25 | + env: |
| 26 | + E2E_CYPRESS_RECORD_KEY: ${{ secrets.E2E_CYPRESS_RECORD_KEY }} |
| 27 | + if: "${{ env.E2E_CYPRESS_RECORD_KEY != '' }}" |
| 28 | + run: echo "defined=true" >> $GITHUB_OUTPUT |
| 29 | + |
| 30 | + e2e-test-mainnet: |
| 31 | + name: Run E2E tests on mainnet |
| 32 | + runs-on: ubuntu-latest |
| 33 | + if: ${{ needs.check-secrets.outputs.e2e-erigon-url == 'true' }} |
| 34 | + needs: [check-secrets] |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + - name: Set up xvfb |
| 39 | + run: | |
| 40 | + sudo apt update |
| 41 | + sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb |
| 42 | +
|
| 43 | + - name: Run Cypress tests on mainnet |
| 44 | + uses: cypress-io/github-action@v6 |
| 45 | + with: |
| 46 | + start: npm start |
| 47 | + wait-on: "http://localhost:5173" |
| 48 | + spec: "cypress/e2e/mainnet/**/*.cy.ts,cypress/e2e/*.cy.ts" |
| 49 | + tag: ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'mainnet' || ''}} |
| 50 | + record: | |
| 51 | + ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'true' || 'false'}} |
| 52 | + env: |
| 53 | + VITE_ERIGON_URL: ${{secrets.E2E_ERIGON_URL}} |
| 54 | + CYPRESS_RECORD_KEY: ${{secrets.E2E_CYPRESS_RECORD_KEY}} |
| 55 | + - name: Upload screenshots from failing tests |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + if: failure() |
| 58 | + with: |
| 59 | + name: Cypress Mainnet Screenshots |
| 60 | + path: cypress/screenshots |
| 61 | + |
| 62 | + e2e-test-devnet: |
| 63 | + name: Run E2E tests on a devnet |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: [check-secrets] |
| 66 | + steps: |
| 67 | + - name: Checkout |
| 68 | + uses: actions/checkout@v4 |
| 69 | + - name: Set up xvfb |
| 70 | + run: | |
| 71 | + sudo apt update |
| 72 | + sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb |
| 73 | +
|
| 74 | + - name: Download Erigon |
| 75 | + run: git clone --branch release/2.54 --single-branch https://github.com/ledgerwatch/erigon.git |
| 76 | + - name: Set up Go |
| 77 | + uses: actions/setup-go@v5 |
| 78 | + with: |
| 79 | + go-version-file: "erigon/go.mod" |
| 80 | + cache-dependency-path: "erigon/go.sum" |
| 81 | + - name: Build Erigon |
| 82 | + run: | |
| 83 | + cd erigon |
| 84 | + make erigon |
| 85 | + - name: Load devnet config |
| 86 | + id: load-devnet-config |
| 87 | + run: | |
| 88 | + OTTERSCAN_CONFIG="$(cat cypress/support/devnet-config.json | sed 's/localhost/127.0.0.1/')" |
| 89 | + OTTERSCAN_CONFIG=$(echo $OTTERSCAN_CONFIG) |
| 90 | + echo "config=$OTTERSCAN_CONFIG" >> $GITHUB_OUTPUT |
| 91 | + - name: Run Cypress tests on devnet |
| 92 | + uses: cypress-io/github-action@v6 |
| 93 | + with: |
| 94 | + start: | |
| 95 | + sh ./scripts/run-erigon-devnet-e2e-tests.sh |
| 96 | + npm run start |
| 97 | + wait-on: "http://127.0.0.1:8545, http://localhost:5173" |
| 98 | + spec: "cypress/e2e/devnet/**/*.cy.ts,cypress/e2e/*.cy.ts" |
| 99 | + tag: ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'devnet' || ''}} |
| 100 | + record: | |
| 101 | + ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'true' || 'false'}} |
| 102 | + env: |
| 103 | + VITE_CONFIG_JSON: ${{steps.load-devnet-config.outputs.config}} |
| 104 | + CYPRESS_RECORD_KEY: ${{secrets.E2E_CYPRESS_RECORD_KEY}} |
| 105 | + CYPRESS_DEVNET_ERIGON_URL: "http://127.0.0.1:8545" |
| 106 | + CYPRESS_DEVNET_SOURCIFY_SOURCE: "http://127.0.0.1:7077" |
| 107 | + - name: Upload screenshots from failing tests |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + if: failure() |
| 110 | + with: |
| 111 | + name: Cypress Devnet Screenshots |
| 112 | + path: cypress/screenshots |
0 commit comments