Skip to content

Commit

Permalink
Merge branch 'release/v0.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Luphia1984 committed Mar 8, 2024
2 parents 72aab2f + d925063 commit 452d7f6
Show file tree
Hide file tree
Showing 362 changed files with 19,296 additions and 13,424 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PUSHER_APP_KEY=
PUSHER_HOST=
PUSHER_PORT=

API_URL=
# API_URL=
API_VERSION=

BAIFA_ID=
BAIFA_SECRET_KEY=
BAIFA_PROJECT_ID=
3 changes: 0 additions & 3 deletions .env.template

This file was deleted.

11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ module.exports = {
plugins: ['@typescript-eslint'],
},
],
extends: ['plugin:import/typescript', 'plugin:tailwindcss/recommended'],
extends: [
'plugin:import/typescript',
'plugin:tailwindcss/recommended',
'plugin:@next/next/recommended',
'plugin:react/recommended',
],
// 加上 no console log 規則
rules: {
'no-console': 'error',
Expand All @@ -47,5 +52,9 @@ module.exports = {
removeDuplicates: true,
whitelist: [],
},
react: {
version: 'detect',
},
},
env: {browser: true, node: true, es6: true},
};
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

72 changes: 72 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Playwright Tests
on:
deployment_status:
jobs:
playwright-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tests-name: [TBDTC000001, TBDTC000003, TBDTC000005, TBDTC000008, TBDTC000010, TradeExample]
defaults:
run:
working-directory: ./integration-test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Metamask 11.0.0
run: wget https://github.com/MetaMask/metamask-extension/releases/download/v11.0.0/metamask-chrome-11.0.0.zip && unzip metamask-chrome-11.0.0.zip -d metamask-chrome-11.0.0
- name: Install dependencies
run: npm i
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: npx playwright test tests/${{ matrix.tests-name}}.spec.ts
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}
TEST_NAME: ${{ matrix.tests-name}}
- name: Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.tests-name}}
path: ./blob-report
retention-days: 1

merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: always()
needs: [playwright-tests]

runs-on: ubuntu-latest
defaults:
run:
working-directory: ./integration-test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm i

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: ./integration-test/all-blob-reports
pattern: blob-report-*
merge-multiple: true

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{github.run_id}}
path: ./playwright-report
retention-days: 14

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ typings/
# dotenv environment variables file
.env
.env.test
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand All @@ -95,6 +96,12 @@ package-lock.json
# vuepress build output
.vuepress/dist

# Playwright output
/test-results/
/playwright-report*
/playwright/.cache/
metamask-chrome-11.0.0

# Serverless directories
.serverless/

Expand Down
1 change: 1 addition & 0 deletions .vercelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
integration-test
73 changes: 73 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FROM node:18-alpine AS base

# 定義一個建構階段的參數 API_URL
ARG API_URL

# 將建構階段的參數設置為環境變數,以便在應用運行時使用
ENV API_URL=${API_URL}

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi


# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# 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

RUN npm run build

# If using npm comment out above and use below instead
# RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD ["node", "server.js"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

TideBit Decentralize Finance Version

## Docker
1. 請務必先下載 [tbd-backend develop branch](https://github.com/CAFECA-IO/tbd-backend/tree/develop)
2. 先在`tbd-backend`執行, 等待以下指令完成,建立起nest 與 mongoDB兩個container
```
docker compose up -d
```
3. 再回到這個專案底下,使用以下指令啟動tideBit-Defi 指令
```
docker compose up -d
```
## Mockup
- [Mobile](https://xd.adobe.com/view/b4bc1f81-78f4-4de9-979f-20cb0d457d70-e1ef/)
- [Desktop](https://xd.adobe.com/view/920d36bd-2d1a-4edd-8a2a-824445f1d3b0-c75e/?fullscreen&hints=off)

24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'
services:
nextjs-app:
build:
context: ./
dockerfile: Dockerfile
# 確保在build階段也可以有
args:
- API_URL=http://localhost:3001
ports:
- '3000:3000'
environment:
- API_URL=http://localhost:3001
# depends_on:
# - nestjs-app
networks:
- mongodb-net

networks:
mongodb-net:
external: true

volumes:
mongodb-data:
17 changes: 17 additions & 0 deletions integration-test/.auth/metamask.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"srp-word": [
"nerve",
"helmet",
"conduct",
"pyramid",
"clarify",
"mirror",
"dismiss",
"melt",
"wool",
"common",
"leisure",
"flat"
],
"new-password": "12345678"
}
Loading

0 comments on commit 452d7f6

Please sign in to comment.