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

Json rpc Proxy-server #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Setup Rust
description: Installs rust in a bare metal fashion
inputs:
caller-workflow-name:
description: 'Name of workflow used for creating a cache key in ASCII format.'
required: true
default: ''

runs:
using: composite
steps:
- name: Generate cache key
id: cache-key-generator
run: echo "cache-key=$(echo ${{inputs.caller-workflow-name}} | tr ' ' '_')" >> $GITHUB_OUTPUT
shell: bash

- name: Check cache key
run: "echo Cache key: ${{ steps.cache-key-generator.outputs.cache-key }}"
shell: bash

- name: cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo-${{ steps.cache-key-generator.outputs.cache-key }}-${{ hashFiles('**/Cargo.lock') }}

- name: cache rust files
uses: actions/cache@v3
with:
path: |
target/
key: ${{ runner.os }}-cargo-${{ steps.cache-key-generator.outputs.cache-key }}-${{ hashFiles('**/*.rs') }}

- name: Check rust version
run: |
rustc --version || true;
cargo --version || true;
cargo clippy --version || true;
cargo fmt --version || true;
shell: bash
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on:
pull_request:

jobs:
build_proxy_server:
runs-on: ubuntu-20.04-16c-64g
defaults:
run:
working-directory: ./proxy_server
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Sanity Check
run: |
cat /proc/cpuinfo

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
caller-workflow-name: test

- name: Run tests
run: |
./run_proxy_server.sh && ./stop_proxy_server.sh
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint

on:
pull_request:

jobs:
lint_proxy_server:
runs-on: ubuntu-20.04-16c-64g
defaults:
run:
working-directory: ./proxy_server
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Sanity Check
run: |
cat /proc/cpuinfo

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
caller-workflow-name: test

- name: Setup Rust tools
run: |
cargo install cargo-sort
shell: bash

- name: Workspace sort
run: cargo sort --workspace --check
shell: bash

- name: Fmt
run: cargo fmt --all --check
shell: bash

- name: Clippy check
run: cargo clippy --all-features --all-targets --tests -- -D warnings
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
release_proxy_server:
runs-on: ubuntu-20.04-16c-64g
defaults:
run:
working-directory: ./proxy_server
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Sanity Check
run: |
cat /proc/cpuinfo

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
caller-workflow-name: test

- name: Clippy check
run: cargo clippy --all-features --all-targets --tests -- -D warnings

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# see https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PWD }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./proxy_server
push: true
tags: jitolabs/block-engine-proxy-server:${{github.ref_name}}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/arm64,linux/x86_64

- name: Copy artifact from container
run: |
docker run --rm --platform linux/x86_64 --entrypoint cat jitolabs/block-engine-proxy-server:${{github.ref_name}} /app/jito-block-engine-proxy-server > ./block-engine-proxy-server-x86_64-unknown-linux-gnu
ls -lh .
file ./block-engine-proxy-server-x86_64-unknown-linux-gnu

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./block-engine-proxy-server-x86_64-unknown-linux-gnu
50 changes: 50 additions & 0 deletions .github/workflows/release_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release

on:
push:
branches:
- master

jobs:
release_proxy_server:
runs-on: ubuntu-20.04-16c-64g
defaults:
run:
working-directory: ./proxy_server
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Sanity Check
run: |
cat /proc/cpuinfo

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
caller-workflow-name: test

- name: Clippy check
run: cargo clippy --all-features --all-targets --tests -- -D warnings

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# see https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PWD }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./proxy_server
push: true
tags: jitolabs/block-engine-proxy-server:${{ github.sha }}, jitolabs/block-engine-proxy-server:latest
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/arm64,linux/x86_64
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.idea
/target
.idea/
target/
Loading