Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor ci, add wormhole connect build and portal bridge container #464

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
88 changes: 31 additions & 57 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,6 @@ on:
types: [opened, synchronize, reopened]

jobs:
# cctp:
# name: "Build USDC Bridge (CCTP)"
# runs-on: "ubuntu-latest"
# concurrency:
# group: ${{ github.ref }}-cctp-preview
# cancel-in-progress: true
# environment: Cloudflare-Preview
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# with:
# repository: xlabs/usdc-bridge
# ref: develop
# - name: Set up Node environment
# uses: actions/setup-node@v3
# with:
# node-version: v16.19.1
# - name: Install dependencies
# run: npm ci
# - name: Set Version
# run: |
# echo "_BRANCH_NAME_SHA=$(echo ${{ github.event.pull_request.head.ref }} | sha256sum | cut -c -10)" >> "${GITHUB_ENV}"
# - name: Build
# env:
# DEPLOY: "true"
# NEXT_PUBLIC_NETWORK: ${{ vars.REACT_APP_CLUSTER }}
# NEXT_PUBLIC_BASE_PATH: "/${{ env._BRANCH_NAME_SHA }}/usdc-bridge"
# run: npm run build
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# name: preview-stable-bridge-build
# path: out
docs:
name: "Build Portal Bridge Documentation"
runs-on: "ubuntu-latest"
Expand All @@ -49,7 +16,7 @@ jobs:
- name: Set up Node environment
uses: actions/setup-node@v3
with:
node-version: v18.17.1
node-version: v16.19.1
- name: Install dependencies
run: |
pushd docs
Expand All @@ -68,51 +35,64 @@ jobs:
with:
name: docs-preview-build
path: docs/build

portal:
name: "Build Portal Bridge"
runs-on: xlabs-large-runner
runs-on: "ubuntu-latest"
concurrency:
group: ${{ github.ref }}-portal-preview
cancel-in-progress: true
environment: Cloudflare-Preview
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node environment
uses: actions/setup-node@v3
with:
node-version: v18.17.1
- name: Checkout Wormhole Connect
uses: actions/checkout@v3
with:
repository: xlabs/wormhole-connect
ref: ${{github.event.pull_request.head.ref}}
path: wormhole-connect
- name: Checkout Portal Bridge
uses: actions/checkout@v3
with:
path: portal-bridge
- name: Setup Git
run: |
cd portal-bridge
git config user.name "xLabs CI"
git config user.email "[email protected]"
- name: Install dependencies
run: npm install
- name: Set Version
- name: Set Portal Bridge Version
run: |
cd portal-bridge
npm version $(node -p -e "require('./package.json').version")-P$(echo ${{ github.sha }} | cut -c -10)
echo "_PKG_VERSION=$(node -p -e "require('./package.json').version")" >> "${GITHUB_ENV}"
echo "_BRANCH_NAME_SHA=$(echo ${{ github.event.pull_request.head.ref }} | sha256sum | cut -c -10)" >> "${GITHUB_ENV}"
- name: Build
- name: Build Portal Bridge
env:
PUBLIC_URL: "/${{ env._BRANCH_NAME_SHA }}"
NODE_OPTIONS: "--max-old-space-size=10240"
REACT_APP_CLUSTER: ${{ vars.REACT_APP_CLUSTER }}
REACT_APP_SOLANA_API_URL: ${{ vars.REACT_APP_SOLANA_API_URL }}
REACT_APP_COVALENT_API_KEY: ${{ secrets.REACT_APP_COVALENT_API_KEY }}
REACT_APP_WALLET_CONNECT_PROJECT_ID: ${{ secrets.REACT_APP_WALLET_CONNECT_PROJECT_ID }}
VITE_APP_VERSION: ${{ github.event.pull_request.head.ref }}
VITE_APP_CLUSTER: "mainnet"
run: |
npm install -g husky
pushd wormhole-connect
npm ci --workspaces --if-present
npm run build
npm link --workspaces --if-present
popd
pushd portal-bridge
npm ci
npm link @wormhole-foundation/wormhole-connect
pushd public
npm run set-version
popd
echo 'REACT_APP_VERSION=$npm_package_version' > .env
echo 'VITE_APP_VERSION=$npm_package_version' > .env
npm run build
- name: Upload Artifact
- name: Upload Portal Bridge Artifact
uses: actions/upload-artifact@v3
with:
name: preview-build
path: build
path: portal-bridge/dist
- name: Deploy metadata
run: |
mkdir deploy-metadata
Expand All @@ -130,7 +110,6 @@ jobs:
needs:
- portal
- docs
# - cctp
runs-on: "ubuntu-latest"
concurrency:
group: ${{ github.ref }}-publish-preview
Expand All @@ -148,15 +127,10 @@ jobs:
with:
name: docs-preview-build
path: docs
# - name: Download Artifact
# uses: actions/download-artifact@v3
# with:
# name: preview-stable-bridge-build
# path: usdc-bridge
- name: Set up GitHub NPM registry
uses: actions/setup-node@v3
with:
node-version: v18.17.1
node-version: v16.19.1
registry-url: https://npm.pkg.github.com
- name: Publish
env:
Expand Down
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

59 changes: 18 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,27 @@
# Example Token Bridge UI
# React + TypeScript + Vite

## Prerequisites
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

- NodeJS v14+
- NPM v7.18+
Currently, two official plugins are available:

## Install
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

```bash
npm ci
```

## Develop

```bash
npm start
```
## Expanding the ESLint configuration

## Build for local tilt network
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

```bash
npm run build
```

## Build for testnet
- Configure the top-level `parserOptions` property like this:

```bash
REACT_APP_CLUSTER=testnet npm run build
```js
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
```

## Build for mainnet

```bash
REACT_APP_CLUSTER=mainnet REACT_APP_COVALENT_API_KEY=YOUR_API_KEY REACT_APP_SOLANA_API_URL=YOUR_CUSTOM_RPC npm run build
```

## Test Server

```bash
npx serve -s build
```

## Environment Variables (optional)

Create `.env` from the sample file, then add your Covalent API key:

```bash
cp .env.sample .env
```
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
105 changes: 0 additions & 105 deletions config-overrides.js

This file was deleted.

38 changes: 38 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Portal is a bridge that offers unlimited transfers across chains for tokens and NFTs wrapped by Wormhole."
/>
<meta property="og:title" content="Portal Token Bridge" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://portalbridge.com" />
<meta property="og:image" content="wormhole.png" />
<meta property="og:image:alt" content="Wormhole logo" />
<meta
property="og:description"
content="Portal is a bridge that offers unlimited transfers across chains for tokens and NFTs wrapped by Wormhole."
/>
<meta name="twitter:site" content="@portalbridge_" />
<meta name="twitter:creator" content="@portalbridge_" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="apple-touch-icon" href="logo192.png" />
<link rel="manifest" href="manifest.json" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<title>Portal Token Bridge</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading