Skip to content
Closed
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
33 changes: 33 additions & 0 deletions .github/workflows/release-pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release PR Validation

permissions:
contents: read

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

jobs:
validate-release:
# Only run on release PRs
if: contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install cargo-release
run: cargo install cargo-release

- name: Validate packages for publishing
run: ./scripts/validate-packages.sh
89 changes: 89 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Publish Release

on:
pull_request:
types: [closed]
branches:
- main

jobs:
publish-release:
# Only run on merged release PRs
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install cargo-release
run: cargo install cargo-release

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Validate packages before publishing
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo "========================================="
echo "Phase 1: Validation (dry-run)"
echo "========================================="
./scripts/validate-packages.sh "$BASE_SHA" "$HEAD_SHA"

- name: Publish packages to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo ""
echo "========================================="
echo "Phase 2: Publishing (atomic)"
echo "========================================="
./scripts/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA"

- name: Create GitHub releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo ""
echo "========================================="
echo "Phase 3: Creating GitHub releases"
echo "========================================="

# Detect packages that were published
PACKAGES_STRING=$(./scripts/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA")
read -ra PACKAGES <<< "$PACKAGES_STRING"

for pkg in "${PACKAGES[@]}"; do
echo "----------------------------------------"
# Get the version from Cargo.toml
VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"$pkg\") | .version")
TAG="${pkg}-v${VERSION}"

echo "Creating GitHub release for $TAG..."
if gh release create "$TAG" --generate-notes --title "$TAG"; then
echo "✓ Created release for $TAG"
else
echo "Warning: Failed to create release for $TAG"
fi
done

echo ""
echo "✓ GitHub releases created"
10 changes: 6 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ jobs:
test_cmd: |
cargo test -p light-concurrent-merkle-tree
- name: batched-merkle-tree-simulate
packages: light-batched-merkle-tree
packages: light-batched-merkle-tree batched-merkle-tree-tests
test_cmd: |
RUST_LOG=light_prover_client=debug cargo test -p light-batched-merkle-tree --features test-only -- --test test_simulate_transactions
cargo test -p light-batched-merkle-tree --features test-only
RUST_LOG=light_prover_client=debug cargo test -p batched-merkle-tree-tests -- --test test_simulate_transactions
- name: program-libs-fast
packages:
aligned-sized light-hasher light-compressed-account light-account-checks \
Expand All @@ -60,12 +61,13 @@ jobs:
cargo build -p light-zero-copy --no-default-features # Ensure no_std builds
cargo test -p light-zero-copy-derive --all-features
cargo test -p light-hash-set --all-features
cargo test -p batched-merkle-tree-tests -- --skip test_simulate_transactions --skip test_e2e
- name: program-libs-slow
packages: light-bloom-filter light-indexed-merkle-tree light-batched-merkle-tree
packages: light-bloom-filter light-indexed-merkle-tree batched-merkle-tree-tests
test_cmd: |
cargo test -p light-bloom-filter --all-features
cargo test -p light-indexed-merkle-tree --all-features
cargo test -p light-batched-merkle-tree --all-features -- --test test_e2e
cargo test -p batched-merkle-tree-tests -- --test test_e2e

name: Test ${{ matrix.group.name }}

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- program: sdk-anchor-test-program
sub-tests: '["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk-pinocchio-v1-test", "cargo-test-sbf -p sdk-pinocchio-v2-test"]'
- program: sdk-libs
packages: light-sdk-macros light-sdk light-program-test light-client light-batched-merkle-tree
packages: light-sdk-macros light-sdk light-program-test light-client batched-merkle-tree-tests
test_cmd: |
cargo test -p light-sdk-macros
cargo test -p light-sdk-macros --all-features
Expand All @@ -66,7 +66,6 @@ jobs:
cargo test -p light-client
cargo test -p client-test
cargo test -p light-sparse-merkle-tree
cargo test -p light-batched-merkle-tree --features test-only -- --skip test_simulate_transactions --skip test_e2e
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down
53 changes: 34 additions & 19 deletions Cargo.lock

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

Loading
Loading