diff --git a/.github/workflows/api-e2e.yml b/.github/workflows/api-e2e.yml index eee3bb60e2..552b3f90dc 100644 --- a/.github/workflows/api-e2e.yml +++ b/.github/workflows/api-e2e.yml @@ -35,15 +35,15 @@ jobs: uses: actions/setup-node@v3 with: node-version: '18' - cache: 'npm' + cache: 'yarn' - name: Install dependencies run: | - npm ci --ignore-scripts + yarn install --ignore-scripts - name: Run e2e tests run: | - npm run test:e2e + yarn run test:e2e - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/composite@v2 diff --git a/.github/workflows/app-deploy-feature-branch.yml b/.github/workflows/app-deploy-feature-branch.yml deleted file mode 100644 index 84e93c0abe..0000000000 --- a/.github/workflows/app-deploy-feature-branch.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Deploy App To Feature Branch -on: pull_request - -jobs: - build: - name: Build and Test App - runs-on: matterlabs-firebase-deployer - permissions: - contents: read - pull-requests: write - checks: write - defaults: - run: - working-directory: ./packages/app - outputs: - dappUrl: ${{ steps.check_channel.outputs.channel_url }} - env: - CHANNEL_NAME: pr-${{ github.event.number }} - 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 Firebase CLI and auth - run: | - npm install -g firebase-tools - - - name: Install dependencies - working-directory: ./ - run: | - npm pkg delete scripts.prepare - npm ci - - - name: Lint - run: | - npm run lint -- --no-fix --max-warnings 0 - - - name: Test - run: npm run test:ci - - - name: Type check - run: npm run typecheck - - - name: Build - run: | - VITE_VERSION=${{ github.head_ref }} \ - npm run build - - - name: Build Storybook - run: npm run build-storybook - - - name: Update config - run: | - echo "window[\"##runtimeConfig\"] = { appEnvironment: \"staging\" };" > dist/config.js - - - name: Check if Firebase Hosting channel exists - working-directory: ./packages/app - id: check_channel - run: | - - CHANNEL_URL=$(firebase --project staging-scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url') - echo $CHANNEL_URL - if [ -z "$CHANNEL_URL" ]; then - echo "New channel" - firebase --project staging-scan-v2 hosting:channel:create $CHANNEL_NAME - CHANNEL_URL=$(firebase --project staging-scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url') - fi - echo "channel_url=${CHANNEL_URL}" >> $GITHUB_OUTPUT - - - name: Deploy - working-directory: ./packages/app - run: | - firebase --project staging-scan-v2 hosting:channel:deploy ${{ env.CHANNEL_NAME }} - - - name: Publish preview url - uses: thollander/actions-comment-pull-request@v2 - with: - comment_tag: preview_url - message: | - Visit the preview URL for this PR: - ${{ steps.check_channel.outputs.channel_url }} - - mainnet: - needs: build - name: Feature on Mainnet + Sepolia - uses: ./.github/workflows/app-e2e.yml - secrets: inherit - permissions: - contents: write - with: - targetUrl: ${{ needs.build.outputs.dappUrl }} - testnet_network_value_for_e2e: "/?network=sepolia" - default_network_value_for_e2e: "/?network=mainnet" - publish_to_allure: true - environmentTags: "and not @productionEnv" diff --git a/.github/workflows/app-deploy-preview.yml b/.github/workflows/app-deploy-preview.yml deleted file mode 100644 index 791a5298e5..0000000000 --- a/.github/workflows/app-deploy-preview.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Deploy App to Preview -"on": - workflow_dispatch: - inputs: - version: - type: string - description: "A release version to deploy, e.g. v2.0.0" - required: true - default: "v2.0.0" -jobs: - deploy: - name: Deploy - runs-on: matterlabs-firebase-deployer - permissions: - contents: read - outputs: - dappUrl: ${{ steps.check_channel.outputs.channel_url }} - env: - CHANNEL_NAME: ${{ github.event.inputs.version }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Install Firebase CLI and auth - run: | - npm install -g firebase-tools - - - name: Download Dist package - uses: dsaltares/fetch-gh-release-asset@master - with: - version: "tags/${{ github.event.inputs.version }}" - file: "dist.zip" - target: "dist.zip" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unzip Dist package - run: | - unzip dist.zip -d packages/app - - - name: Download Storybook package - uses: dsaltares/fetch-gh-release-asset@master - with: - version: "tags/${{ github.event.inputs.version }}" - file: "storybook-static.zip" - target: "storybook-static.zip" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unzip Storybook package - run: | - unzip storybook-static.zip -d packages/app - - - name: Check if Firebase Hosting channel exists - working-directory: ./packages/app - id: check_channel - run: | - CHANNEL_URL=$(firebase --project scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url') - if [ -z "$CHANNEL_URL" ]; then - echo "New channel" - firebase --project scan-v2 hosting:channel:create $CHANNEL_NAME - CHANNEL_URL=$(firebase --project scan-v2 hosting:channel:list --json | jq --arg channel_name "${CHANNEL_NAME}" -r '.result.channels[]|select(.name|contains($channel_name)) | .url') - fi - echo "channel_url=${CHANNEL_URL}" >> $GITHUB_OUTPUT - - - name: Deploy - working-directory: ./packages/app - run: | - firebase --project scan-v2 hosting:channel:deploy ${{ env.CHANNEL_NAME }} - - - name: Output version url on success - run: | - run: | - echo "Block explorer app has been deployed to: ${{ steps.check_channel.outputs.channel_url }} - - mainnet: - needs: deploy - name: Staging on Mainnet + Sepolia - uses: ./.github/workflows/app-e2e.yml - secrets: inherit - permissions: - contents: write - with: - targetUrl: ${{ needs.deploy.outputs.dappUrl }} - testnet_network_value_for_e2e: "/?network=sepolia" - default_network_value_for_e2e: "/?network=mainnet" - publish_to_allure: true - environmentTags: "and not @featureEnv" diff --git a/.github/workflows/app-deploy-prod.yml b/.github/workflows/app-deploy-prod.yml deleted file mode 100644 index 7e258fff2c..0000000000 --- a/.github/workflows/app-deploy-prod.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Deploy App to Production -"on": - workflow_dispatch: - inputs: - version: - type: string - description: "A release version to deploy, e.g. v2.0.0" - required: true - default: "v2.0.0" -jobs: - deploy: - name: Deploy - runs-on: matterlabs-firebase-deployer - permissions: - contents: read - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 18 - - - name: Install Firebase CLI and auth - run: | - npm install -g firebase-tools - - - name: Download Dist package - uses: dsaltares/fetch-gh-release-asset@master - with: - version: "tags/${{ github.event.inputs.version }}" - file: "dist.zip" - target: "dist.zip" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unzip Dist package - run: | - unzip dist.zip -d packages/app - - - name: Update config - run: | - echo "window[\"##runtimeConfig\"] = { sentryDSN: \"${{ vars.SENTRY_DSN }}\" };" > packages/app/dist/config.js - - - name: Download Storybook package - uses: dsaltares/fetch-gh-release-asset@master - with: - version: "tags/${{ github.event.inputs.version }}" - file: "storybook-static.zip" - target: "storybook-static.zip" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unzip Storybook package - run: | - unzip storybook-static.zip -d packages/app - - - name: Deploy - working-directory: ./packages/app - run: | - firebase --project scan-v2 deploy diff --git a/.github/workflows/app-e2e.yml b/.github/workflows/app-e2e.yml index 31820cba13..efe5c45303 100644 --- a/.github/workflows/app-e2e.yml +++ b/.github/workflows/app-e2e.yml @@ -72,7 +72,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: '18' - cache: 'npm' + cache: 'yarn' - name: Cache node modules id: cache-nodemodules @@ -93,8 +93,8 @@ jobs: working-directory: ./ if: steps.cache-nodemodules.outputs.cache-hit != 'true' run: | - npm pkg delete scripts.prepare - npm ci + yarn pkg delete scripts.prepare + yarn ci - name: Download allurectl run: wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O ./allurectl diff --git a/.github/workflows/nodejs-license.yaml b/.github/workflows/nodejs-license.yaml index eabec348eb..cdaca47683 100644 --- a/.github/workflows/nodejs-license.yaml +++ b/.github/workflows/nodejs-license.yaml @@ -58,12 +58,13 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 + cache: yarn - name: Install license checker - run: npm install -g license-checker + run: yarn global add license-checker - name: Install dependencies - run: npm ci + run: yarn install - name: Check licenses in ${{ matrix.dir }} working-directory: ${{ matrix.dir }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6c1b64f17d..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,195 +0,0 @@ -name: Create Release - -on: - push: - branches: - - main - - '[0-9]+.*' - -jobs: - createReleaseVersion: - name: Create Release Version - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - outputs: - releaseVersion: ${{ steps.release.outputs.releaseVersion }} - 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 - - - name: Lint - run: | - npm run lint -- -- --no-fix --max-warnings 0 - - - name: Test - run: | - npm run test:ci - - - name: App type check - working-directory: ./packages/app - run: | - npm run typecheck - - - name: Create Release Version - id: release - env: - GITHUB_TOKEN: ${{ github.token }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: | - VITE_APP_ENVIRONMENT=production \ - npx semantic-release - - deployBackendToStaging: - name: Deploy Block Explorer backend to staging - runs-on: [matterlabs-ci-runner] - permissions: - contents: read - needs: createReleaseVersion - if: ${{ github.ref == 'refs/heads/main' && needs.createReleaseVersion.outputs.releaseVersion != '' }} - steps: - - uses: actions/checkout@v3 - - - name: Set up Docker Build - uses: docker/setup-buildx-action@v2 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Generate build ID for Flux Image Automation - id: setVersionForFlux - run: | - sha=$(git rev-parse --short HEAD) - ts=$(date +%s%N | cut -b1-13) - echo "::set-output name=imageTag::${sha}-${ts}" - - - name: Auth to google artifact registry - run: | - gcloud auth configure-docker us-docker.pkg.dev -q - - - name: Build and push Docker image for API - uses: docker/build-push-action@v4 - with: - push: true - tags: | - "matterlabs/block-explorer-api:latest" - "matterlabs/block-explorer-api:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "matterlabs/block-explorer-api:${{ steps.setVersionForFlux.outputs.imageTag }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-api:latest" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-api:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-api:${{ steps.setVersionForFlux.outputs.imageTag }}" - file: packages/api/Dockerfile - no-cache: true - - - name: Build and push Docker image for Worker - uses: docker/build-push-action@v4 - with: - push: true - tags: | - "matterlabs/block-explorer-worker:latest" - "matterlabs/block-explorer-worker:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "matterlabs/block-explorer-worker:${{ steps.setVersionForFlux.outputs.imageTag }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-worker:latest" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-worker:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-worker:${{ steps.setVersionForFlux.outputs.imageTag }}" - file: packages/worker/Dockerfile - no-cache: true - - - name: Build and push Docker image for Data Fetcher - uses: docker/build-push-action@v4 - with: - push: true - tags: | - "matterlabs/block-explorer-data-fetcher:latest" - "matterlabs/block-explorer-data-fetcher:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "matterlabs/block-explorer-data-fetcher:${{ steps.setVersionForFlux.outputs.imageTag }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:latest" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-data-fetcher:${{ steps.setVersionForFlux.outputs.imageTag }}" - file: packages/data-fetcher/Dockerfile - no-cache: true - - - name: Build and push Docker image for App - uses: docker/build-push-action@v4 - with: - push: true - tags: | - "matterlabs/block-explorer-app:latest" - "matterlabs/block-explorer-app:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "matterlabs/block-explorer-app:${{ steps.setVersionForFlux.outputs.imageTag }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-app:latest" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-app:v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - "us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-app:${{ steps.setVersionForFlux.outputs.imageTag }}" - file: packages/app/Dockerfile - no-cache: true - - deployFrontendToStaging: - name: Deploy Block Explorer frontend to staging - runs-on: matterlabs-firebase-deployer - permissions: - contents: read - needs: createReleaseVersion - if: ${{ github.ref == 'refs/heads/main' && needs.createReleaseVersion.outputs.releaseVersion != '' }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 18 - - - name: Install Firebase CLI and auth - run: | - npm install -g firebase-tools - - - name: Download Dist package - uses: dsaltares/fetch-gh-release-asset@master - with: - version: "tags/v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - file: "dist.zip" - target: "dist.zip" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unzip Dist package - run: | - unzip dist.zip -d packages/app - - - name: Update config - run: | - echo "window[\"##runtimeConfig\"] = { appEnvironment: \"staging\", sentryDSN: \"${{ vars.SENTRY_DSN }}\" };" > packages/app/dist/config.js - - - name: Download Storybook package - uses: dsaltares/fetch-gh-release-asset@master - with: - version: "tags/v${{ needs.createReleaseVersion.outputs.releaseVersion }}" - file: "storybook-static.zip" - target: "storybook-static.zip" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unzip Storybook package - run: | - unzip storybook-static.zip -d packages/app - - - name: Deploy - working-directory: ./packages/app - run: | - firebase --project staging-scan-v2 deploy - diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index a837a4a49e..a74d218c61 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -39,24 +39,36 @@ jobs: uses: actions/setup-node@v3 with: node-version: '18' - cache: 'npm' + cache: 'yarn' - name: Install dependencies run: | - npm ci + yarn install - name: Lint run: | - npm run lint -- -- --no-fix --max-warnings 0 + yarn run lerna run lint -- -- --no-fix --max-warnings 0 - - name: App type check - working-directory: ./packages/app - run: | - npm run typecheck +# - name: App type check +# working-directory: ./packages/app +# run: | +# yarn run typecheck - name: Test + env: + VITE_API_URL: "http://api.example" + VITE_BASE_TOKEN_ADDRESS: "0x" + VITE_BRIDGE_URL: "http://bridge.example" + VITE_HOSTNAMES: "http://host.example" + VITE_ICON: "http://host.example/icon.svg" + VITE_L2_CHAIN_ID: "1111" + VITE_L2_NETWORK_NAME: "example" + VITE_MAINTENANCE: "true" + VITE_NAME: "test" + VITE_PUBLISHED: "true" + VITE_RPC_URL: "http://rpc.example" run: | - npm run test:ci + yarn run test:ci - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/composite@v2 @@ -72,5 +84,17 @@ jobs: check_name: Unit Test Results - name: Build + env: + VITE_API_URL: "http://api.example" + VITE_BASE_TOKEN_ADDRESS: "0x" + VITE_BRIDGE_URL: "http://bridge.example" + VITE_HOSTNAMES: "http://host.example" + VITE_ICON: "http://host.example/icon.svg" + VITE_L2_CHAIN_ID: "1111" + VITE_L2_NETWORK_NAME: "example" + VITE_MAINTENANCE: "true" + VITE_NAME: "test" + VITE_PUBLISHED: "true" + VITE_RPC_URL: "http://rpc.example" run: | - npm run build + yarn run build diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/package.json b/package.json index d23e40bd23..6f3fabab99 100644 --- a/package.json +++ b/package.json @@ -33,16 +33,19 @@ "@semantic-release/github": "^8.0.2", "@semantic-release/npm": "^9.0.0", "@semantic-release/release-notes-generator": "^10.0.3", + "@types/jest": "^29.4.0", "@types/node": "18.17.18", + "dotenv": "16.1.4", + "enquirer": "2.3.6", "eslint": "8.57.0", + "eslint-config-prettier": "8.10.0", + "eslint-plugin-prettier": "4.2.1", "husky": "8.0.1", "lerna": "^7.2.0", - "prettier": "3.3.3", + "pg-connection-string": "2.6.2", + "prettier": "2.8.8", "semantic-release": "^21.1.1", - "typescript": "5.1.3", - "enquirer": "2.3.6", - "dotenv": "16.1.4", - "pg-connection-string": "2.6.2" + "typescript": "5.1.3" }, "engines": { "yarn": ">=1.20.0", diff --git a/packages/api/package.json b/packages/api/package.json index 4884062662..c0a20052be 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -61,7 +61,6 @@ "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", "eslint-config-prettier": "^8.3.0", - "eslint-plugin-prettier": "^4.0.0", "jest": "29.2.1", "jest-junit": "^14.0.1", "lint-staged": "^13.0.3", diff --git a/packages/app/package.json b/packages/app/package.json index 73b7367a4d..ef14e49ae2 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -32,7 +32,7 @@ "sass-loader": "12.6.0", "siwe": "^2.3.2", "vue": "3.2.42", - "vue-i18n": "9.2.0-beta.35", + "vue-i18n": "11.1.0", "vue-prism-editor": "2.0.0-alpha.2", "vue-router": "4.0.14", "vue-tippy": "6.0.0", @@ -64,7 +64,7 @@ "@storybook/manager-webpack5": "6.4.19", "@storybook/vue3": "6.4.19", "@tailwindcss/forms": "0.5.0", - "@testing-library/user-event": "14.2.1", + "@testing-library/user-event": "^14.6.1", "@testing-library/vue": "6.6.0", "@types/jsdom": "16.2.14", "@types/node": "^16.11.25", @@ -73,7 +73,7 @@ "@vue/eslint-config-prettier": "^9.0.0", "@vue/eslint-config-typescript": "^10.0.0", "@vue/test-utils": "2.0.0-rc.18", - "@vue/tsconfig": "0.1.3", + "@vue/tsconfig": "0.7.0", "@vuelidate/core": "2.0.0-alpha.40", "@vuelidate/validators": "2.0.0-alpha.28", "allure-cucumberjs8": "^2.0.0-beta.15", @@ -81,23 +81,22 @@ "babel-loader": "8.2.3", "c8": "7.11.2", "eslint": "8.57.1", - "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-storybook": "^0.5.7", "eslint-plugin-vue": "^8.2.0", "ethers": "6.13.4", "jsdom": "19.0.0", "playwright": "1.27.0", "postcss": "^8.4.12", - "prettier": "2.3.1", + "prettier": "^3.4.2", "prettier-plugin-tailwindcss": "^0.6.8", "sass": "^1.49.9", "start-server-and-test": "^1.14.0", "storybook-vue3-router": "^2.2.1", "tailwindcss": "^3.0.23", - "typescript": "5.1.3", + "typescript": "^5.7.3", "vite": "2.9.18", "vitest": "^2.1.4", "vue-loader": "16.8.3", - "vue-tsc": "0.33.6" + "vue-tsc": "^2.2.0" } } diff --git a/packages/app/src/components/TokenIconLabel.vue b/packages/app/src/components/TokenIconLabel.vue index 7f5987ab95..88fc791cd3 100644 --- a/packages/app/src/components/TokenIconLabel.vue +++ b/packages/app/src/components/TokenIconLabel.vue @@ -36,6 +36,7 @@