diff --git a/.github/actions/setup-rust/action.yaml b/.github/actions/setup-rust/action.yaml index f82c8fb8..5f606684 100644 --- a/.github/actions/setup-rust/action.yaml +++ b/.github/actions/setup-rust/action.yaml @@ -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 - name: Install Protobuf run: | @@ -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; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1b02cbf..29fff893 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: jobs: build: - runs-on: ubuntu-22.04-16c-64g-public + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 @@ -13,34 +13,11 @@ jobs: 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 879bc8b6..90d70517 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,14 +2,12 @@ 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 @@ -17,43 +15,21 @@ jobs: 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7722365a..e43f82cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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