Skip to content

Commit

Permalink
Firefox injection (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobar79 authored Aug 26, 2023
1 parent b842d31 commit c2a96a9
Show file tree
Hide file tree
Showing 27 changed files with 477 additions and 138 deletions.
15 changes: 15 additions & 0 deletions .github/actions/chromeTestsSetup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Chrome tests setup'
description: 'runs Chrome tests setup'
inputs:
gh-access-token:
description: 'Github Access Token'
required: true
runs:
using: 'composite'
steps:
- uses: ./.github/actions/testsSetup
with:
gh-access-token: ${{ inputs.gh-access-token }}
- name: Install chrome
shell: 'bash'
run: npx @puppeteer/browsers install chrome@stable
15 changes: 15 additions & 0 deletions .github/actions/firefoxTestsSetup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Firefox tests setup'
description: 'runs Firefox tests setup'
inputs:
gh-access-token:
description: 'Github Access Token'
required: true
runs:
using: 'composite'
steps:
- uses: ./.github/actions/testsSetup
with:
gh-access-token: ${{ inputs.gh-access-token }}
- uses: browser-actions/setup-firefox@v1
with:
firefox-version: 'latest-devedition'
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 'test setup'
description: 'runs test setup'

name: 'Tests setup'
description: 'runs tests setup'
inputs:
gh-access-token:
description: 'Github Access Token'
Expand Down Expand Up @@ -28,9 +29,6 @@ runs:
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Install chrome
shell: 'bash'
run: npx @puppeteer/browsers install chrome@stable
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
Expand All @@ -43,6 +41,4 @@ runs:
- name: Copy dotenv
shell: 'bash'
run: cat tmp/dotenv >> .env && rm -rf tmp
- name: Clear old screenshots
shell: 'bash'
run: rm -rf screenshots/*

169 changes: 124 additions & 45 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ jobs:
with:
name: rainbowbx-${{ github.sha }}.zip
path: build/
- name: Remove old screenshots
run: rm -rf screenshots/*
# FIREFOX TESTS
firefox-e2e-parallel:
runs-on: ubuntu-latest
Expand All @@ -77,42 +79,9 @@ jobs:
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
- uses: ./.github/actions/firefoxTestsSetup
with:
name: node_modules.tar.gz
- name: Unzip node_modules
shell: 'bash'
run: tar xzf node_modules.tar.gz
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: rainbowbx-${{ github.sha }}.zip
path: build
- name: Setup xvfb
shell: 'bash'
run: |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- uses: browser-actions/setup-firefox@v1
with:
firefox-version: 'latest-devedition'
- uses: actions/checkout@v3
with:
repository: 'rainbow-me/browser-extension-env'
token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
path: tmp
- name: Copy dotenv
shell: 'bash'
run: cat tmp/dotenv >> .env && rm -rf tmp
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e parallel (Firefox)
id: FFE2eParallel
continue-on-error: true
Expand All @@ -131,6 +100,108 @@ jobs:
- name: Fail if any tests failed
if: steps.FFE2eParallel.outcome == 'failure'
run: exit 1
firefox-e2e-swap:
runs-on: swaps-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/firefoxTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e Swap (Firefox)
id: FFE2eSwap
continue-on-error: true
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=firefox
export OS=linux
export FIREFOX_BIN=/opt/hostedtoolcache/firefox/latest-devedition/x64/firefox
yarn firefox:manifest && yarn firefox:zip
yarn vitest:swap --retry=5
- name: Upload deps artifacts
if: steps.FFE2eSwap.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.FFE2eSwap.outcome == 'failure'
run: exit 1
firefox-e2e-send:
runs-on: send-runner-bx
timeout-minutes: 16
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/firefoxTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e Send (Firefox)
id: FFE2eSend
continue-on-error: true
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=firefox
export OS=linux
export FIREFOX_BIN=/opt/hostedtoolcache/firefox/latest-devedition/x64/firefox
yarn firefox:manifest && yarn firefox:zip
yarn vitest:send --retry=5
- name: Upload deps artifacts
if: steps.FFE2eSend.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.FFE2eSend.outcome == 'failure'
run: exit 1
firefox-e2e-dappInteractions:
runs-on: dapp-interactions-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/firefoxTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e Dapp Interactions (Firefox)
id: FFE2eDappInteractions
continue-on-error: true
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=firefox
export OS=linux
export FIREFOX_BIN=/opt/hostedtoolcache/firefox/latest-devedition/x64/firefox
yarn firefox:manifest && yarn firefox:zip
yarn vitest:dappInteractions --retry=5
- name: Upload deps artifacts
if: steps.FFE2eDappInteractions.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.FFE2eDappInteractions.outcome == 'failure'
run: exit 1
# CHROME TESTS
chrome-e2e-parallel:
runs-on: ubuntu-latest
Expand All @@ -141,7 +212,7 @@ jobs:
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e parallel (Chrome)
Expand All @@ -162,15 +233,15 @@ jobs:
if: steps.ChromeE2EParallel.outcome == 'failure'
run: exit 1
chrome-e2e-swap:
runs-on: beefy-runner-bx
runs-on: swaps-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e swap (Chrome)
Expand All @@ -195,21 +266,25 @@ jobs:
if: steps.ChromeE2ESwaps.outcome == 'failure'
run: exit 1
chrome-e2e-send:
runs-on: beefy-runner-bx
runs-on: send-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e send (Chrome)
id: ChromeE2ESend
continue-on-error: true
run: |
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
Expand All @@ -224,21 +299,25 @@ jobs:
if: steps.ChromeE2ESend.outcome == 'failure'
run: exit 1
chrome-e2e-dappInteractions:
runs-on: beefy-runner-bx
runs-on: dapp-interactions-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e dappInteractions (Chrome)
id: ChromeE2EDappInteractions
continue-on-error: true
run: |
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
Expand Down Expand Up @@ -378,7 +457,7 @@ jobs:
run: yarn typecheck
cleanup:
runs-on: ubuntu-latest
needs: [chrome-e2e-parallel, chrome-e2e-swap, chrome-e2e-send, chrome-e2e-dappInteractions, unit-tests, ci-checks]
needs: [firefox-e2e-parallel, firefox-e2e-swap, firefox-e2e-send, firefox-e2e-dappInteractions, chrome-e2e-parallel, chrome-e2e-swap, chrome-e2e-send, chrome-e2e-dappInteractions, unit-tests, ci-checks]
steps:
- uses: geekyeggo/delete-artifact@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ yarn-error.log
.eslintcache

build/
screenshots/

src/core/graphql/__generated__/

Expand Down
Loading

0 comments on commit c2a96a9

Please sign in to comment.