Skip to content
Merged
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
42 changes: 14 additions & 28 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
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: ''
description: Install Rust toolchain (from rust-toolchain.toml) and protoc. Caching of ~/.cargo and target/ is handled internally by actions-rust-lang/setup-rust-toolchain via Swatinem/rust-cache — don't add separate actions/cache steps.

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
# Install the Rust toolchain pinned in rust-toolchain.toml.
# actions-rust-lang/setup-rust-toolchain reads rust-toolchain.toml when no
# explicit `toolchain:` input is given, picking up both the `channel` and
# the full `components` list — single source of truth. Bumping
# rust-toolchain.toml is enough to bump CI; no second place to edit.
#
# Caching is handled internally by this action via Swatinem/rust-cache,
# which is Rust-aware: workspace member detection, smart target/ cache
# invalidation on dependency changes, garbage collection. Don't layer
# additional actions/cache steps on top of it — the systems will fight
# over the same paths and produce stale restores.
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
Comment thread
McSim85 marked this conversation as resolved.

- name: Install Protobuf
run: |
Expand All @@ -28,20 +28,6 @@ runs:
&& rm -f $PROTOC_ZIP
shell: bash

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

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

- name: Check rust version
run: |
rustc --version || true;
Expand Down
29 changes: 3 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,19 @@ on:

jobs:
build:
runs-on: ubuntu-22.04-16c-64g-public
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true

- 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@v3

# 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@v5
with:
context: .
push: true
tags: jitolabs/jito-shredstream-proxy:${{github.sha}}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/arm64,linux/x86_64
- name: Release build
run: cargo build --release --locked --bin jito-shredstream-proxy
38 changes: 7 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,34 @@ name: release

on:
push:
# branches:
# - master
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-22.04-16c-64g-public
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true

- 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@v3

# 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
tags: jitolabs/jito-shredstream-proxy:${{github.ref_name}}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/arm64,linux/x86_64
- name: Release build
run: cargo build --release --locked --bin jito-shredstream-proxy

- name: Copy artifact from container
- name: Stage artifact
run: |
docker run --rm --platform linux/x86_64 --entrypoint cat jitolabs/jito-shredstream-proxy:${{github.ref_name}} /app/jito-shredstream-proxy > ./jito-shredstream-proxy-x86_64-unknown-linux-gnu
ls -lh .
cp target/release/jito-shredstream-proxy \
./jito-shredstream-proxy-x86_64-unknown-linux-gnu
file ./jito-shredstream-proxy-x86_64-unknown-linux-gnu
ls -lh ./jito-shredstream-proxy-x86_64-unknown-linux-gnu

- name: Release
uses: softprops/action-gh-release@v2
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
test:
runs-on: ubuntu-22.04-16c-64g-public
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -15,8 +15,6 @@ jobs:

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

- name: Run tests
run: cargo test --all-features --locked
Loading