-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae88e1d
commit 1ff810f
Showing
4 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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 | ||
working-directory: ./proxy_server | ||
id: cache-key-generator | ||
run: echo "cache-key=$(echo ${{inputs.caller-workflow-name}} | tr ' ' '_')" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: Check cache key | ||
working-directory: ./proxy_server | ||
run: "echo Cache key: ${{ steps.cache-key-generator.outputs.cache-key }}" | ||
shell: bash | ||
|
||
- name: cache dependencies | ||
working-directory: ./proxy_server | ||
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 | ||
working-directory: ./proxy_server | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ steps.cache-key-generator.outputs.cache-key }}-${{ hashFiles('**/*.rs') }} | ||
|
||
- name: Check rust version | ||
working-directory: ./proxy_server | ||
run: | | ||
rustc --version || true; | ||
cargo --version || true; | ||
cargo clippy --version || true; | ||
cargo fmt --version || true; | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: build | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04-16c-64g | ||
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 | ||
working-directory: ./proxy_server | ||
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: . | ||
file: ./proxy_server/Dockerfile | ||
push: true | ||
tags: jitolabs/block-engine-proxy-server:${{github.sha}} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
platforms: linux/arm64,linux/x86_64 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
# branches: | ||
# - master | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-20.04-16c-64g | ||
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 | ||
working-directory: ./proxy_server | ||
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: . | ||
push: true | ||
file: ./proxy_server/Dockerfile | ||
tags: jitolabs/block-engine-proxy-server:${{github.ref_name}}, jitolabs/block-engine-proxy-server:latest | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: test | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04-16c-64g | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Rust | ||
uses: ./.github/actions/setup-rust | ||
with: | ||
caller-workflow-name: test | ||
|
||
- name: Run tests | ||
run: | | ||
pushd proxy_server && ./run_proxy_server.sh && ./stop_proxy_server.sh && popd |