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
27 changes: 16 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: ci

on:
push:
branches: [ master ]
branches: [master]
tags:
- 'v*'
- "v*"
pull_request:
branches: [ master ]
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -20,18 +20,23 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.85.0
- name: Install cargo-audit from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-audit
version: "0.21.1"
version: "0.22.1"
- run: |
cargo audit \
--ignore RUSTSEC-2022-0093 \
--ignore RUSTSEC-2024-0344 \
--ignore RUSTSEC-2024-0421 \
--ignore RUSTSEC-2025-0022 \
--ignore RUSTSEC-2025-0055 # waiting for solana upgrade
--ignore RUSTSEC-2025-0055 \
--ignore RUSTSEC-2026-0007 \
--ignore RUSTSEC-2026-0009

code_gen:
# cargo b && ./target/debug/jito-shank-cli && yarn generate-clients && cargo b
Expand All @@ -41,27 +46,27 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: 1.84.1
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libudev-dev

- name: Set Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: '22.x'
node-version: "22.x"

- name: Generate all code
run: make generate-code

- name: Verify no file changes
uses: tj-actions/verify-changed-files@v20
with:
fail-if-changed: true
fail-message: 'Unexpected changes in generated files. Please run `make generate-code` locally to regenerate the files.'
fail-message: "Unexpected changes in generated files. Please run `make generate-code` locally to regenerate the files."

lint:
name: lint
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/publish-crate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ on:
package_path:
description: Which crate to publish
required: true
default: 'account_traits_derive'
default: "clients/rust/common"
type: choice
options:
- account_traits_derive
- bytemuck
- clients/rust/common
- clients/rust/restaking_client
- clients/rust/vault_client
Expand Down Expand Up @@ -151,18 +149,18 @@ jobs:
run: |
# Get current version before update
OLD_VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)

if [ "${{ inputs.dry_run }}" == "true" ]; then
# For dry-run mode, don't use the -x flag (dry-run is default)
cargo release ${{ inputs.level }} --no-confirm --no-push
else
# For actual execution, use the -x flag
cargo release ${{ inputs.level }} --no-confirm -x
fi

# Get new version after update
NEW_VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)

# Set outputs for the release step
echo "old_version=${OLD_VERSION}" >> $GITHUB_OUTPUT
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
Expand All @@ -182,4 +180,4 @@ jobs:
with:
tag: ${{ steps.publish.outputs.new_git_tag }}
name: "${{ steps.extract_name.outputs.crate_name }} v${{ steps.publish.outputs.new_version }}"
body: ${{ steps.changelog.outputs.changelog }}
body: ${{ steps.changelog.outputs.changelog }}
74 changes: 36 additions & 38 deletions .github/workflows/publish-crates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
package_path:
description: 'Comma-separated list of crates to publish. Example: core,restaking_core,cli'
description: "Comma-separated list of crates to publish. Example: core,restaking_core,cli"
required: true
default: 'account_traits_derive,bytemuck,clients/rust/common,clients/rust/restaking_client,clients/rust/vault_client,core,restaking_sdk,restaking_core,restaking_program,vault_sdk,vault_core,vault_program'
default: "clients/rust/common,clients/rust/restaking_client,clients/rust/vault_client,core,restaking_sdk,restaking_core,restaking_program,vault_sdk,vault_core,vault_program"
type: string
level:
description: Version increment level for selected crates
Expand All @@ -18,7 +18,7 @@ on:
- minor
- major
tag_name:
description: 'Custom tag name for release. Example: v1.2.3 or release-2024-01'
description: "Custom tag name for release. Example: v1.2.3 or release-2024-01"
required: true
type: string
dry_run:
Expand Down Expand Up @@ -46,8 +46,6 @@ jobs:
run: |
# All available crates in dependency order
ALL_CRATES=(
"account_traits_derive"
"bytemuck"
"clients/rust/common"
"clients/rust/restaking_client"
"clients/rust/vault_client"
Expand All @@ -59,7 +57,7 @@ jobs:
"vault_core"
"vault_program"
)

# Check if input contains commas (multiple crates) or is "all"
if [[ "${{ inputs.package_path }}" == "all" ]]; then
# Publish all crates
Expand All @@ -70,7 +68,7 @@ jobs:
# Multiple crates - parse comma-separated list
IFS=',' read -ra SELECTED_ARRAY <<< "${{ inputs.package_path }}"
CRATES_TO_PUBLISH=()

# Validate and order selected crates according to dependency order
for crate in "${ALL_CRATES[@]}"; do
for selected in "${SELECTED_ARRAY[@]}"; do
Expand All @@ -82,7 +80,7 @@ jobs:
fi
done
done

echo "📦 Publishing MULTIPLE crates: ${{ inputs.package_path }}"
IS_SINGLE="false"
else
Expand All @@ -91,15 +89,15 @@ jobs:
echo "📦 Publishing SINGLE crate: ${{ inputs.package_path }}"
IS_SINGLE="true"
fi

# Convert to space-separated string for output
CRATES_STRING=$(IFS=' '; echo "${CRATES_TO_PUBLISH[*]}")
COUNT=${#CRATES_TO_PUBLISH[@]}

echo "crates_to_publish=$CRATES_STRING" >> $GITHUB_OUTPUT
echo "crate_count=$COUNT" >> $GITHUB_OUTPUT
echo "is_single_crate=$IS_SINGLE" >> $GITHUB_OUTPUT

echo "Will publish $COUNT crates: $CRATES_STRING"
echo "Is single crate: $IS_SINGLE"

Expand Down Expand Up @@ -208,52 +206,52 @@ jobs:
run: |
# Convert space-separated string back to array
read -ra CRATES_TO_PUBLISH <<< "${{ needs.determine_crates.outputs.crates_to_publish }}"

PUBLISHED_CRATES=""

# Determine the version level to use
LEVEL="${{ inputs.level }}"

for crate_path in "${CRATES_TO_PUBLISH[@]}"; do
echo "========================================="
echo "Publishing $crate_path..."
echo "========================================="
cd "$GITHUB_WORKSPACE/$crate_path"

# Get versions
OLD_VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)
CRATE_NAME=$(basename "$crate_path")

echo "Current version: $OLD_VERSION"

if [ "${{ inputs.dry_run }}" == "true" ]; then
echo "🧪 DRY RUN: Would publish $CRATE_NAME $LEVEL"
cargo release $LEVEL --no-confirm --no-push
else
echo "🚀 Publishing $CRATE_NAME $LEVEL"
cargo release $LEVEL --no-confirm -x

# Wait a bit between publishes to avoid rate limits (only for multiple crates)
if [ "${{ needs.determine_crates.outputs.is_single_crate }}" == "false" ]; then
echo "⏳ Waiting 10 seconds before next publish..."
sleep 10
fi
fi

NEW_VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)
echo "New version: $NEW_VERSION"

# Track published crates for summary
PUBLISHED_CRATES="${PUBLISHED_CRATES}- **${CRATE_NAME}**: ${OLD_VERSION} → ${NEW_VERSION}\n"

echo "✅ Completed $CRATE_NAME"
cd "$GITHUB_WORKSPACE"
done

echo "published_crates<<EOF" >> $GITHUB_OUTPUT
echo -e "$PUBLISHED_CRATES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "========================================="
echo "🎉 Publishing completed!"
echo "========================================="
Expand All @@ -276,12 +274,12 @@ jobs:
run: |
# Convert space-separated string back to array
read -ra CRATES_TO_PUBLISH <<< "${{ needs.determine_crates.outputs.crates_to_publish }}"

# Determine release info based on what was published
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
CRATE_COUNT=${{ needs.determine_crates.outputs.crate_count }}
TAG_NAME=${{ github.event.inputs.tag_name }}

if [ "${{ needs.determine_crates.outputs.is_single_crate }}" == "true" ]; then
# Single crate release
CRATE_PATH="${CRATES_TO_PUBLISH[0]}"
Expand All @@ -294,9 +292,9 @@ jobs:
# Multiple crates release
RELEASE_TITLE="Jito Restaking Release - $(date +%Y-%m-%d)"
fi

echo "Creating combined release: $RELEASE_TITLE"

# Build release notes
RELEASE_NOTES="## $RELEASE_TITLE

Expand All @@ -307,39 +305,39 @@ jobs:
### 📝 What's Changed

Recent changes across all published crates:"

# Generate combined changelog
COMBINED_CHANGELOG=""
for crate_path in "${CRATES_TO_PUBLISH[@]}"; do
CRATE_NAME=$(basename "$crate_path")
echo "Generating changelog for $CRATE_NAME..."

# Get recent commits for this crate
CRATE_CHANGELOG=$(git log --pretty=format:'- %s' --no-merges $(git describe --tags --abbrev=0 2>/dev/null || echo "")..HEAD -- "$crate_path" | head -5)

if [ -n "$CRATE_CHANGELOG" ]; then
COMBINED_CHANGELOG="$COMBINED_CHANGELOG

#### $CRATE_NAME
$CRATE_CHANGELOG"
fi
done

if [ -z "$COMBINED_CHANGELOG" ]; then
COMBINED_CHANGELOG="
- Published new versions of selected crates"
fi

RELEASE_NOTES="$RELEASE_NOTES$COMBINED_CHANGELOG

**Full Changelog**: https://github.com/${{ github.repository }}/commits/$TAG_NAME"

# Create the combined GitHub release
gh release create "$TAG_NAME" \
--title "$RELEASE_TITLE" \
--notes "$RELEASE_NOTES" \
--latest=true

echo "✅ Created combined release: $TAG_NAME"
env:
GH_TOKEN: ${{ secrets.JITO_TEAM_PAT }}
Expand All @@ -360,18 +358,18 @@ jobs:
echo "- **Dry run**: ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
echo "- **Version level**: ${{ inputs.level }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "${{ inputs.dry_run }}" == "true" ]; then
echo "⚠️ **This was a dry run - no actual publishing occurred**" >> $GITHUB_STEP_SUMMARY
else
echo "✅ **Publishing completed successfully!**" >> $GITHUB_STEP_SUMMARY

if [ "${{ inputs.create_release }}" == "true" ]; then
echo "🏷️ **Combined GitHub release created**" >> $GITHUB_STEP_SUMMARY
fi
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📋 Published Crates" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "${{ needs.publish.outputs.published_crates }}" >> $GITHUB_STEP_SUMMARY
echo "${{ needs.publish.outputs.published_crates }}" >> $GITHUB_STEP_SUMMARY
16 changes: 14 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading