Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:safe-global/safe-wallet-web into rm-…
Browse files Browse the repository at this point in the history
…pairing
  • Loading branch information
katspaugh committed Nov 20, 2023
2 parents d23eb33 + 4a78e00 commit a7b5102
Show file tree
Hide file tree
Showing 99 changed files with 1,676 additions and 1,561 deletions.
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
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
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
65 changes: 65 additions & 0 deletions .github/workflows/nextjs_bundle_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

name: 'Next.js Bundle Analysis'

on:
pull_request:
push:
branches:
- dev

permissions:
contents: read # for checkout repository
actions: read # for fetching base branch bundle stats
pull-requests: write # for comments

jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/workflows/yarn

- name: Build next.js app
uses: ./.github/workflows/build
with:
secrets: ${{ toJSON(secrets) }}

- name: Analyze bundle
run: npx -p nextjs-bundle-analysis report

- name: Upload bundle
uses: actions/upload-artifact@v3
with:
name: bundle
path: .next/analyze/__bundle_analysis.json

- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2
if: success() && github.event.number
with:
workflow: nextjs_bundle_analysis.yml
branch: ${{ github.event.pull_request.base.ref }}
path: .next/analyze/base

- name: Compare with base branch bundle
if: success() && github.event.number
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare

- name: Get Comment Body
id: get-comment-body
if: success() && github.event.number
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
run: |
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$(cat .next/analyze/__bundle_analysis_comment.txt)" >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT
- name: Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: next-bundle-analysis
message: ${{ steps.get-comment-body.outputs.body }}
45 changes: 45 additions & 0 deletions .github/workflows/ondemand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Regression on demand tests

on:
workflow_dispatch:

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/yarn

- name: Install Cypress
run: |
./node_modules/.bin/cypress install
- uses: ./.github/workflows/build
with:
secrets: ${{ toJSON(secrets) }}
e2e_mnemonic: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }}

- name: Serve
run: yarn serve &

- uses: cypress-io/github-action@v4
with:
parallel: true
spec: cypress/e2e/**/*.cy.js
browser: chrome
record: true
config: baseUrl=http://localhost:8080
group: 'Regression on demand tests'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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/yarn

- name: Install Cypress
run: |
./node_modules/.bin/cypress install
- uses: ./.github/workflows/build
with:
secrets: ${{ toJSON(secrets) }}
e2e_mnemonic: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }}

- name: Serve
run: yarn serve &

- uses: cypress-io/github-action@v4
with:
parallel: true
spec: cypress/e2e/**/*.cy.js
browser: chrome
record: true
config: baseUrl=http://localhost:8080
group: 'Regression tests'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/safe-apps-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3]
containers: [1, 2]
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml → .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: e2e
name: Smoke tests

on:
pull_request:
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3]
containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v3

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ yalc.lock
/public/worker-*.js
/public/workbox-*.js
/public/workbox-*.js.map
/public/fallback*
/public/fallback*
/public/*.js.LICENSE.txt
35 changes: 11 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
FROM node:18-alpine AS base
ENV NEXT_TELEMETRY_DISABLED 1

FROM base AS builder

FROM node:18-alpine
RUN apk add --no-cache libc6-compat git python3 py3-pip make g++ libusb-dev eudev-dev linux-headers
WORKDIR /app

# Install dependencies
COPY package.json yarn.lock* ./
RUN yarn --frozen-lockfile
COPY . .
RUN yarn run after-install

RUN yarn build

# Production image
FROM base AS runner
WORKDIR /app
# install deps
RUN yarn install --frozen-lockfile
RUN yarn after-install

ENV NODE_ENV production
ENV REVERSE_PROXY_UI_PORT 8080

RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
COPY --from=builder /app/out ./out

# Set the correct permission for prerender cache
RUN mkdir .next && chown nextjs:nodejs .next
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

USER nextjs
EXPOSE 3000

EXPOSE ${REVERSE_PROXY_UI_PORT}
ENV PORT 3000

CMD npx -y serve out -p ${REVERSE_PROXY_UI_PORT}
CMD ["yarn", "static-serve"]
12 changes: 11 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'cypress'
import * as fs from 'fs'

export default defineConfig({
projectId: 'exhdra',
Expand All @@ -8,8 +9,17 @@ export default defineConfig({
runMode: 1,
openMode: 0,
},

e2e: {
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
if (results && results.video) {
const failures = results.tests.some((test) => test.attempts.some((attempt) => attempt.state === 'failed'))
if (!failures) {
fs.unlinkSync(results.video)
}
}
})
},
baseUrl: 'http://localhost:3000',
testIsolation: false,
hideXHR: true,
Expand Down
21 changes: 0 additions & 21 deletions cypress/e2e/create_safe.cy.js

This file was deleted.

29 changes: 0 additions & 29 deletions cypress/e2e/custom_apps.cy.js

This file was deleted.

Loading

0 comments on commit a7b5102

Please sign in to comment.