Skip to content

Commit

Permalink
Merge pull request #4 from bobanetwork/safe
Browse files Browse the repository at this point in the history
Support BOBA L2s
  • Loading branch information
boyuan-chen authored Mar 7, 2024
2 parents e6e350b + 32dc871 commit faf5d4d
Show file tree
Hide file tree
Showing 982 changed files with 42,367 additions and 13,461 deletions.
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
coverage
.DS_Store
.idea
dist

build/
coverage/
cypress/
out/
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Infura token (required)
## Infura token
NEXT_PUBLIC_INFURA_TOKEN=
NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN=

Expand All @@ -22,7 +22,6 @@ NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_BEAMER_ID=

# Wallet-specific variables
NEXT_PUBLIC_WC_BRIDGE=
NEXT_PUBLIC_WC_PROJECT_ID=

# E2E tests
Expand All @@ -40,4 +39,9 @@ NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING=
NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING=

# Redefine
NEXT_PUBLIC_REDEFINE_API=
NEXT_PUBLIC_REDEFINE_API=

# Social Login
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING=
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION=

5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
{
"additionalHooks": "useAsync"
}
]
],
"no-only-tests/no-only-tests": "error"
},
"ignorePatterns": ["node_modules/", ".next/", ".github/"],
"plugins": ["unused-imports", "@typescript-eslint"]
"plugins": ["unused-imports", "@typescript-eslint", "no-only-tests"]
}
6 changes: 4 additions & 2 deletions .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ runs:
run: yarn build
env:
NEXT_PUBLIC_IS_PRODUCTION: ${{ inputs.prod }}
NEXT_PUBLIC_CYPRESS_MNEMONIC: ${{ inputs.e2e_mnemonic }}
NEXT_PUBLIC_GATEWAY_URL_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GATEWAY_URL_PRODUCTION }}
NEXT_PUBLIC_GATEWAY_URL_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GATEWAY_URL_STAGING }}
NEXT_PUBLIC_SAFE_VERSION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_VERSION }}
Expand All @@ -36,14 +37,15 @@ runs:
NEXT_PUBLIC_TENDERLY_ORG_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_ORG_NAME }}
NEXT_PUBLIC_TENDERLY_PROJECT_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_PROJECT_NAME }}
NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL }}
NEXT_PUBLIC_WC_BRIDGE: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WC_BRIDGE }}
NEXT_PUBLIC_WC_PROJECT_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WC_PROJECT_ID }}
NEXT_PUBLIC_CYPRESS_MNEMONIC: ${{ inputs.e2e_mnemonic }}
NEXT_PUBLIC_SAFE_RELAY_SERVICE_URL_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_GELATO_RELAY_SERVICE_URL_PRODUCTION }}
NEXT_PUBLIC_SAFE_RELAY_SERVICE_URL_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_GELATO_RELAY_SERVICE_URL_STAGING }}
NEXT_PUBLIC_IS_OFFICIAL_HOST: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_IS_OFFICIAL_HOST }}
NEXT_PUBLIC_REDEFINE_API: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_REDEFINE_API }}
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING }}
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION }}
NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION }}
NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING }}
NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION }}
NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING }}
NEXT_PUBLIC_SPINDL_SDK_KEY: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SPINDL_SDK_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# branch should not be protected
branch: 'main'
# user names of users allowed to contribute without CLA
allowlist: lukasschor,rmeissner,germartinez,Uxio0,dasanra,francovenica,tschubotz,luarx,DaniSomoza,iamacook,yagopv,usame-algan,schmanu,DiogoSoaress,JagoFigueroa,fmrsabino,mike10ca,bot*
allowlist: lukasschor,rmeissner,germartinez,Uxio0,dasanra,francovenica,tschubotz,luarx,DaniSomoza,iamacook,yagopv,usame-algan,schmanu,DiogoSoaress,JagoFigueroa,fmrsabino,mike10ca,jmealy,compojoom,TanyaEfremova,bot*

# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
# enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/cypress/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Cypress'

description: 'Run Cypress'

inputs:
secrets:
description: 'GitHub secrets as JSON'
required: true

spec:
description: 'A glob pattern for which tests to run'
required: true

group:
description: 'The name of the group (e.g. "smoke")'
required: true

project_id:
description: 'Cypress cloud project id'
required: false

record_key:
description: 'Cypress cloud record key'
required: false

runs:
using: 'composite'
steps:
- uses: ./.github/workflows/yarn

- name: Install Latest stable Chrome Version
shell: bash
run: |
curl -O 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
sudo apt-get install ./google-chrome-stable_current_amd64.deb
- uses: ./.github/workflows/build
with:
secrets: ${{ inputs.secrets }}
e2e_mnemonic: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_CYPRESS_MNEMONIC }}

- name: Serve
shell: bash
run: yarn serve &

- uses: cypress-io/github-action@v4
with:
spec: ${{ inputs.spec }}
group: ${{ inputs.group }}
parallel: true
browser: chrome
record: true
config: baseUrl=http://localhost:8080
env:
CYPRESS_RECORD_KEY: ${{ inputs.record_key || fromJSON(inputs.secrets).CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ fromJSON(inputs.secrets).GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ inputs.project_id }}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- uses: ./.github/workflows/build
with:
secrets: ${{ toJSON(secrets) }}
prod: ${{ github.ref == 'refs/heads/main' }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down Expand Up @@ -89,7 +90,7 @@ jobs:
## Branch preview
✅ Deploy successful!
https://${{ steps.extract_branch.outputs.branch }}--walletweb.review-wallet-web.5afe.dev
https://${{ steps.extract_branch.outputs.branch }}--walletweb.review-wallet-web.5afe.dev/home?safe=eth:0xA77DE01e157f9f57C7c4A326eeE9C4874D0598b6
message-failure: |
## Branch preview
❌ Deploy failed!
55 changes: 40 additions & 15 deletions .github/workflows/deploy-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,50 @@ on:
jobs:
dockerhub-push:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || (github.event_name == 'release' && github.event.action == 'released')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- name: Dockerhub login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Dockerhub main
- name: Deploy Main
if: github.ref == 'refs/heads/main'
run: bash scripts/github/deploy_docker.sh staging
env:
DOCKERHUB_PROJECT: ${{ secrets.DOCKER_PROJECT }}
- name: Deploy Dockerhub dev
uses: docker/build-push-action@v5
with:
push: true
tags: safeglobal/safe-wallet-web:staging
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Develop
if: github.ref == 'refs/heads/dev'
run: bash scripts/github/deploy_docker.sh dev
env:
DOCKERHUB_PROJECT: ${{ secrets.DOCKER_PROJECT }}
- name: Deploy Dockerhub tag
if: startsWith(github.ref, 'refs/tags/')
run: bash scripts/github/deploy_docker.sh ${GITHUB_REF##*/}
env:
DOCKERHUB_PROJECT: ${{ secrets.DOCKER_PROJECT }}
uses: docker/build-push-action@v5
with:
push: true
tags: safeglobal/safe-wallet-web:dev
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Tag
if: (github.event_name == 'release' && github.event.action == 'released')
uses: docker/build-push-action@v5
with:
push: true
tags: |
safeglobal/safe-wallet-web:${{ github.event.release.tag_name }}
safeglobal/safe-wallet-web:latest
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
File renamed without changes.
58 changes: 58 additions & 0 deletions .github/workflows/e2e-hp-ondemand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Happy path on demand tests

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 1,4'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-20.04
name: Cypress Happy path on demand tests
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v3

- uses: ./.github/workflows/cypress
with:
secrets: ${{ toJSON(secrets) }}
spec: |
cypress/e2e/happypath/*.cy.js
group: 'Happy path on demand tests'

- name: Python setup
if: always()
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install junitparser
if: always()
run: |
pip install junitparser
- name: Merge JUnit reports for TestRail
if: always()
run: |
junitparser merge --suite-name "Root Suite" --glob "reports/junit-*" "reports/junit-report.xml"
- name: TestRail CLI upload results
if: always()
run: |
pip install trcli
trcli -y \
-h https://gno.testrail.io/ \
--project "Safe- Web App" \
--username ${{ secrets.TESTRAIL_USERNAME }} \
--password ${{ secrets.TESTRAIL_PASSWORD }} \
parse_junit \
--title "Happy path Tests, branch: ${GITHUB_REF_NAME}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "reports/junit-report.xml"
60 changes: 60 additions & 0 deletions .github/workflows/e2e-ondemand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Regression on demand tests

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 1-5'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-20.04
name: Cypress Regression on demand tests
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v3

- uses: ./.github/workflows/cypress
with:
secrets: ${{ toJSON(secrets) }}
spec: |
cypress/e2e/regression/*.cy.js
cypress/e2e/safe-apps/*.cy.js
cypress/e2e/smoke/*.cy.js
group: 'Regression on demand tests'

- name: Python setup
if: always()
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install junitparser
if: always()
run: |
pip install junitparser
- name: Merge JUnit reports for TestRail
if: always()
run: |
junitparser merge --suite-name "Root Suite" --glob "reports/junit-*" "reports/junit-report.xml"
- name: TestRail CLI upload results
if: always()
run: |
pip install trcli
trcli -y \
-h https://gno.testrail.io/ \
--project "Safe- Web App" \
--username ${{ secrets.TESTRAIL_USERNAME }} \
--password ${{ secrets.TESTRAIL_PASSWORD }} \
parse_junit \
--title "Automated Tests, branch: ${GITHUB_REF_NAME}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "reports/junit-report.xml"
28 changes: 28 additions & 0 deletions .github/workflows/e2e-regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Regression tests

on:
pull_request:
branches:
- 'release**'
- 'release/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-20.04
name: Cypress Regression tests
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3]
steps:
- uses: actions/checkout@v3

- uses: ./.github/workflows/cypress
with:
secrets: ${{ toJSON(secrets) }}
spec: cypress/e2e/**/*.cy.js
group: 'Regression tests'
Loading

0 comments on commit faf5d4d

Please sign in to comment.