Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c5f148bb5 | ||
|
|
64d593c63f | ||
|
|
80990aac32 | ||
|
|
63f2e5b4fb | ||
|
|
96749a9af6 | ||
|
|
ddc8236c41 | ||
|
|
32adf99ee9 | ||
|
|
9fec3d837b | ||
|
|
4dade0ab53 | ||
|
|
4c1c1b3f51 | ||
|
|
415d520a7b | ||
|
|
ae75a85f67 | ||
|
|
4903bdbcd5 | ||
|
|
9d0daf9630 | ||
|
|
abef4785cf | ||
|
|
44c1881dae | ||
|
|
231ad4ff91 | ||
|
|
6654704c36 | ||
|
|
7054367ba0 | ||
|
|
2087aa7f41 | ||
|
|
a323dcee5a |
@@ -1,130 +0,0 @@
|
||||
name: Capsule tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
pr:
|
||||
name: Run capsule tests - PR
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
GOPROXY: ${{ secrets.GO_PROXY }}
|
||||
steps:
|
||||
#######
|
||||
## Setup langs
|
||||
#######
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
id: go
|
||||
with:
|
||||
go-version: 1.18
|
||||
- name: Set up Node 16
|
||||
uses: actions/setup-node@v2
|
||||
id: npm
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
#######
|
||||
## Checkout capsule
|
||||
#######
|
||||
|
||||
# Checkout capsule to build local network
|
||||
- name: Checkout capsule
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vegaprotocol/vegacapsule
|
||||
ref: main
|
||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
path: './capsule'
|
||||
|
||||
#######
|
||||
## Build binaries
|
||||
#######
|
||||
- name: Build capsule
|
||||
run: go install
|
||||
working-directory: capsule
|
||||
|
||||
- name: Set GOBIN
|
||||
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
|
||||
|
||||
- name: Install binaries
|
||||
run: vegacapsule install-bins
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||
GOBIN: ${{ env.GOBIN }}
|
||||
|
||||
######
|
||||
## Start capsule
|
||||
######
|
||||
- name: Login to docker
|
||||
run: echo -n ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} | docker login https://ghcr.io -u vega-ci-bot --password-stdin
|
||||
|
||||
- name: Start nomad
|
||||
run: vegacapsule nomad &
|
||||
|
||||
- name: Bootstrap network
|
||||
run: vegacapsule network bootstrap --config-path=./net_confs/config.hcl --force
|
||||
working-directory: capsule
|
||||
|
||||
######
|
||||
## Setup a Vega wallet for our user
|
||||
######
|
||||
- name: Create passphrase
|
||||
run: echo "${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}" > ./passphrase
|
||||
- name: Create recovery
|
||||
run: echo "${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}" > ./recovery
|
||||
|
||||
- name: Initialize wallet
|
||||
run: vegawallet init -f --home ~/.vegacapsule/testnet/wallet
|
||||
- name: Import wallet
|
||||
run: vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase --home ~/.vegacapsule/testnet/wallet
|
||||
- name: Create public key 2
|
||||
run: vegawallet key generate -w UI_Trading_Test -p ./passphrase --home ~/.vegacapsule/testnet/wallet
|
||||
- name: Start service
|
||||
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
||||
|
||||
######
|
||||
## Run some tests
|
||||
######
|
||||
|
||||
# Checkout front ends
|
||||
- name: Checkout frontend mono repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||
uses: nrwl/nx-set-shas@v2
|
||||
with:
|
||||
main-branch-name: master
|
||||
|
||||
- name: Install root dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: Run Cypress tests
|
||||
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
|
||||
env:
|
||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
|
||||
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
|
||||
|
||||
######
|
||||
## Upload logs
|
||||
######
|
||||
|
||||
- name: Logs
|
||||
if: ${{ always() }}
|
||||
run: vegacapsule network logs > vega-capsule-logs.txt
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: logs
|
||||
path: ./vega-capsule-logs.txt
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Publish NextJs containers
|
||||
|
||||
'on':
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+'
|
||||
|
||||
jobs:
|
||||
master:
|
||||
strategy:
|
||||
matrix:
|
||||
build-platform: ['linux/amd64']
|
||||
app: ['trading']
|
||||
name: Build the ${{ inputs.image_name }} image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set output
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||
- name: Check output
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
||||
run: |
|
||||
echo $RELEASE_VERSION
|
||||
echo ${{ steps.vars.outputs.tag }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
id: quemu
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Collect images data
|
||||
id: tags
|
||||
run: |
|
||||
echo '::set-output name=current::vegaprotocol/${{ matrix.app }}:v${{ steps.vars.outputs.tag }}'
|
||||
echo '::set-output name=latest::vegaprotocol/${{ matrix.app }}:latest'
|
||||
|
||||
- name: Echo tags
|
||||
run: |
|
||||
echo ${{ steps.tags.outputs.latest }}
|
||||
echo ${{ steps.tags.outputs.current }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Docker build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: '.'
|
||||
file: './Dockerfile.next'
|
||||
build-args: 'APP=${{ matrix.app }}'
|
||||
platforms: ${{ matrix.build-platform }}
|
||||
tags: ${{ steps.tags.outputs.latest }},${{ steps.tags.outputs.current }}
|
||||
push: true
|
||||
@@ -0,0 +1,61 @@
|
||||
name: Publish CRA containers
|
||||
|
||||
'on':
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+'
|
||||
|
||||
jobs:
|
||||
master:
|
||||
strategy:
|
||||
matrix:
|
||||
build-platform: ['linux/amd64']
|
||||
app: ['explorer', 'token']
|
||||
name: Build the ${{ inputs.image_name }} image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set output
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
|
||||
- name: Check output
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
|
||||
run: |
|
||||
echo $RELEASE_VERSION
|
||||
echo ${{ steps.vars.outputs.tag }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
id: quemu
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# TODO take version from tag
|
||||
- name: Collect images data
|
||||
id: tags
|
||||
run: |
|
||||
echo '::set-output name=current::vegaprotocol/${{ matrix.app }}:v${{ steps.vars.outputs.tag }}'
|
||||
echo '::set-output name=latest::vegaprotocol/${{ matrix.app }}:latest'
|
||||
|
||||
- name: Echo tags
|
||||
run: |
|
||||
echo ${{ steps.tags.outputs.latest }}
|
||||
echo ${{ steps.tags.outputs.current }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Docker build
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: '.'
|
||||
file: './Dockerfile.cra'
|
||||
build-args: 'APP=${{ matrix.app }}'
|
||||
platforms: ${{ matrix.build-platform }}
|
||||
tags: ${{ steps.tags.outputs.latest }},${{ steps.tags.outputs.current }}
|
||||
push: true
|
||||
@@ -1,67 +0,0 @@
|
||||
name: Unit tests & build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
master:
|
||||
name: Test and lint - main
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
fetch-depth: 0
|
||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||
uses: nrwl/nx-set-shas@v2
|
||||
with:
|
||||
main-branch-name: master
|
||||
- name: Use Node.js 16
|
||||
id: Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.14.0
|
||||
- name: Install root dependencies
|
||||
run: yarn install
|
||||
- name: Check formatting
|
||||
run: yarn nx format:check
|
||||
- name: Lint affected
|
||||
run: yarn nx affected:lint --max-warnings=0
|
||||
- name: Test affected
|
||||
run: yarn nx affected:test
|
||||
- name: Build affected
|
||||
run: yarn nx affected:build
|
||||
pr:
|
||||
name: Test and lint - PR
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||
uses: nrwl/nx-set-shas@v2
|
||||
with:
|
||||
main-branch-name: master
|
||||
- name: Use Node.js 16
|
||||
id: Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.14.0
|
||||
- name: Install root dependencies
|
||||
run: yarn install
|
||||
- name: Check formatting
|
||||
run: yarn nx format:check
|
||||
- name: Lint affected
|
||||
run: yarn nx affected:lint --max-warnings=0
|
||||
- name: Test affected
|
||||
run: yarn nx affected:test
|
||||
- name: Build affected
|
||||
run: yarn nx affected:build
|
||||
@@ -7,6 +7,7 @@ ENV PATH /app/node_modules/.bin:$PATH
|
||||
COPY package.json ./
|
||||
COPY yarn.lock ./
|
||||
COPY . ./
|
||||
RUN apk add python3 make gcc g++
|
||||
RUN yarn
|
||||
RUN yarn nx build $APP
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Build container
|
||||
FROM node:16.14.0-alpine as build
|
||||
WORKDIR /app
|
||||
# Argument to allow building of different apps
|
||||
ARG APP
|
||||
ENV PATH /app/node_modules/.bin:$PATH
|
||||
COPY package.json ./
|
||||
COPY yarn.lock ./
|
||||
COPY . ./
|
||||
RUN apk add python3 make gcc g++
|
||||
RUN yarn
|
||||
RUN yarn nx export $APP
|
||||
|
||||
# Production environment
|
||||
FROM nginx:stable-alpine
|
||||
ARG APP
|
||||
COPY --from=build /app/dist/apps/$APP/exported /usr/share/nginx/html
|
||||
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY ./env.sh .
|
||||
COPY ./apps/$APP/.env .env
|
||||
|
||||
# Add bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
RUN chmod +x ./env.sh
|
||||
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
|
||||
@@ -93,7 +93,7 @@ function VegaTradingApp(props: AppProps) {
|
||||
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
|
||||
{['1', 'true'].includes(process.env['NX_USE_ENV_OVERRIDES'] || '') ? (
|
||||
/* eslint-disable-next-line @next/next/no-sync-scripts */
|
||||
<script src="./env-config.js" type="text/javascript" />
|
||||
<script src="/assets/env-config.js" type="text/javascript" />
|
||||
) : null}
|
||||
</Head>
|
||||
<AppBody {...props} />
|
||||
|
||||
+1
-18
@@ -1,18 +1 @@
|
||||
window._env_ = {
|
||||
NX_CHAIN_EXPLORER_URL:
|
||||
'https://explorer.vega.trading/.netlify/functions/chain-explorer-api;',
|
||||
NX_TENDERMINT_URL: 'http://localhost:26617;',
|
||||
NX_TENDERMINT_WEBSOCKET_URL: 'wss://localhost:26617/websocket;',
|
||||
NX_VEGA_URL: 'http://localhost:3028/query;',
|
||||
NX_VEGA_ENV: 'LOCAL;',
|
||||
NX_VEGA_REST: 'http://localhost:3029;',
|
||||
NX_VEGA_REST: 'http://localhost:3029;',
|
||||
NX_VEGA_REST: 'http://localhost:3029;',
|
||||
NX_EXPLORER_ASSETS: '1;',
|
||||
NX_EXPLORER_GENESIS: '1;',
|
||||
NX_EXPLORER_GOVERNANCE: '1;',
|
||||
NX_EXPLORER_MARKETS: '1;',
|
||||
NX_EXPLORER_NETWORK_PARAMETERS: '1;',
|
||||
NX_EXPLORER_PARTIES: '1;',
|
||||
NX_EXPLORER_VALIDATORS: '1;',
|
||||
};
|
||||
window._env_ = {};
|
||||
|
||||
@@ -80,7 +80,9 @@ const getValue = (key: EnvKey, definitions: Partial<RawEnvironment> = {}) => {
|
||||
}
|
||||
return transformValue(
|
||||
key,
|
||||
definitions[key] ?? window._env_?.[key] ?? getBundledEnvironmentValue(key)
|
||||
definitions[key] ??
|
||||
window._env_?.[`NX_${key}`] ??
|
||||
getBundledEnvironmentValue(key)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user