Skip to content

Commit

Permalink
Merge branch 'first-commit' into 'master'
Browse files Browse the repository at this point in the history
feat: adding analytics with basic page view (matter-labs#154)

See merge request zeeve-platform/tracehawk/altava/bridge!1
  • Loading branch information
Ayush-T28 committed Jul 9, 2024
2 parents 1267c83 + ac03615 commit ad64016
Show file tree
Hide file tree
Showing 292 changed files with 53,664 additions and 59 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WALLET_CONNECT_PROJECT_ID=373a8744ceaac00934aec708a3fceea6
ANKR_TOKEN=
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
*.log*
.idea
.nuxt
.nitro
.cache
.output
dist
tests
tailwind.config.js
24 changes: 24 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
root: true,
extends: ["@nuxtjs/eslint-config-typescript", "@vue/eslint-config-prettier"],
rules: {
semi: ["error", "always"], // Require semicolons
quotes: ["error", "double"], // Require double quotes

"import/order": [
"error",
{
groups: [["builtin", "external"], ["internal"], ["sibling", "parent"], "index", "object", "type"],
"newlines-between": "always",
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],

"vue/multi-word-component-names": "off", // Allow multi-word component names
"vue/require-default-prop": "off", // Allow props without default values
"vue/no-multiple-template-root": "off", // Allow multiple root elements in templates
},
};
21 changes: 21 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"projects": {
"default": "zksync-dapp-wallet-v2"
},
"targets": {
"zksync-dapp-wallet-v2": {
"hosting": {
"web": [
"zksync-dapp-wallet-v2"
]
}
},
"staging-zksync-dapp-wallet-v2": {
"hosting": {
"web": [
"staging-zksync-dapp-wallet-v2"
]
}
}
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
164 changes: 164 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Testing Portal using e2e
on:
workflow_call:
secrets:
ALLURE_TOKEN:
description: 'A token passed from the caller workflow'
required: true
inputs:
environmentTags:
type: string
default: ''
required: false
targetUrl:
type: string
default: 'https://staging-portal.zksync.dev/'
required: true
network:
type: string
default: 'Sepolia'
required: true
publish_to_allure: #Here we define the variable that can be overwritten by caller workflow
type: boolean
description: "Publish test results to allure"
default: true
required: false

env:
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
ALLURE_SEARCH_REQUEST: '[{"id":"name","type":"string","value":"#${{ github.run_number }}"}]'
ALLURE_BASIC_TAGS: "${{ github.head_ref }}, #${{ github.run_number }}, ${{ github.event.pull_request.title }}"
ALLURE_PROJECT_ID: ${{ vars.ALLURE_PROJECT_ID }}
ALLURE_ENDPOINT: ${{ vars.ALLURE_ENDPOINT }}

E2E_WALLET_SECRET_PK: ${{ secrets.E2E_WALLET_SECRET_PK }}
E2E_WALLET_SALT_IV: ${{ secrets.E2E_WALLET_SALT_IV }}
E2E_WALLET_PASSWORD_MM: ${{ secrets.E2E_WALLET_PASSWORD_MM }}

E2E_WALLET_1_MAIN: ${{ vars.E2E_WALLET_1_MAIN }}
E2E_WALLET_2_SECOND: ${{ vars.E2E_WALLET_2_SECOND }}
E2E_WALLET_0_EMPTY: ${{ vars.E2E_WALLET_0_EMPTY }}

E2E_WALLET_1_MAIN_PUB_KEY: ${{ vars.E2E_WALLET_1_MAIN_PUB_KEY }}
E2E_WALLET_2_SECOND_PUB_KEY: ${{ vars.E2E_WALLET_2_SECOND_PUB_KEY }}
E2E_WALLET_0_EMPTY_PUB_KEY: ${{ vars.E2E_WALLET_0_EMPTY_PUB_KEY }}


jobs:
e2e:
runs-on: [ matterlabs-ci-runner ]
strategy:
fail-fast: false
max-parallel: 20
matrix:
command: ["xvfb-run --auto-servernum --server-args '-screen 0 1920x1080x24' npx cucumber-js --tags "]
tags: [
"@artifacts and @bridge",
"@artifacts and @contactsPage",
"@artifacts and @depositPage",
"@artifacts and @transferPage",
"@artifacts and @header",
"@artifacts and @menuItems",
"@artifacts and @upperNavigationMenu",
"@artifacts and @contactsPage",
"@artifacts and @withdraw",
"@navigation and not @emptyWallet",
"@redirection and @resetAllowance",
"@artifacts and @various",
"@artifacts and @transactionsItems",
"@transactions and @deposit and @blockchain",
"@transactions and @deposit and @noblockchain",
"@transactions and @deposit and @emptyWallet",
"@transactions and @deposit and @resetAllowance",
"@transactions and @withdraw",
"@various and @emptyWallet",
"@actions and @contacts"
]

name: '${{ matrix.tags }}'

container:
image: mcr.microsoft.com/playwright:v1.35.1-focal
options: --user root
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Create metamask extension folder
run: |
mkdir -p ./tests/e2e/src/support/extension
chown -R root ./
chmod 777 -R ./tests/e2e/src/support/extension
- name: Install Dependencies
run: |
npm i --no-audit
- name: Install Metamask extension
run: |
echo "cd to tests/e2e/ dir"
cd tests/e2e/
echo "Postinstall"
npm run postinstall
- name: Download allurectl
run: |
wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O ./allurectl
- name: Change permission for allurectl
run: |
chmod +x ./allurectl
- name: Launch tests
id: launch
env:
CI: 'true'
TARGET_ENV: ${{ inputs.targetUrl }}
DAPP_NETWORK: ${{ inputs.network }}
run: |
echo "Run tests"
cd tests/e2e/
${{ matrix.command }}'${{ matrix.tags }} ${{ inputs.environmentTags }}'
- name: Reset tags quotes
if: always()
run: |
echo "MATRIX_TAG_WITHOUT_QUOTES=$(echo ${{ matrix.tags }} | sed -e 's/@//g' )" >> $GITHUB_ENV
- name: Create launch ID
if: always()
env:
ALLURE_LAUNCH_NAME: "#${{ github.run_number }} ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
ALLURE_LAUNCH_TAGS: "${{ env.ALLURE_BASIC_TAGS }}, ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
run: |
echo "ALLURE_LAUNCH_ID=$(./allurectl launch create --launch-name '${{ env.ALLURE_LAUNCH_NAME }}' --no-header --format ID | tail -n1)" >> $GITHUB_ENV
- name: Upload tests to the Allure proj
if: always() && inputs.publish_to_allure == true # <-- no brackets, 'true' does not work here: https://github.com/actions/runner/issues/1483#issuecomment-1090972149
run: |
./allurectl upload tests/e2e/allure-results --launch-id ${{ env.ALLURE_LAUNCH_ID }}
./allurectl launch close ${{ env.ALLURE_LAUNCH_ID }}
- if: failure()
name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: portal_e2e_${{ github.run_number }}_artifacts
path: tests/e2e/artifacts/*

publish:
name: Publish Allure link to GIT
runs-on: ubuntu-latest
needs: e2e
if: always()
steps:
- name: Prepare a link
run: |
echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV
- name: Publish Allure link to GIT Summary
run: |
LINK="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}"
echo "Allure [e2e tests]($LINK) :rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
52 changes: 52 additions & 0 deletions .github/workflows/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy To Feature Branch
on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
dappUrl: ${{ steps.deploy.outputs.details_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: |
npm ci --force
- name: Lint
run: |
npm run lint
- name: Setup .env
run: |
echo "WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}" > .env
echo "ANKR_TOKEN=${{ secrets.ANKR_TOKEN }}" >> .env
echo "SCREENING_API_URL=${{ secrets.SCREENING_API_URL }}" >> .env
echo "DATAPLANE_URL=${{ secrets.DATAPLANE_URL }}" >> .env
echo "RUDDER_KEY=${{ secrets.RUDDER_KEY }}" >> .env
echo "MASA_KEY=${{ secrets.MASA_KEY }}" >> .env
echo "MASA_APP_ID=${{ secrets.MASA_APP_ID }}" >> .env
- name: Build
run: |
npm run generate
- name: Deploy
uses: matter-labs/action-hosting-deploy@main
id: deploy
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_STAGING_ZKSYNC_DAPP_WALLET_V2 }}"
projectId: staging-zksync-dapp-wallet-v2
expires: 7d
19 changes: 19 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Lint PR"

on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
label:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
with:
subjectPattern: ^(?![A-Z]).+$
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy Package to Production
"on":
workflow_dispatch:
inputs:
version:
type: string
description: "A release version to deploy, e.g. v1.0.0"
required: true
default: "v1.0.0"

jobs:
build_and_deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
ref: refs/tags/${{ github.event.inputs.version }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: |
npm ci --force
- name: Setup .env
run: |
echo "WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}" > .env
echo "ANKR_TOKEN=${{ secrets.ANKR_TOKEN }}" >> .env
echo "SCREENING_API_URL=${{ secrets.SCREENING_API_URL }}" >> .env
echo "DATAPLANE_URL=${{ secrets.DATAPLANE_URL }}" >> .env
echo "RUDDER_KEY=${{ secrets.RUDDER_KEY }}" >> .env
echo "MASA_KEY=${{ secrets.MASA_KEY }}" >> .env
echo "MASA_APP_ID=${{ secrets.MASA_APP_ID }}" >> .env
- name: Build
run: |
npm run generate
- name: Deploy to Production
uses: matter-labs/action-hosting-deploy@main
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZKSYNC_DAPP_WALLET_V2 }}"
projectId: zksync-dapp-wallet-v2
channelID: live
Loading

0 comments on commit ad64016

Please sign in to comment.