Skip to content

Commit

Permalink
Improve e2e workflow execution (#1502)
Browse files Browse the repository at this point in the history
* Remove explicit node setup

* First attempt to make devnet tests use the standard cypress github action

* Make names shorter; cant read them on github UI

* Attempt to fix quotes

* Attempt #2

* Attempt #3

* Attempt #4: see cypress limitations cypress-io/github-action#482

* Remove manual node setup

* Proper golang cache setup

* Beautify script
  • Loading branch information
wmitsuda committed Nov 27, 2023
1 parent 822d7b8 commit d6526e3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/end-to-end.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: echo "defined=true" >> $GITHUB_OUTPUT

e2e-test-mainnet:
name: Run Otterscan E2E tests on mainnet
name: Run E2E tests on mainnet
runs-on: ubuntu-latest
if: ${{ needs.check-secrets.outputs.e2e-erigon-url == 'true' }}
needs: [check-secrets]
Expand All @@ -40,12 +40,6 @@ jobs:
run: |
sudo apt update
sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Node dependencies
run: npm ci
- name: Run Cypress tests on mainnet
uses: cypress-io/github-action@v6
Expand All @@ -67,7 +61,7 @@ jobs:
path: cypress/screenshots

e2e-test-devnet:
name: Run Otterscan E2E tests on a devnet
name: Run E2E tests on a devnet
runs-on: ubuntu-latest
needs: [check-secrets]
steps:
Expand All @@ -77,33 +71,31 @@ jobs:
run: |
sudo apt update
sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Node dependencies
run: npm install
- name: Download Erigon
run: git clone --branch release/2.54 --single-branch https://github.com/ledgerwatch/erigon.git
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "stable"
go-version-file: "erigon/go.mod"
cache-dependency-path: "erigon/go.sum"
- name: Build Erigon
run: |
cd erigon
make erigon
- name: Run tests from local Erigon devnet
run: |
VITE_CONFIG_JSON='{
"erigonURL": "http://127.0.0.1:8545",
"assetsURLPrefix": "http://127.0.0.1:5175"
}' npm start &
./erigon/build/bin/erigon --chain=dev --datadir=dev --http.api eth,erigon,trace,ots,ots2 --http.corsdomain "*" --http.vhosts "*" --mine --fakepow &
sleep 10
npx cypress run --spec "cypress/e2e/devnet/**/*.cy.ts,cypress/e2e/*.cy.ts" ${{ needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && '--record --tag devnet' || '' }}
- name: Run Cypress tests on devnet
uses: cypress-io/github-action@v6
with:
start: |
sh ./scripts/run-erigon-devnet-e2e-tests.sh
npm start
wait-on: "http://127.0.0.1:8545, http://localhost:5173"
spec: "cypress/e2e/devnet/**/*.cy.ts,cypress/e2e/*.cy.ts"
tag: ${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'devnet' || ''}}
record: |
${{needs.check-secrets.outputs.e2e-cypress-record-key == 'true' && 'true' || 'false'}}
env:
VITE_ERIGON_URL: "http://127.0.0.1:8545"
CYPRESS_RECORD_KEY: ${{secrets.E2E_CYPRESS_RECORD_KEY}}
- name: Upload screenshots from failing tests
uses: actions/upload-artifact@v3
Expand Down
9 changes: 9 additions & 0 deletions scripts/run-erigon-devnet-e2e-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
./erigon/build/bin/erigon \
--chain=dev \
--datadir=dev \
--http.api eth,erigon,trace,ots,ots2 \
--http.corsdomain "*" \
--http.vhosts "*" \
--mine \
--fakepow

0 comments on commit d6526e3

Please sign in to comment.