Skip to content

Feat / Add Uniswap on chains BSC, Avalanche, and Celo #951

Feat / Add Uniswap on chains BSC, Avalanche, and Celo

Feat / Add Uniswap on chains BSC, Avalanche, and Celo #951

Workflow file for this run

# This is a basic workflow that is manually triggered
name: ci
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
push:
branches: [main, development, 'refactor/unit_tests**', 'epic/**']
pull_request:
branches: [main, development, 'refactor/unit_tests**', 'epic/**']
types: [ready_for_review, opened, synchronize, reopened]
jobs:
run_gateway:
name: Check if gateway files changed
outputs:
is_set: ${{ steps.check_files.outputs.is_set }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.+(ts|js|yml)
!Dockerfile
!*.sh
- name: Check if gateway files are modified
id: check_files
if: env.GIT_DIFF
run: |
echo ${{ env.GIT_DIFF }}
echo "::set-output name=is_set::true"
build_gateway:
name: Gateway build + unit tests
needs: run_gateway
if: github.event.pull_request.draft == false && needs.run_gateway.outputs.is_set == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install hardhat and start node.
run: |
mkdir hardhat && cd hardhat && npm init -y
touch hardhat.config.js
yarn add --dev hardhat
yarn hardhat node &
- name: Install Dependencies
run: yarn
- name: Build project
run: yarn build
- name: Replace testnet nodeURL and lists path
run: |
mkdir conf db
cp -rf src/templates/* conf
sed -i 's|/home/gateway/conf/lists/|conf/lists/|g' ./conf/*.yml
sed -i 's/https:\/\/rpc.ankr.com\/eth_goerli/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml
- name: Run unit test coverage
if: github.event_name == 'pull_request'
shell: bash
run: |
git fetch --all -q
git checkout -b $GITHUB_SHA
NODE_OPTIONS=--max-old-space-size=10240 node ./node_modules/.bin/jest --runInBand --coverage ./test/
# git diff origin/$GITHUB_BASE_REF | yarn diff-test-coverage -c ./coverage/lcov.info -t lcov -b 50 -l 60
docker_build_and_push:
runs-on: ubuntu-latest
needs: [build_gateway]
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: hummingbot/gateway:latest
platforms: linux/amd64,linux/arm64