feat / core changes for v2.4 release #1194
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install hardhat and start node | |
run: | | |
mkdir hardhat && cd hardhat && npm init -y | |
touch hardhat.config.js | |
pnpm add --save-dev hardhat | |
pnpm hardhat node & | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build project | |
run: pnpm 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_sepolia/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 | |
GATEWAY_TEST_MODE=dev ./node_modules/.bin/jest --runInBand --coverage ./test/ | |
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 | |