From ed37ded2f319faebf482152682471fa626a8b038 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 6 Oct 2025 15:14:15 +0100 Subject: [PATCH 1/6] chore: add new rust release flow fix ci --- .github/workflows/release-pr-validation.yml | 86 ++++++++++++ .github/workflows/release-publish.yml | 148 ++++++++++++++++++++ Cargo.toml | 17 +++ scripts/release-program-libs.sh | 104 ++++++++++++++ scripts/release-sdk-libs.sh | 95 +++++++++++++ 5 files changed, 450 insertions(+) create mode 100644 .github/workflows/release-pr-validation.yml create mode 100644 .github/workflows/release-publish.yml create mode 100755 scripts/release-program-libs.sh create mode 100755 scripts/release-sdk-libs.sh diff --git a/.github/workflows/release-pr-validation.yml b/.github/workflows/release-pr-validation.yml new file mode 100644 index 0000000000..d5fc78990d --- /dev/null +++ b/.github/workflows/release-pr-validation.yml @@ -0,0 +1,86 @@ +name: Release PR Validation + +permissions: + contents: read + issues: write + +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 + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Detect release type + id: detect_type + env: + BRANCH_NAME: ${{ github.head_ref }} + run: | + if [[ "$BRANCH_NAME" == release/program-libs-* ]]; then + echo "type=program-libs" >> "$GITHUB_OUTPUT" + elif [[ "$BRANCH_NAME" == release/sdk-libs-* ]]; then + echo "type=sdk-libs" >> "$GITHUB_OUTPUT" + else + echo "type=unknown" >> "$GITHUB_OUTPUT" + fi + + - name: Dry-run publish (program-libs) + if: steps.detect_type.outputs.type == 'program-libs' + run: | + PROGRAM_LIBS=( + "light-account-checks" "aligned-sized" "light-batched-merkle-tree" + "light-bloom-filter" "light-compressed-account" "light-concurrent-merkle-tree" + "light-hash-set" "light-hasher" "light-heap" "light-indexed-array" + "light-indexed-merkle-tree" "light-macros" "light-merkle-tree-metadata" + "light-verifier" "light-zero-copy-derive" "light-zero-copy" + ) + + PACKAGE_ARGS=() + for pkg in "${PROGRAM_LIBS[@]}"; do + PACKAGE_ARGS+=("-p" "$pkg") + done + + echo "Running dry-run publish for program-libs..." + cargo publish --dry-run "${PACKAGE_ARGS[@]}" + + - name: Dry-run publish (sdk-libs) + if: steps.detect_type.outputs.type == 'sdk-libs' + run: | + SDK_LIBS=( + "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" + "light-sdk" "light-client" "photon-api" "light-program-test" + ) + + PACKAGE_ARGS=() + for pkg in "${SDK_LIBS[@]}"; do + PACKAGE_ARGS+=("-p" "$pkg") + done + + echo "Running dry-run publish for sdk-libs..." + cargo publish --dry-run "${PACKAGE_ARGS[@]}" + + - name: Comment PR with validation result + if: success() + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: 'āœ… **Release validation passed!**\n\nDry-run publish completed successfully. This PR is ready to merge.' + }); diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml new file mode 100644 index 0000000000..aa7bef05d4 --- /dev/null +++ b/.github/workflows/release-publish.yml @@ -0,0 +1,148 @@ +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: Detect release type from PR + id: detect_type + env: + PR_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + if [[ "$PR_BRANCH" == release/program-libs-* ]]; then + echo "type=program-libs" >> "$GITHUB_OUTPUT" + elif [[ "$PR_BRANCH" == release/sdk-libs-* ]]; then + echo "type=sdk-libs" >> "$GITHUB_OUTPUT" + else + echo "type=unknown" >> "$GITHUB_OUTPUT" + echo "Error: Could not detect release type from branch: $PR_BRANCH" + exit 1 + fi + + - name: Get tags before publish + id: tags_before + run: | + git fetch --tags + git tag | sort > /tmp/tags_before.txt + cat /tmp/tags_before.txt + + - name: Publish to crates.io (program-libs) + if: steps.detect_type.outputs.type == 'program-libs' + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: | + PROGRAM_LIBS=( + "light-account-checks" "aligned-sized" "light-batched-merkle-tree" + "light-bloom-filter" "light-compressed-account" "light-concurrent-merkle-tree" + "light-hash-set" "light-hasher" "light-heap" "light-indexed-array" + "light-indexed-merkle-tree" "light-macros" "light-merkle-tree-metadata" + "light-verifier" "light-zero-copy-derive" "light-zero-copy" + ) + + PACKAGE_ARGS=() + for pkg in "${PROGRAM_LIBS[@]}"; do + PACKAGE_ARGS+=("-p" "$pkg") + done + + echo "Publishing program-libs to crates.io and creating tags..." + cargo release publish "${PACKAGE_ARGS[@]}" --execute --no-confirm + + - name: Publish to crates.io (sdk-libs) + if: steps.detect_type.outputs.type == 'sdk-libs' + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: | + SDK_LIBS=( + "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" + "light-sdk" "light-client" "photon-api" "light-program-test" + ) + + PACKAGE_ARGS=() + for pkg in "${SDK_LIBS[@]}"; do + PACKAGE_ARGS+=("-p" "$pkg") + done + + echo "Publishing sdk-libs to crates.io and creating tags..." + cargo release publish "${PACKAGE_ARGS[@]}" --execute --no-confirm + + - name: Get new tags + id: new_tags + run: | + git fetch --tags + git tag | sort > /tmp/tags_after.txt + comm -13 /tmp/tags_before.txt /tmp/tags_after.txt > /tmp/new_tags.txt + cat /tmp/new_tags.txt + + - name: Create GitHub releases + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -s /tmp/new_tags.txt ]; then + echo "Creating GitHub releases for new tags..." + while IFS= read -r tag; do + if [[ -n "$tag" ]]; then + echo "Creating release for $tag..." + gh release create "$tag" --generate-notes --title "$tag" || echo "Warning: Failed to create release for $tag" + fi + done < /tmp/new_tags.txt + echo "āœ“ GitHub releases created!" + else + echo "No new tags found" + fi + + - name: Comment on PR + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const newTags = fs.readFileSync('/tmp/new_tags.txt', 'utf8').trim().split('\n').filter(t => t); + + let body = 'šŸš€ **Release published successfully!**\n\n'; + + if (newTags.length > 0) { + body += '**Published versions:**\n'; + newTags.forEach(tag => { + body += `- [\`${tag}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${tag})\n`; + }); + } + + body += '\nāœ… Crates published to crates.io\n'; + body += 'āœ… Git tags created and pushed\n'; + body += 'āœ… GitHub releases created\n'; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: body + }); diff --git a/Cargo.toml b/Cargo.toml index 5db5bcb2d0..437b24b2f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -232,3 +232,20 @@ solana-program-runtime = { git = "https://github.com/Lightprotocol/agave", rev = solana-bpf-loader-program = { git = "https://github.com/Lightprotocol/agave", rev = "35e7c295981a195e61b4f4039a5a6ef707d2210d" } # Patch solana-program-memory to use older version where is_nonoverlapping is public solana-program-memory = { git = "https://github.com/anza-xyz/solana-sdk", rev = "1c1d667f161666f12f5a43ebef8eda9470a8c6ee" } + +[workspace.metadata.release] +allow-branch = ["main", "release/*"] +tag-name = "{{crate_name}}-v{{version}}" +publish = true +push = true +shared-version = false +sign-commit = false +sign-tag = false +# Update workspace dependencies when releasing +dependent-version = "upgrade" +# Don't consolidate commits - create one commit per package +consolidate-commits = false +# Don't verify (skip tests/build checks) +verify = false +# Add delay between publishes to avoid rate limits +rate-limit = 5 diff --git a/scripts/release-program-libs.sh b/scripts/release-program-libs.sh new file mode 100755 index 0000000000..344a01188b --- /dev/null +++ b/scripts/release-program-libs.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Bump versions for all program-libs crates and create PR +# Usage: ./scripts/release-program-libs.sh [patch|minor|major] +# +# This script: +# 1. Bumps versions in Cargo.toml files +# 2. Creates a branch and commits changes +# 3. Pushes branch and creates PR +# 4. PR triggers GitHub Actions for validation and actual release + +PROGRAM_LIBS=( + "light-account-checks" + "aligned-sized" + "light-batched-merkle-tree" + "light-bloom-filter" + "light-compressed-account" + "light-concurrent-merkle-tree" + "light-hash-set" + "light-hasher" + "light-heap" + "light-indexed-array" + "light-indexed-merkle-tree" + "light-macros" + "light-merkle-tree-metadata" + "light-verifier" + "light-zero-copy-derive" + "light-zero-copy" +) + +# Parse arguments +BUMP_LEVEL="${1:-patch}" + +# Validate bump level +if [[ "$BUMP_LEVEL" != "patch" && "$BUMP_LEVEL" != "minor" && "$BUMP_LEVEL" != "major" ]]; then + echo "Error: Invalid bump level '$BUMP_LEVEL'" + echo "Usage: $0 [patch|minor|major]" + exit 1 +fi + +# Build the package arguments +PACKAGE_ARGS="" +for pkg in "${PROGRAM_LIBS[@]}"; do + PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" +done + +# Create release branch +TIMESTAMP=$(date +%Y%m%d-%H%M%S) +BRANCH_NAME="release/program-libs-${BUMP_LEVEL}-${TIMESTAMP}" + +echo "Creating release branch: $BRANCH_NAME" +git checkout -b "$BRANCH_NAME" + +echo "" +echo "Bumping versions for ${#PROGRAM_LIBS[@]} program-libs crates ($BUMP_LEVEL)..." +echo "cargo-release will automatically handle dependency ordering and workspace dependencies" +echo "" + +# Run cargo-release to bump versions only (no publish, no tag, no push) +cargo release version $BUMP_LEVEL $PACKAGE_ARGS --execute --no-confirm + +echo "" +echo "āœ“ Versions bumped successfully!" +echo "" + +# Commit changes +git add -A +git commit -m "chore(program-libs): bump versions ($BUMP_LEVEL)" + +# Push branch +echo "Pushing branch to origin..." +git push -u origin "$BRANCH_NAME" + +# Create PR +echo "" +echo "Creating pull request..." +gh pr create \ + --title "chore(program-libs): Release $BUMP_LEVEL version bump" \ + --body "## Program Libs Release + +This PR bumps versions for all program-libs crates. + +**Bump level:** \`$BUMP_LEVEL\` + +**Crates included:** +$(printf '- %s\n' "${PROGRAM_LIBS[@]}") + +### Release Process +1. āœ… Versions bumped in Cargo.toml files +2. ā³ PR validation (dry-run) will run automatically +3. ā³ After merge, GitHub Action will publish to crates.io and create releases + +--- +*Generated by \`scripts/release-program-libs.sh\`*" \ + --label "release" + +echo "" +echo "āœ“ Pull request created!" +echo "" +echo "Next steps:" +echo "1. Wait for PR checks to pass (dry-run validation)" +echo "2. Review and merge the PR" +echo "3. GitHub Action will automatically publish to crates.io and create releases" diff --git a/scripts/release-sdk-libs.sh b/scripts/release-sdk-libs.sh new file mode 100755 index 0000000000..24a24b5348 --- /dev/null +++ b/scripts/release-sdk-libs.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Bump versions for all sdk-libs crates and create PR +# Usage: ./scripts/release-sdk-libs.sh [patch|minor|major] +# +# This script: +# 1. Bumps versions in Cargo.toml files +# 2. Creates a branch and commits changes +# 3. Pushes branch and creates PR +# 4. PR triggers GitHub Actions for validation and actual release + +SDK_LIBS=( + "light-sdk-macros" + "light-sdk-types" + "light-sdk-pinocchio" + "light-sdk" + "light-client" + "photon-api" + "light-program-test" +) + +# Parse arguments +BUMP_LEVEL="${1:-patch}" + +# Validate bump level +if [[ "$BUMP_LEVEL" != "patch" && "$BUMP_LEVEL" != "minor" && "$BUMP_LEVEL" != "major" ]]; then + echo "Error: Invalid bump level '$BUMP_LEVEL'" + echo "Usage: $0 [patch|minor|major]" + exit 1 +fi + +# Build the package arguments +PACKAGE_ARGS="" +for pkg in "${SDK_LIBS[@]}"; do + PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" +done + +# Create release branch +TIMESTAMP=$(date +%Y%m%d-%H%M%S) +BRANCH_NAME="release/sdk-libs-${BUMP_LEVEL}-${TIMESTAMP}" + +echo "Creating release branch: $BRANCH_NAME" +git checkout -b "$BRANCH_NAME" + +echo "" +echo "Bumping versions for ${#SDK_LIBS[@]} sdk-libs crates ($BUMP_LEVEL)..." +echo "cargo-release will automatically handle dependency ordering and workspace dependencies" +echo "" + +# Run cargo-release to bump versions only (no publish, no tag, no push) +cargo release version $BUMP_LEVEL $PACKAGE_ARGS --execute --no-confirm + +echo "" +echo "āœ“ Versions bumped successfully!" +echo "" + +# Commit changes +git add -A +git commit -m "chore(sdk-libs): bump versions ($BUMP_LEVEL)" + +# Push branch +echo "Pushing branch to origin..." +git push -u origin "$BRANCH_NAME" + +# Create PR +echo "" +echo "Creating pull request..." +gh pr create \ + --title "chore(sdk-libs): Release $BUMP_LEVEL version bump" \ + --body "## SDK Libs Release + +This PR bumps versions for all sdk-libs crates. + +**Bump level:** \`$BUMP_LEVEL\` + +**Crates included:** +$(printf '- %s\n' "${SDK_LIBS[@]}") + +### Release Process +1. āœ… Versions bumped in Cargo.toml files +2. ā³ PR validation (dry-run) will run automatically +3. ā³ After merge, GitHub Action will publish to crates.io and create releases + +--- +*Generated by \`scripts/release-sdk-libs.sh\`*" \ + --label "release" + +echo "" +echo "āœ“ Pull request created!" +echo "" +echo "Next steps:" +echo "1. Wait for PR checks to pass (dry-run validation)" +echo "2. Review and merge the PR" +echo "3. GitHub Action will automatically publish to crates.io and create releases" From fb5c349d8c7494e216c0ddd0c2d91d9bfb6eb87c Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 6 Oct 2025 15:43:30 +0100 Subject: [PATCH 2/6] chore: remove emojis, sync versions with crates io --- .github/workflows/release-pr-validation.yml | 48 +++++-- .github/workflows/release-publish.yml | 126 +++++++++++-------- Cargo.lock | 16 +-- Cargo.toml | 22 ++-- program-libs/batched-merkle-tree/Cargo.toml | 2 +- program-libs/compressed-account/Cargo.toml | 2 +- program-libs/merkle-tree-metadata/Cargo.toml | 2 +- program-libs/verifier/Cargo.toml | 2 +- program-libs/zero-copy-derive/Cargo.toml | 2 +- program-libs/zero-copy/Cargo.toml | 2 +- scripts/release-program-libs.sh | 116 +++++++++++------ scripts/release-sdk-libs.sh | 122 +++++++++++------- sdk-libs/client/Cargo.toml | 2 +- sdk-libs/program-test/Cargo.toml | 2 +- 14 files changed, 298 insertions(+), 168 deletions(-) diff --git a/.github/workflows/release-pr-validation.yml b/.github/workflows/release-pr-validation.yml index d5fc78990d..e50c608229 100644 --- a/.github/workflows/release-pr-validation.yml +++ b/.github/workflows/release-pr-validation.yml @@ -49,13 +49,28 @@ jobs: "light-verifier" "light-zero-copy-derive" "light-zero-copy" ) - PACKAGE_ARGS=() + echo "Running dry-run publish for program-libs individually..." + FAILED_CRATES=() + for pkg in "${PROGRAM_LIBS[@]}"; do - PACKAGE_ARGS+=("-p" "$pkg") + echo "----------------------------------------" + echo "Validating $pkg..." + if cargo publish --dry-run -p "$pkg"; then + echo "āœ“ $pkg validation passed" + else + echo "āœ— $pkg validation failed" + FAILED_CRATES+=("$pkg") + fi done - echo "Running dry-run publish for program-libs..." - cargo publish --dry-run "${PACKAGE_ARGS[@]}" + if [ ${#FAILED_CRATES[@]} -ne 0 ]; then + echo "" + echo "Failed crates: ${FAILED_CRATES[*]}" + exit 1 + fi + + echo "" + echo "āœ“ All program-libs crates validated successfully" - name: Dry-run publish (sdk-libs) if: steps.detect_type.outputs.type == 'sdk-libs' @@ -65,13 +80,28 @@ jobs: "light-sdk" "light-client" "photon-api" "light-program-test" ) - PACKAGE_ARGS=() + echo "Running dry-run publish for sdk-libs individually..." + FAILED_CRATES=() + for pkg in "${SDK_LIBS[@]}"; do - PACKAGE_ARGS+=("-p" "$pkg") + echo "----------------------------------------" + echo "Validating $pkg..." + if cargo publish --dry-run -p "$pkg"; then + echo "āœ“ $pkg validation passed" + else + echo "āœ— $pkg validation failed" + FAILED_CRATES+=("$pkg") + fi done - echo "Running dry-run publish for sdk-libs..." - cargo publish --dry-run "${PACKAGE_ARGS[@]}" + if [ ${#FAILED_CRATES[@]} -ne 0 ]; then + echo "" + echo "Failed crates: ${FAILED_CRATES[*]}" + exit 1 + fi + + echo "" + echo "āœ“ All sdk-libs crates validated successfully" - name: Comment PR with validation result if: success() @@ -82,5 +112,5 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: 'āœ… **Release validation passed!**\n\nDry-run publish completed successfully. This PR is ready to merge.' + body: '**Release validation passed!**\n\nDry-run publish completed successfully. This PR is ready to merge.' }); diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index aa7bef05d4..e0b3381e24 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -49,17 +49,11 @@ jobs: exit 1 fi - - name: Get tags before publish - id: tags_before - run: | - git fetch --tags - git tag | sort > /tmp/tags_before.txt - cat /tmp/tags_before.txt - - name: Publish to crates.io (program-libs) if: steps.detect_type.outputs.type == 'program-libs' env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | PROGRAM_LIBS=( "light-account-checks" "aligned-sized" "light-batched-merkle-tree" @@ -69,76 +63,108 @@ jobs: "light-verifier" "light-zero-copy-derive" "light-zero-copy" ) - PACKAGE_ARGS=() + echo "Publishing program-libs crates individually..." + > /tmp/published_tags.txt + for pkg in "${PROGRAM_LIBS[@]}"; do - PACKAGE_ARGS+=("-p" "$pkg") - done + echo "----------------------------------------" + echo "Publishing $pkg..." + + # Publish to crates.io and create tag + if cargo release publish -p "$pkg" --execute --no-confirm; then + echo "āœ“ Published $pkg" + + # Get the tag that was just created + VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"$pkg\") | .version") + TAG="${pkg}-v${VERSION}" + + # Create GitHub release + echo "Creating GitHub release for $TAG..." + if gh release create "$TAG" --generate-notes --title "$TAG"; then + echo "āœ“ Created release for $TAG" + echo "$TAG" >> /tmp/published_tags.txt + else + echo "Warning: Failed to create release for $TAG" + fi - echo "Publishing program-libs to crates.io and creating tags..." - cargo release publish "${PACKAGE_ARGS[@]}" --execute --no-confirm + # Rate limiting: wait between publishes + sleep 10 + else + echo "Warning: Failed to publish $pkg" + fi + done - name: Publish to crates.io (sdk-libs) if: steps.detect_type.outputs.type == 'sdk-libs' env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | SDK_LIBS=( "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" "light-sdk" "light-client" "photon-api" "light-program-test" ) - PACKAGE_ARGS=() - for pkg in "${SDK_LIBS[@]}"; do - PACKAGE_ARGS+=("-p" "$pkg") - done - - echo "Publishing sdk-libs to crates.io and creating tags..." - cargo release publish "${PACKAGE_ARGS[@]}" --execute --no-confirm + echo "Publishing sdk-libs crates individually..." + > /tmp/published_tags.txt - - name: Get new tags - id: new_tags - run: | - git fetch --tags - git tag | sort > /tmp/tags_after.txt - comm -13 /tmp/tags_before.txt /tmp/tags_after.txt > /tmp/new_tags.txt - cat /tmp/new_tags.txt - - - name: Create GitHub releases - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ -s /tmp/new_tags.txt ]; then - echo "Creating GitHub releases for new tags..." - while IFS= read -r tag; do - if [[ -n "$tag" ]]; then - echo "Creating release for $tag..." - gh release create "$tag" --generate-notes --title "$tag" || echo "Warning: Failed to create release for $tag" + for pkg in "${SDK_LIBS[@]}"; do + echo "----------------------------------------" + echo "Publishing $pkg..." + + # Publish to crates.io and create tag + if cargo release publish -p "$pkg" --execute --no-confirm; then + echo "āœ“ Published $pkg" + + # Get the tag that was just created + VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"$pkg\") | .version") + TAG="${pkg}-v${VERSION}" + + # Create GitHub release + echo "Creating GitHub release for $TAG..." + if gh release create "$TAG" --generate-notes --title "$TAG"; then + echo "āœ“ Created release for $TAG" + echo "$TAG" >> /tmp/published_tags.txt + else + echo "Warning: Failed to create release for $TAG" fi - done < /tmp/new_tags.txt - echo "āœ“ GitHub releases created!" - else - echo "No new tags found" - fi + + # Rate limiting: wait between publishes + sleep 10 + else + echo "Warning: Failed to publish $pkg" + fi + done - name: Comment on PR uses: actions/github-script@v7 with: script: | const fs = require('fs'); - const newTags = fs.readFileSync('/tmp/new_tags.txt', 'utf8').trim().split('\n').filter(t => t); + let publishedTags = []; + + try { + publishedTags = fs.readFileSync('/tmp/published_tags.txt', 'utf8').trim().split('\n').filter(t => t); + } catch (e) { + console.log('No published tags file found'); + } - let body = 'šŸš€ **Release published successfully!**\n\n'; + let body = '**Release published successfully!**\n\n'; - if (newTags.length > 0) { + if (publishedTags.length > 0) { body += '**Published versions:**\n'; - newTags.forEach(tag => { - body += `- [\`${tag}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${tag})\n`; + publishedTags.forEach(tag => { + const crateUrl = `https://crates.io/crates/${tag.split('-v')[0]}`; + body += `- [\`${tag}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${tag}) ([crates.io](${crateUrl}))\n`; }); + } else { + body += 'No new versions published (all crates were up to date).\n'; } - body += '\nāœ… Crates published to crates.io\n'; - body += 'āœ… Git tags created and pushed\n'; - body += 'āœ… GitHub releases created\n'; + body += '\n---\n'; + body += 'āœ“ Crates published to crates.io\n'; + body += 'āœ“ Git tags created and pushed\n'; + body += 'āœ“ GitHub releases created\n'; github.rest.issues.createComment({ owner: context.repo.owner, diff --git a/Cargo.lock b/Cargo.lock index f46b53dd48..b4fade0fb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3362,7 +3362,7 @@ dependencies = [ [[package]] name = "light-batched-merkle-tree" -version = "0.3.0" +version = "0.4.2" dependencies = [ "aligned-sized", "borsh 0.10.4", @@ -3418,7 +3418,7 @@ dependencies = [ [[package]] name = "light-client" -version = "0.13.1" +version = "0.14.0" dependencies = [ "async-trait", "base64 0.13.1", @@ -3464,7 +3464,7 @@ dependencies = [ [[package]] name = "light-compressed-account" -version = "0.3.0" +version = "0.4.0" dependencies = [ "anchor-lang", "ark-bn254 0.5.0", @@ -3611,7 +3611,7 @@ dependencies = [ [[package]] name = "light-merkle-tree-metadata" -version = "0.3.0" +version = "0.4.0" dependencies = [ "anchor-lang", "borsh 0.10.4", @@ -3681,7 +3681,7 @@ dependencies = [ [[package]] name = "light-program-test" -version = "0.13.2" +version = "0.14.0" dependencies = [ "account-compression", "anchor-lang", @@ -3938,7 +3938,7 @@ dependencies = [ [[package]] name = "light-verifier" -version = "2.1.0" +version = "3.0.0" dependencies = [ "groth16-solana", "light-compressed-account", @@ -3950,7 +3950,7 @@ dependencies = [ [[package]] name = "light-zero-copy" -version = "0.2.0" +version = "0.3.0" dependencies = [ "borsh 0.10.4", "light-zero-copy-derive", @@ -3962,7 +3962,7 @@ dependencies = [ [[package]] name = "light-zero-copy-derive" -version = "0.1.0" +version = "0.3.0" dependencies = [ "borsh 0.10.4", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 437b24b2f8..5d9e80e43d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -157,7 +157,7 @@ light-hash-set = { version = "2.1.0", path = "program-libs/hash-set" } light-indexed-merkle-tree = { version = "2.1.0", path = "program-libs/indexed-merkle-tree" } light-concurrent-merkle-tree = { version = "2.1.0", path = "program-libs/concurrent-merkle-tree" } light-sparse-merkle-tree = { version = "0.1.0", path = "sparse-merkle-tree" } -light-client = { path = "sdk-libs/client", version = "0.13.1" } +light-client = { path = "sdk-libs/client", version = "0.14.0" } light-hasher = { path = "program-libs/hasher", version = "3.1.0" } light-macros = { path = "program-libs/macros", version = "2.1.0" } light-merkle-tree-reference = { path = "program-tests/merkle-tree", version = "2.0.0" } @@ -167,11 +167,11 @@ light-sdk = { path = "sdk-libs/sdk", version = "0.13.0" } light-sdk-pinocchio = { path = "sdk-libs/sdk-pinocchio", version = "0.13.0" } light-sdk-macros = { path = "sdk-libs/macros", version = "0.13.0" } light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.13.0" } -light-compressed-account = { path = "program-libs/compressed-account", version = "0.3.0" } +light-compressed-account = { path = "program-libs/compressed-account", version = "0.4.0" } light-account-checks = { path = "program-libs/account-checks", version = "0.3.0" } -light-verifier = { path = "program-libs/verifier", version = "2.1.0" } -light-zero-copy = { path = "program-libs/zero-copy", version = "0.2.0" } -light-zero-copy-derive = { path = "program-libs/zero-copy-derive", version = "0.1.0" } +light-verifier = { path = "program-libs/verifier", version = "3.0.0" } +light-zero-copy = { path = "program-libs/zero-copy", version = "0.3.0" } +light-zero-copy-derive = { path = "program-libs/zero-copy-derive", version = "0.3.0" } photon-api = { path = "sdk-libs/photon-api", version = "0.51.0" } forester-utils = { path = "forester-utils", version = "2.0.0" } account-compression = { path = "programs/account-compression", version = "2.0.0", features = [ @@ -190,9 +190,9 @@ light-registry = { path = "programs/registry", version = "2.0.0", features = [ create-address-test-program = { path = "program-tests/create-address-test-program", version = "1.0.0", features = [ "cpi", ] } -light-program-test = { path = "sdk-libs/program-test", version = "0.13.2" } -light-batched-merkle-tree = { path = "program-libs/batched-merkle-tree", version = "0.3.0" } -light-merkle-tree-metadata = { path = "program-libs/merkle-tree-metadata", version = "0.3.0" } +light-program-test = { path = "sdk-libs/program-test", version = "0.14.0" } +light-batched-merkle-tree = { path = "program-libs/batched-merkle-tree", version = "0.4.2" } +light-merkle-tree-metadata = { path = "program-libs/merkle-tree-metadata", version = "0.4.0" } aligned-sized = { path = "program-libs/aligned-sized", version = "1.1.0" } light-bloom-filter = { path = "program-libs/bloom-filter", version = "0.3.0" } light-bounded-vec = { version = "2.0.0" } @@ -247,5 +247,7 @@ dependent-version = "upgrade" consolidate-commits = false # Don't verify (skip tests/build checks) verify = false -# Add delay between publishes to avoid rate limits -rate-limit = 5 + +[workspace.metadata.release.rate-limit] +new-packages = 5 +existing-packages = 5 diff --git a/program-libs/batched-merkle-tree/Cargo.toml b/program-libs/batched-merkle-tree/Cargo.toml index 0786887e93..fd5fe99e87 100644 --- a/program-libs/batched-merkle-tree/Cargo.toml +++ b/program-libs/batched-merkle-tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-batched-merkle-tree" -version = "0.3.0" +version = "0.4.2" description = "Batch Merkle tree implementation." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/program-libs/compressed-account/Cargo.toml b/program-libs/compressed-account/Cargo.toml index ce2390b5d7..f9a6316b60 100644 --- a/program-libs/compressed-account/Cargo.toml +++ b/program-libs/compressed-account/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-compressed-account" -version = "0.3.0" +version = "0.4.0" description = "Compressed account struct and common utility functions used in Light Protocol." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/program-libs/merkle-tree-metadata/Cargo.toml b/program-libs/merkle-tree-metadata/Cargo.toml index 14fb348326..d43b432d2d 100644 --- a/program-libs/merkle-tree-metadata/Cargo.toml +++ b/program-libs/merkle-tree-metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-merkle-tree-metadata" -version = "0.3.0" +version = "0.4.0" description = "Merkle tree metadata for light-concurrent-merkle-tree, light-indexed-merkle-tree, light-batched-merkle-tree." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/program-libs/verifier/Cargo.toml b/program-libs/verifier/Cargo.toml index f43ecbc597..7e6d9fab16 100644 --- a/program-libs/verifier/Cargo.toml +++ b/program-libs/verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-verifier" -version = "2.1.0" +version = "3.0.0" description = "ZKP proof verifier used in Light Protocol" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/program-libs/zero-copy-derive/Cargo.toml b/program-libs/zero-copy-derive/Cargo.toml index 1cdc8254e8..b3580549dd 100644 --- a/program-libs/zero-copy-derive/Cargo.toml +++ b/program-libs/zero-copy-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-zero-copy-derive" -version = "0.1.0" +version = "0.3.0" edition = "2021" license = "Apache-2.0" description = "Proc macro for zero-copy deserialization" diff --git a/program-libs/zero-copy/Cargo.toml b/program-libs/zero-copy/Cargo.toml index 67c2728d63..bb1c88738d 100644 --- a/program-libs/zero-copy/Cargo.toml +++ b/program-libs/zero-copy/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-zero-copy" -version = "0.2.0" +version = "0.3.0" description = "Zero copy vector and utils for Solana programs." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/scripts/release-program-libs.sh b/scripts/release-program-libs.sh index 344a01188b..8fbfd8caf1 100755 --- a/scripts/release-program-libs.sh +++ b/scripts/release-program-libs.sh @@ -1,14 +1,11 @@ #!/usr/bin/env bash set -euo pipefail -# Bump versions for all program-libs crates and create PR -# Usage: ./scripts/release-program-libs.sh [patch|minor|major] +# Bump versions for program-libs crates and create PR +# Usage: ./scripts/release-program-libs.sh # -# This script: -# 1. Bumps versions in Cargo.toml files -# 2. Creates a branch and commits changes -# 3. Pushes branch and creates PR -# 4. PR triggers GitHub Actions for validation and actual release +# Automatically detects the appropriate version bump level for each crate +# based on conventional commits since the last release PROGRAM_LIBS=( "light-account-checks" @@ -29,74 +26,113 @@ PROGRAM_LIBS=( "light-zero-copy" ) -# Parse arguments -BUMP_LEVEL="${1:-patch}" +echo "Analyzing changes for program-libs crates..." +echo "" -# Validate bump level -if [[ "$BUMP_LEVEL" != "patch" && "$BUMP_LEVEL" != "minor" && "$BUMP_LEVEL" != "major" ]]; then - echo "Error: Invalid bump level '$BUMP_LEVEL'" - echo "Usage: $0 [patch|minor|major]" - exit 1 -fi +# Get change recommendations from cargo-release +CHANGES_OUTPUT=$(cargo release changes 2>&1 || true) + +# Parse recommendations for each crate +CRATES_TO_RELEASE=() +BUMP_LEVELS=() -# Build the package arguments -PACKAGE_ARGS="" for pkg in "${PROGRAM_LIBS[@]}"; do - PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" + RECOMMENDATION=$(echo "$CHANGES_OUTPUT" | grep "cargo release version -p $pkg" | sed -n "s/.*-p $pkg \([^ ]*\).*/\1/p" || echo "") + + if [[ -z "$RECOMMENDATION" || "$RECOMMENDATION" == "" ]]; then + echo "$pkg: skipped (no changes)" + else + CRATES_TO_RELEASE+=("$pkg") + BUMP_LEVELS+=("$RECOMMENDATION") + echo "$pkg: $RECOMMENDATION" + fi done +echo "" + +if [ ${#CRATES_TO_RELEASE[@]} -eq 0 ]; then + echo "No program-libs crates have changes. Nothing to release." + exit 0 +fi + +echo "=========================================" +echo "Program Libs Release Plan:" +echo "=========================================" +for i in "${!CRATES_TO_RELEASE[@]}"; do + echo " ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]}" +done +echo "=========================================" +echo "" +read -p "Proceed with these version bumps? (y/N) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Release cancelled." + exit 1 +fi + # Create release branch TIMESTAMP=$(date +%Y%m%d-%H%M%S) -BRANCH_NAME="release/program-libs-${BUMP_LEVEL}-${TIMESTAMP}" +BRANCH_NAME="release/program-libs-${TIMESTAMP}" +echo "" echo "Creating release branch: $BRANCH_NAME" git checkout -b "$BRANCH_NAME" echo "" -echo "Bumping versions for ${#PROGRAM_LIBS[@]} program-libs crates ($BUMP_LEVEL)..." -echo "cargo-release will automatically handle dependency ordering and workspace dependencies" +echo "Bumping versions..." echo "" -# Run cargo-release to bump versions only (no publish, no tag, no push) -cargo release version $BUMP_LEVEL $PACKAGE_ARGS --execute --no-confirm +# Bump each crate individually with its detected level +for i in "${!CRATES_TO_RELEASE[@]}"; do + pkg="${CRATES_TO_RELEASE[$i]}" + level="${BUMP_LEVELS[$i]}" + echo "Bumping $pkg: $level" + cargo release version "$level" -p "$pkg" --execute --no-confirm +done echo "" -echo "āœ“ Versions bumped successfully!" +echo "Versions bumped successfully!" echo "" # Commit changes git add -A -git commit -m "chore(program-libs): bump versions ($BUMP_LEVEL)" +git commit -m "chore(program-libs): bump versions" # Push branch echo "Pushing branch to origin..." git push -u origin "$BRANCH_NAME" -# Create PR -echo "" -echo "Creating pull request..." -gh pr create \ - --title "chore(program-libs): Release $BUMP_LEVEL version bump" \ - --body "## Program Libs Release +# Create PR body +PR_BODY="## Program Libs Release -This PR bumps versions for all program-libs crates. +This PR bumps versions for program-libs crates based on conventional commits. -**Bump level:** \`$BUMP_LEVEL\` +**Version bumps:** +" -**Crates included:** -$(printf '- %s\n' "${PROGRAM_LIBS[@]}") +for i in "${!CRATES_TO_RELEASE[@]}"; do + PR_BODY="${PR_BODY}- ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]} +" +done +PR_BODY="${PR_BODY} ### Release Process -1. āœ… Versions bumped in Cargo.toml files -2. ā³ PR validation (dry-run) will run automatically -3. ā³ After merge, GitHub Action will publish to crates.io and create releases +1. Versions bumped in Cargo.toml files +2. PR validation (dry-run) will run automatically +3. After merge, GitHub Action will publish each crate individually to crates.io and create releases --- -*Generated by \`scripts/release-program-libs.sh\`*" \ +*Generated by \`scripts/release-program-libs.sh\`*" + +echo "" +echo "Creating pull request..." +gh pr create \ + --title "chore(program-libs): Bump versions" \ + --body "$PR_BODY" \ --label "release" echo "" -echo "āœ“ Pull request created!" +echo "Pull request created!" echo "" echo "Next steps:" echo "1. Wait for PR checks to pass (dry-run validation)" diff --git a/scripts/release-sdk-libs.sh b/scripts/release-sdk-libs.sh index 24a24b5348..dc9c271a67 100755 --- a/scripts/release-sdk-libs.sh +++ b/scripts/release-sdk-libs.sh @@ -1,93 +1,129 @@ #!/usr/bin/env bash set -euo pipefail -# Bump versions for all sdk-libs crates and create PR -# Usage: ./scripts/release-sdk-libs.sh [patch|minor|major] +# Bump versions for sdk-libs crates and create PR +# Usage: ./scripts/release-sdk-libs.sh # -# This script: -# 1. Bumps versions in Cargo.toml files -# 2. Creates a branch and commits changes -# 3. Pushes branch and creates PR -# 4. PR triggers GitHub Actions for validation and actual release +# Automatically detects the appropriate version bump level for each crate +# based on conventional commits since the last release SDK_LIBS=( + "light-client" "light-sdk-macros" - "light-sdk-types" - "light-sdk-pinocchio" "light-sdk" - "light-client" + "light-sdk-pinocchio" + "light-sdk-types" "photon-api" "light-program-test" ) -# Parse arguments -BUMP_LEVEL="${1:-patch}" +echo "Analyzing changes for sdk-libs crates..." +echo "" -# Validate bump level -if [[ "$BUMP_LEVEL" != "patch" && "$BUMP_LEVEL" != "minor" && "$BUMP_LEVEL" != "major" ]]; then - echo "Error: Invalid bump level '$BUMP_LEVEL'" - echo "Usage: $0 [patch|minor|major]" - exit 1 -fi +# Get change recommendations from cargo-release +CHANGES_OUTPUT=$(cargo release changes 2>&1 || true) + +# Parse recommendations for each crate +CRATES_TO_RELEASE=() +BUMP_LEVELS=() -# Build the package arguments -PACKAGE_ARGS="" for pkg in "${SDK_LIBS[@]}"; do - PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" + RECOMMENDATION=$(echo "$CHANGES_OUTPUT" | grep "cargo release version -p $pkg" | sed -n "s/.*-p $pkg \([^ ]*\).*/\1/p" || echo "") + + if [[ -z "$RECOMMENDATION" || "$RECOMMENDATION" == "" ]]; then + echo "$pkg: skipped (no changes)" + else + CRATES_TO_RELEASE+=("$pkg") + BUMP_LEVELS+=("$RECOMMENDATION") + echo "$pkg: $RECOMMENDATION" + fi done +echo "" + +if [ ${#CRATES_TO_RELEASE[@]} -eq 0 ]; then + echo "No sdk-libs crates have changes. Nothing to release." + exit 0 +fi + +echo "=========================================" +echo "SDK Libs Release Plan:" +echo "=========================================" +for i in "${!CRATES_TO_RELEASE[@]}"; do + echo " ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]}" +done +echo "=========================================" +echo "" +read -p "Proceed with these version bumps? (y/N) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Release cancelled." + exit 1 +fi + # Create release branch TIMESTAMP=$(date +%Y%m%d-%H%M%S) -BRANCH_NAME="release/sdk-libs-${BUMP_LEVEL}-${TIMESTAMP}" +BRANCH_NAME="release/sdk-libs-${TIMESTAMP}" +echo "" echo "Creating release branch: $BRANCH_NAME" git checkout -b "$BRANCH_NAME" echo "" -echo "Bumping versions for ${#SDK_LIBS[@]} sdk-libs crates ($BUMP_LEVEL)..." -echo "cargo-release will automatically handle dependency ordering and workspace dependencies" +echo "Bumping versions..." echo "" -# Run cargo-release to bump versions only (no publish, no tag, no push) -cargo release version $BUMP_LEVEL $PACKAGE_ARGS --execute --no-confirm +# Bump each crate individually with its detected level +for i in "${!CRATES_TO_RELEASE[@]}"; do + pkg="${CRATES_TO_RELEASE[$i]}" + level="${BUMP_LEVELS[$i]}" + echo "Bumping $pkg: $level" + cargo release version "$level" -p "$pkg" --execute --no-confirm +done echo "" -echo "āœ“ Versions bumped successfully!" +echo "Versions bumped successfully!" echo "" # Commit changes git add -A -git commit -m "chore(sdk-libs): bump versions ($BUMP_LEVEL)" +git commit -m "chore(sdk-libs): bump versions" # Push branch echo "Pushing branch to origin..." git push -u origin "$BRANCH_NAME" -# Create PR -echo "" -echo "Creating pull request..." -gh pr create \ - --title "chore(sdk-libs): Release $BUMP_LEVEL version bump" \ - --body "## SDK Libs Release +# Create PR body +PR_BODY="## SDK Libs Release -This PR bumps versions for all sdk-libs crates. +This PR bumps versions for sdk-libs crates based on conventional commits. -**Bump level:** \`$BUMP_LEVEL\` +**Version bumps:** +" -**Crates included:** -$(printf '- %s\n' "${SDK_LIBS[@]}") +for i in "${!CRATES_TO_RELEASE[@]}"; do + PR_BODY="${PR_BODY}- ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]} +" +done +PR_BODY="${PR_BODY} ### Release Process -1. āœ… Versions bumped in Cargo.toml files -2. ā³ PR validation (dry-run) will run automatically -3. ā³ After merge, GitHub Action will publish to crates.io and create releases +1. Versions bumped in Cargo.toml files +2. PR validation (dry-run) will run automatically +3. After merge, GitHub Action will publish each crate individually to crates.io and create releases --- -*Generated by \`scripts/release-sdk-libs.sh\`*" \ +*Generated by \`scripts/release-sdk-libs.sh\`*" + +echo "" +echo "Creating pull request..." +gh pr create \ + --title "chore(sdk-libs): Bump versions" \ + --body "$PR_BODY" \ --label "release" echo "" -echo "āœ“ Pull request created!" +echo "Pull request created!" echo "" echo "Next steps:" echo "1. Wait for PR checks to pass (dry-run validation)" diff --git a/sdk-libs/client/Cargo.toml b/sdk-libs/client/Cargo.toml index 2bc1708dd7..f224066ed9 100644 --- a/sdk-libs/client/Cargo.toml +++ b/sdk-libs/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-client" -version = "0.13.1" +version = "0.14.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/lightprotocol/light-protocol" diff --git a/sdk-libs/program-test/Cargo.toml b/sdk-libs/program-test/Cargo.toml index 8ee936eddf..98184f455e 100644 --- a/sdk-libs/program-test/Cargo.toml +++ b/sdk-libs/program-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-program-test" -version = "0.13.2" +version = "0.14.0" description = "A fast local test environment for Solana programs using compressed accounts and tokens." license = "MIT" edition = "2021" From aa2cc79763a50deeaa43af736bbe451015ae9984 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 6 Oct 2025 16:32:26 +0100 Subject: [PATCH 3/6] update scripts --- .github/workflows/rust.yml | 10 +- .github/workflows/sdk-tests.yml | 3 +- Cargo.lock | 24 ++- Cargo.toml | 1 + program-libs/batched-merkle-tree/Cargo.toml | 4 - .../batched-merkle-tree-test/Cargo.toml | 27 ++++ .../batched-merkle-tree-test/src/lib.rs | 0 .../tests/account_access.rs | 3 - .../tests/initialize_address_tree.rs | 0 .../tests/initialize_state_tree.rs | 0 .../tests/merkle_tree.rs | 1 - .../batched-merkle-tree-test}/tests/queue.rs | 1 - .../tests/rollover_address_tree.rs | 1 - .../tests/rollover_state_tree.rs | 1 - scripts/create-release-pr.sh | 86 +++++++++++ scripts/release-program-libs.sh | 140 ------------------ scripts/release-sdk-libs.sh | 131 ---------------- 17 files changed, 141 insertions(+), 292 deletions(-) create mode 100644 program-tests/batched-merkle-tree-test/Cargo.toml create mode 100644 program-tests/batched-merkle-tree-test/src/lib.rs rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/account_access.rs (99%) rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/initialize_address_tree.rs (100%) rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/initialize_state_tree.rs (100%) rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/merkle_tree.rs (99%) rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/queue.rs (99%) rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/rollover_address_tree.rs (99%) rename {program-libs/batched-merkle-tree => program-tests/batched-merkle-tree-test}/tests/rollover_state_tree.rs (99%) create mode 100755 scripts/create-release-pr.sh delete mode 100755 scripts/release-program-libs.sh delete mode 100755 scripts/release-sdk-libs.sh diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 212ae4364b..692293f235 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 \ @@ -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 }} diff --git a/.github/workflows/sdk-tests.yml b/.github/workflows/sdk-tests.yml index 39294a96ab..fa3bace267 100644 --- a/.github/workflows/sdk-tests.yml +++ b/.github/workflows/sdk-tests.yml @@ -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 @@ -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 diff --git a/Cargo.lock b/Cargo.lock index b4fade0fb1..cfa9571078 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -918,6 +918,26 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "batched-merkle-tree-tests" +version = "0.1.0" +dependencies = [ + "light-account-checks", + "light-batched-merkle-tree", + "light-bloom-filter", + "light-compressed-account", + "light-hasher", + "light-merkle-tree-metadata", + "light-merkle-tree-reference", + "light-prover-client", + "light-test-utils", + "light-zero-copy", + "rand 0.8.5", + "serial_test", + "solana-pubkey", + "tokio", +] + [[package]] name = "bb8" version = "0.8.6" @@ -3373,20 +3393,16 @@ dependencies = [ "light-macros", "light-merkle-tree-metadata", "light-merkle-tree-reference", - "light-prover-client", - "light-test-utils", "light-verifier", "light-zero-copy", "pinocchio", "rand 0.8.5", - "serial_test", "solana-account-info", "solana-msg", "solana-program-error", "solana-pubkey", "solana-sysvar", "thiserror 2.0.17", - "tokio", "zerocopy", ] diff --git a/Cargo.toml b/Cargo.toml index 5d9e80e43d..b90591431c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ members = [ "sdk-libs/program-test", "xtask", "program-tests/account-compression-test", + "program-tests/batched-merkle-tree-test", "program-tests/compressed-token-test", "program-tests/e2e-test", "program-tests/registry-test", diff --git a/program-libs/batched-merkle-tree/Cargo.toml b/program-libs/batched-merkle-tree/Cargo.toml index fd5fe99e87..e52c5f0592 100644 --- a/program-libs/batched-merkle-tree/Cargo.toml +++ b/program-libs/batched-merkle-tree/Cargo.toml @@ -55,13 +55,9 @@ light-macros = { workspace = true } [dev-dependencies] rand = { workspace = true } -light-prover-client = { workspace = true, features = ["devenv"] } light-merkle-tree-reference = { workspace = true } -tokio = { workspace = true } -serial_test = { workspace = true } light-account-checks = { workspace = true, features = ["test-only"] } light-compressed-account = { workspace = true, features = ["new-unique"] } -light-test-utils = { workspace = true, features = ["test-only"] } [lints.rust.unexpected_cfgs] level = "allow" diff --git a/program-tests/batched-merkle-tree-test/Cargo.toml b/program-tests/batched-merkle-tree-test/Cargo.toml new file mode 100644 index 0000000000..adb3876530 --- /dev/null +++ b/program-tests/batched-merkle-tree-test/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "batched-merkle-tree-tests" +version = "0.1.0" +description = "Batch Merkle tree integration tests." +repository = "https://github.com/Lightprotocol/light-protocol" +license = "Apache-2.0" +edition = "2021" + +[dev-dependencies] +light-batched-merkle-tree = { workspace = true , features = ["test-only", "solana"]} +rand = { workspace = true } +light-prover-client = { workspace = true, features = ["devenv"] } +light-merkle-tree-reference = { workspace = true } +tokio = { workspace = true } +serial_test = { workspace = true } +light-account-checks = { workspace = true, features = ["test-only"] } +light-compressed-account = { workspace = true, features = ["new-unique"] } +light-test-utils = { workspace = true, features = ["test-only"] } +light-hasher = { workspace = true, features = ["solana"] } +light-bloom-filter = { workspace = true, features = ["solana"] } +light-zero-copy = { workspace = true } +solana-pubkey = { workspace = true } +light-merkle-tree-metadata = { workspace = true } + +[lints.rust.unexpected_cfgs] +level = "allow" +check-cfg = ['cfg(target_os, values("solana"))'] diff --git a/program-tests/batched-merkle-tree-test/src/lib.rs b/program-tests/batched-merkle-tree-test/src/lib.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/program-libs/batched-merkle-tree/tests/account_access.rs b/program-tests/batched-merkle-tree-test/tests/account_access.rs similarity index 99% rename from program-libs/batched-merkle-tree/tests/account_access.rs rename to program-tests/batched-merkle-tree-test/tests/account_access.rs index ff45f13724..4e695d8f43 100644 --- a/program-libs/batched-merkle-tree/tests/account_access.rs +++ b/program-tests/batched-merkle-tree-test/tests/account_access.rs @@ -1,6 +1,3 @@ -#![cfg(feature = "test-only")] -#![cfg(feature = "solana")] - use light_account_checks::account_info::test_account_info::solana_program::TestAccount; use light_batched_merkle_tree::{ constants::{ACCOUNT_COMPRESSION_PROGRAM_ID, ADDRESS_TREE_INIT_ROOT_40}, diff --git a/program-libs/batched-merkle-tree/tests/initialize_address_tree.rs b/program-tests/batched-merkle-tree-test/tests/initialize_address_tree.rs similarity index 100% rename from program-libs/batched-merkle-tree/tests/initialize_address_tree.rs rename to program-tests/batched-merkle-tree-test/tests/initialize_address_tree.rs diff --git a/program-libs/batched-merkle-tree/tests/initialize_state_tree.rs b/program-tests/batched-merkle-tree-test/tests/initialize_state_tree.rs similarity index 100% rename from program-libs/batched-merkle-tree/tests/initialize_state_tree.rs rename to program-tests/batched-merkle-tree-test/tests/initialize_state_tree.rs diff --git a/program-libs/batched-merkle-tree/tests/merkle_tree.rs b/program-tests/batched-merkle-tree-test/tests/merkle_tree.rs similarity index 99% rename from program-libs/batched-merkle-tree/tests/merkle_tree.rs rename to program-tests/batched-merkle-tree-test/tests/merkle_tree.rs index 47a77ff87a..24f41dce39 100644 --- a/program-libs/batched-merkle-tree/tests/merkle_tree.rs +++ b/program-tests/batched-merkle-tree-test/tests/merkle_tree.rs @@ -1,4 +1,3 @@ -#![cfg(feature = "test-only")] #![allow(unused_assignments)] use std::cmp::min; diff --git a/program-libs/batched-merkle-tree/tests/queue.rs b/program-tests/batched-merkle-tree-test/tests/queue.rs similarity index 99% rename from program-libs/batched-merkle-tree/tests/queue.rs rename to program-tests/batched-merkle-tree-test/tests/queue.rs index d57c3fa686..38e0dbf958 100644 --- a/program-libs/batched-merkle-tree/tests/queue.rs +++ b/program-tests/batched-merkle-tree-test/tests/queue.rs @@ -1,4 +1,3 @@ -#![cfg(feature = "test-only")] use light_batched_merkle_tree::{ batch::Batch, constants::NUM_BATCHES, diff --git a/program-libs/batched-merkle-tree/tests/rollover_address_tree.rs b/program-tests/batched-merkle-tree-test/tests/rollover_address_tree.rs similarity index 99% rename from program-libs/batched-merkle-tree/tests/rollover_address_tree.rs rename to program-tests/batched-merkle-tree-test/tests/rollover_address_tree.rs index 09ac59bd15..5b73c98b64 100644 --- a/program-libs/batched-merkle-tree/tests/rollover_address_tree.rs +++ b/program-tests/batched-merkle-tree-test/tests/rollover_address_tree.rs @@ -1,4 +1,3 @@ -#![cfg(feature = "test-only")] use light_batched_merkle_tree::{ constants::NUM_BATCHES, errors::BatchedMerkleTreeError, diff --git a/program-libs/batched-merkle-tree/tests/rollover_state_tree.rs b/program-tests/batched-merkle-tree-test/tests/rollover_state_tree.rs similarity index 99% rename from program-libs/batched-merkle-tree/tests/rollover_state_tree.rs rename to program-tests/batched-merkle-tree-test/tests/rollover_state_tree.rs index 2f74e63f19..4b4f0e985b 100644 --- a/program-libs/batched-merkle-tree/tests/rollover_state_tree.rs +++ b/program-tests/batched-merkle-tree-test/tests/rollover_state_tree.rs @@ -1,4 +1,3 @@ -#![cfg(feature = "test-only")] use light_batched_merkle_tree::{ errors::BatchedMerkleTreeError, initialize_state_tree::{ diff --git a/scripts/create-release-pr.sh b/scripts/create-release-pr.sh new file mode 100755 index 0000000000..eb33ca14a7 --- /dev/null +++ b/scripts/create-release-pr.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Create release PR with current changes +# Usage: ./scripts/create-release-pr.sh + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +RELEASE_TYPE=$1 + +if [[ ! "$RELEASE_TYPE" =~ ^(program-libs|sdk-libs)$ ]]; then + echo "Error: Release type must be 'program-libs' or 'sdk-libs'" + exit 1 +fi + +# Check if there are changes +if git diff --quiet; then + echo "No changes detected. Please bump versions first." + exit 1 +fi + +echo "=========================================" +echo "Creating $RELEASE_TYPE release PR" +echo "=========================================" +echo "" + +# Show what changed +echo "Changed files:" +git diff --name-only | grep Cargo.toml || echo " (no Cargo.toml changes)" +echo "" + +# Extract version changes +echo "Version changes:" +git diff | grep -E '^\+version|^-version' | head -20 || echo " (could not detect)" +echo "" + +read -p "Create release PR with these changes? (y/N) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Cancelled." + exit 1 +fi + +# Create release branch +BRANCH_NAME="release/${RELEASE_TYPE}" + +echo "" +echo "Creating release branch: $BRANCH_NAME" +git checkout -b "$BRANCH_NAME" + +# Commit changes +git add -A +git commit -m "chore(${RELEASE_TYPE}): bump versions" + +# Push branch +echo "Pushing branch to origin..." +git push -u origin "$BRANCH_NAME" + +# Create PR +echo "" +echo "Creating pull request..." +gh pr create \ + --title "chore(${RELEASE_TYPE}): Bump versions" \ + --body "## ${RELEASE_TYPE^} Release + +This PR bumps versions for ${RELEASE_TYPE} crates. + +### Release Process +1. Versions bumped in Cargo.toml files +2. PR validation (dry-run) will run automatically +3. After merge, GitHub Action will publish each crate individually to crates.io and create releases + +--- +*Generated by \`scripts/create-release-pr.sh ${RELEASE_TYPE}\`*" \ + --label "release" + +echo "" +echo "Pull request created!" +echo "" +echo "Next steps:" +echo "1. Wait for PR checks to pass (dry-run validation)" +echo "2. Review and merge the PR" +echo "3. GitHub Action will automatically publish to crates.io and create releases" diff --git a/scripts/release-program-libs.sh b/scripts/release-program-libs.sh deleted file mode 100755 index 8fbfd8caf1..0000000000 --- a/scripts/release-program-libs.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Bump versions for program-libs crates and create PR -# Usage: ./scripts/release-program-libs.sh -# -# Automatically detects the appropriate version bump level for each crate -# based on conventional commits since the last release - -PROGRAM_LIBS=( - "light-account-checks" - "aligned-sized" - "light-batched-merkle-tree" - "light-bloom-filter" - "light-compressed-account" - "light-concurrent-merkle-tree" - "light-hash-set" - "light-hasher" - "light-heap" - "light-indexed-array" - "light-indexed-merkle-tree" - "light-macros" - "light-merkle-tree-metadata" - "light-verifier" - "light-zero-copy-derive" - "light-zero-copy" -) - -echo "Analyzing changes for program-libs crates..." -echo "" - -# Get change recommendations from cargo-release -CHANGES_OUTPUT=$(cargo release changes 2>&1 || true) - -# Parse recommendations for each crate -CRATES_TO_RELEASE=() -BUMP_LEVELS=() - -for pkg in "${PROGRAM_LIBS[@]}"; do - RECOMMENDATION=$(echo "$CHANGES_OUTPUT" | grep "cargo release version -p $pkg" | sed -n "s/.*-p $pkg \([^ ]*\).*/\1/p" || echo "") - - if [[ -z "$RECOMMENDATION" || "$RECOMMENDATION" == "" ]]; then - echo "$pkg: skipped (no changes)" - else - CRATES_TO_RELEASE+=("$pkg") - BUMP_LEVELS+=("$RECOMMENDATION") - echo "$pkg: $RECOMMENDATION" - fi -done - -echo "" - -if [ ${#CRATES_TO_RELEASE[@]} -eq 0 ]; then - echo "No program-libs crates have changes. Nothing to release." - exit 0 -fi - -echo "=========================================" -echo "Program Libs Release Plan:" -echo "=========================================" -for i in "${!CRATES_TO_RELEASE[@]}"; do - echo " ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]}" -done -echo "=========================================" -echo "" -read -p "Proceed with these version bumps? (y/N) " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]]; then - echo "Release cancelled." - exit 1 -fi - -# Create release branch -TIMESTAMP=$(date +%Y%m%d-%H%M%S) -BRANCH_NAME="release/program-libs-${TIMESTAMP}" - -echo "" -echo "Creating release branch: $BRANCH_NAME" -git checkout -b "$BRANCH_NAME" - -echo "" -echo "Bumping versions..." -echo "" - -# Bump each crate individually with its detected level -for i in "${!CRATES_TO_RELEASE[@]}"; do - pkg="${CRATES_TO_RELEASE[$i]}" - level="${BUMP_LEVELS[$i]}" - echo "Bumping $pkg: $level" - cargo release version "$level" -p "$pkg" --execute --no-confirm -done - -echo "" -echo "Versions bumped successfully!" -echo "" - -# Commit changes -git add -A -git commit -m "chore(program-libs): bump versions" - -# Push branch -echo "Pushing branch to origin..." -git push -u origin "$BRANCH_NAME" - -# Create PR body -PR_BODY="## Program Libs Release - -This PR bumps versions for program-libs crates based on conventional commits. - -**Version bumps:** -" - -for i in "${!CRATES_TO_RELEASE[@]}"; do - PR_BODY="${PR_BODY}- ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]} -" -done - -PR_BODY="${PR_BODY} -### Release Process -1. Versions bumped in Cargo.toml files -2. PR validation (dry-run) will run automatically -3. After merge, GitHub Action will publish each crate individually to crates.io and create releases - ---- -*Generated by \`scripts/release-program-libs.sh\`*" - -echo "" -echo "Creating pull request..." -gh pr create \ - --title "chore(program-libs): Bump versions" \ - --body "$PR_BODY" \ - --label "release" - -echo "" -echo "Pull request created!" -echo "" -echo "Next steps:" -echo "1. Wait for PR checks to pass (dry-run validation)" -echo "2. Review and merge the PR" -echo "3. GitHub Action will automatically publish to crates.io and create releases" diff --git a/scripts/release-sdk-libs.sh b/scripts/release-sdk-libs.sh deleted file mode 100755 index dc9c271a67..0000000000 --- a/scripts/release-sdk-libs.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Bump versions for sdk-libs crates and create PR -# Usage: ./scripts/release-sdk-libs.sh -# -# Automatically detects the appropriate version bump level for each crate -# based on conventional commits since the last release - -SDK_LIBS=( - "light-client" - "light-sdk-macros" - "light-sdk" - "light-sdk-pinocchio" - "light-sdk-types" - "photon-api" - "light-program-test" -) - -echo "Analyzing changes for sdk-libs crates..." -echo "" - -# Get change recommendations from cargo-release -CHANGES_OUTPUT=$(cargo release changes 2>&1 || true) - -# Parse recommendations for each crate -CRATES_TO_RELEASE=() -BUMP_LEVELS=() - -for pkg in "${SDK_LIBS[@]}"; do - RECOMMENDATION=$(echo "$CHANGES_OUTPUT" | grep "cargo release version -p $pkg" | sed -n "s/.*-p $pkg \([^ ]*\).*/\1/p" || echo "") - - if [[ -z "$RECOMMENDATION" || "$RECOMMENDATION" == "" ]]; then - echo "$pkg: skipped (no changes)" - else - CRATES_TO_RELEASE+=("$pkg") - BUMP_LEVELS+=("$RECOMMENDATION") - echo "$pkg: $RECOMMENDATION" - fi -done - -echo "" - -if [ ${#CRATES_TO_RELEASE[@]} -eq 0 ]; then - echo "No sdk-libs crates have changes. Nothing to release." - exit 0 -fi - -echo "=========================================" -echo "SDK Libs Release Plan:" -echo "=========================================" -for i in "${!CRATES_TO_RELEASE[@]}"; do - echo " ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]}" -done -echo "=========================================" -echo "" -read -p "Proceed with these version bumps? (y/N) " -n 1 -r -echo -if [[ ! $REPLY =~ ^[Yy]$ ]]; then - echo "Release cancelled." - exit 1 -fi - -# Create release branch -TIMESTAMP=$(date +%Y%m%d-%H%M%S) -BRANCH_NAME="release/sdk-libs-${TIMESTAMP}" - -echo "" -echo "Creating release branch: $BRANCH_NAME" -git checkout -b "$BRANCH_NAME" - -echo "" -echo "Bumping versions..." -echo "" - -# Bump each crate individually with its detected level -for i in "${!CRATES_TO_RELEASE[@]}"; do - pkg="${CRATES_TO_RELEASE[$i]}" - level="${BUMP_LEVELS[$i]}" - echo "Bumping $pkg: $level" - cargo release version "$level" -p "$pkg" --execute --no-confirm -done - -echo "" -echo "Versions bumped successfully!" -echo "" - -# Commit changes -git add -A -git commit -m "chore(sdk-libs): bump versions" - -# Push branch -echo "Pushing branch to origin..." -git push -u origin "$BRANCH_NAME" - -# Create PR body -PR_BODY="## SDK Libs Release - -This PR bumps versions for sdk-libs crates based on conventional commits. - -**Version bumps:** -" - -for i in "${!CRATES_TO_RELEASE[@]}"; do - PR_BODY="${PR_BODY}- ${CRATES_TO_RELEASE[$i]}: ${BUMP_LEVELS[$i]} -" -done - -PR_BODY="${PR_BODY} -### Release Process -1. Versions bumped in Cargo.toml files -2. PR validation (dry-run) will run automatically -3. After merge, GitHub Action will publish each crate individually to crates.io and create releases - ---- -*Generated by \`scripts/release-sdk-libs.sh\`*" - -echo "" -echo "Creating pull request..." -gh pr create \ - --title "chore(sdk-libs): Bump versions" \ - --body "$PR_BODY" \ - --label "release" - -echo "" -echo "Pull request created!" -echo "" -echo "Next steps:" -echo "1. Wait for PR checks to pass (dry-run validation)" -echo "2. Review and merge the PR" -echo "3. GitHub Action will automatically publish to crates.io and create releases" From a7ff06dd166778cd97f5775fd2d76ae1a913bd18 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 6 Oct 2025 18:46:12 +0100 Subject: [PATCH 4/6] move light-zero-copy-derive tests to light-zero-copy --- Cargo.lock | 11 +- Cargo.toml | 2 +- anchor-programs/system/Cargo.toml | 1 + forester-utils/Cargo.toml | 1 + forester/Cargo.toml | 1 + program-libs/zero-copy-derive/Cargo.toml | 6 +- program-libs/zero-copy/Cargo.toml | 2 + .../tests/derive}/instruction_data.rs | 2 +- program-libs/zero-copy/tests/derive/main.rs | 5 + .../tests/derive}/random.rs | 2 +- .../tests => zero-copy/tests/derive}/ui.rs | 8 +- .../tests/derive}/ui/fail/01_empty_struct.rs | 0 .../derive}/ui/fail/01_empty_struct.stderr | 0 .../tests/derive}/ui/fail/07_tuple_struct.rs | 0 .../derive}/ui/fail/07_tuple_struct.stderr | 0 .../derive}/ui/fail/08_newtype_pattern.rs | 0 .../derive}/ui/fail/08_newtype_pattern.stderr | 0 .../derive}/ui/fail/47_tuple_struct_empty.rs | 0 .../ui/fail/47_tuple_struct_empty.stderr | 0 .../derive}/ui/fail/48_tuple_single_field.rs | 0 .../ui/fail/48_tuple_single_field.stderr | 0 .../ui/fail/54_floating_point_types.rs | 0 .../ui/fail/54_floating_point_types.stderr | 0 .../derive}/ui/fail/55_usize_isize_types.rs | 0 .../ui/fail/55_usize_isize_types.stderr | 0 .../derive}/ui/fail/58_array_of_options.rs | 0 .../ui/fail/58_array_of_options.stderr | 0 .../tests/derive}/ui/fail/67_char_type.rs | 0 .../tests/derive}/ui/fail/67_char_type.stderr | 0 .../tests/derive}/ui/fail/missing_repr_c.rs | 0 .../derive}/ui/fail/missing_repr_c.stderr | 0 .../derive}/ui/fail/unsupported_field_type.rs | 0 .../ui/fail/unsupported_field_type.stderr | 0 .../ui/fail/unsupported_tuple_struct.rs | 0 .../ui/fail/unsupported_tuple_struct.stderr | 0 .../derive}/ui/fail/unsupported_union.rs | 0 .../derive}/ui/fail/unsupported_union.stderr | 0 .../derive}/ui/fail_mut/missing_repr_c_mut.rs | 0 .../ui/fail_mut/missing_repr_c_mut.stderr | 2 +- .../derive}/ui/pass/02_single_u8_field.rs | 0 .../derive}/ui/pass/03_all_primitives.rs | 0 .../tests/derive}/ui/pass/04_nested_vecs.rs | 0 .../derive}/ui/pass/05_nested_options.rs | 0 .../tests/derive}/ui/pass/06_array_fields.rs | 0 .../derive}/ui/pass/09_enum_unit_variants.rs | 0 .../derive}/ui/pass/10_enum_mixed_variants.rs | 0 .../tests/derive}/ui/pass/11_pubkey_fields.rs | 0 .../derive}/ui/pass/12_mixed_visibility.rs | 0 .../tests/derive}/ui/pass/13_large_struct.rs | 0 .../tests/derive}/ui/pass/14_vec_of_arrays.rs | 0 .../tests/derive}/ui/pass/15_option_vec.rs | 0 .../tests/derive}/ui/pass/16_bool_fields.rs | 0 .../derive}/ui/pass/17_signed_integers.rs | 0 .../derive}/ui/pass/18_zero_sized_arrays.rs | 0 .../derive}/ui/pass/19_max_sized_array.rs | 0 .../ui/pass/20_nested_struct_fields.rs | 0 .../derive}/ui/pass/21_enum_single_variant.rs | 0 .../derive}/ui/pass/22_primitive_after_vec.rs | 0 .../ui/pass/23_multiple_options_after_vec.rs | 0 .../derive}/ui/pass/24_vec_option_vec.rs | 0 .../tests/derive}/ui/pass/25_all_optional.rs | 0 .../tests/derive}/ui/pass/26_deep_nesting.rs | 0 .../tests/derive}/ui/pass/27_mixed_arrays.rs | 0 .../derive}/ui/pass/28_field_named_data.rs | 0 .../derive}/ui/pass/29_field_named_bytes.rs | 0 .../derive}/ui/pass/30_underscore_fields.rs | 0 .../ui/pass/31_numeric_suffix_fields.rs | 0 .../derive}/ui/pass/32_camel_case_fields.rs | 0 .../ui/pass/33_single_letter_fields.rs | 0 .../tests/derive}/ui/pass/34_vec_of_bools.rs | 0 .../tests/derive}/ui/pass/35_option_bool.rs | 0 .../derive}/ui/pass/36_array_of_bools.rs | 0 .../ui/pass/37_meta_boundary_primitive.rs | 0 .../ui/pass/38_meta_boundary_option.rs | 0 .../derive}/ui/pass/39_enum_with_array.rs | 0 .../ui/pass/40_enum_discriminant_order.rs | 0 .../ui/pass/41_struct_with_lifetime_name.rs | 0 .../derive}/ui/pass/42_reserved_keywords.rs | 0 .../derive}/ui/pass/43_alternating_types.rs | 0 .../tests/derive}/ui/pass/44_all_vecs.rs | 0 .../tests/derive}/ui/pass/45_single_vec.rs | 0 .../tests/derive}/ui/pass/46_single_option.rs | 0 .../derive}/ui/pass/49_max_meta_fields.rs | 0 .../ui/pass/50_combination_all_features.rs | 0 .../derive}/ui/pass/51_deep_nested_structs.rs | 0 .../ui/pass/52_enum_containing_struct.rs | 0 .../derive}/ui/pass/53_enum_containing_vec.rs | 0 .../tests/derive}/ui/pass/56_all_derives.rs | 0 .../derive}/ui/pass/57_option_of_array.rs | 0 .../derive}/ui/pass/59_vec_of_options.rs | 0 .../tests/derive}/ui/pass/60_option_pubkey.rs | 0 .../tests/derive}/ui/pass/61_vec_pubkey.rs | 0 .../tests/derive}/ui/pass/62_array_pubkey.rs | 0 .../tests/derive}/ui/pass/63_arrays_only.rs | 0 .../derive}/ui/pass/64_option_first_field.rs | 0 .../tests/derive}/ui/pass/65_vec_of_vec.rs | 0 .../ui/pass/66_triple_nested_option.rs | 0 .../ui/pass/68_enum_containing_option.rs | 0 .../ui/pass/69_very_long_field_names.rs | 0 .../ui/pass/70_rust_type_field_names.rs | 0 .../tests/derive}/ui/pass/basic_enum.rs | 0 .../tests/derive}/ui/pass/basic_struct.rs | 0 .../tests/derive}/ui/pass/complex_enum.rs | 0 .../tests/derive}/ui/pass/readme.md | 0 .../derive}/ui/pass/repr_c_packed_test.rs | 0 .../tests/derive}/ui/pass/with_arrays.rs | 0 .../tests/derive}/ui/pass/with_options.rs | 0 .../tests/derive}/ui/pass/with_pubkey.rs | 0 .../tests/derive}/ui/pass/with_vectors.rs | 0 .../tests/derive}/ui/pass_mut/basic_mut.rs | 0 .../tests/derive}/ui/pass_mut/complex_mut.rs | 0 .../account-compression-test/Cargo.toml | 1 + .../batched-merkle-tree-test/Cargo.toml | 1 + .../batched-merkle-tree-test/src/lib.rs | 1 + .../compressed-token-test/Cargo.toml | 1 + .../create-address-test-program/Cargo.toml | 1 + program-tests/e2e-test/Cargo.toml | 1 + program-tests/registry-test/Cargo.toml | 1 + program-tests/system-cpi-test/Cargo.toml | 1 + program-tests/system-cpi-v2-test/Cargo.toml | 1 + program-tests/system-test/Cargo.toml | 1 + program-tests/utils/Cargo.toml | 1 + programs/account-compression/Cargo.toml | 1 + programs/compressed-token/Cargo.toml | 1 + programs/registry/Cargo.toml | 1 + programs/system/Cargo.toml | 1 + scripts/create-release-pr.sh | 117 ++++++++++++++++-- sdk-tests/client-test/Cargo.toml | 1 + .../programs/sdk-anchor-test/Cargo.toml | 1 + sdk-tests/sdk-native-test/Cargo.toml | 1 + sdk-tests/sdk-pinocchio-v1-test/Cargo.toml | 1 + sdk-tests/sdk-pinocchio-v2-test/Cargo.toml | 1 + sdk-tests/sdk-v1-native-test/Cargo.toml | 1 + sparse-merkle-tree/Cargo.toml | 1 + xtask/Cargo.toml | 1 + 135 files changed, 154 insertions(+), 29 deletions(-) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/instruction_data.rs (100%) create mode 100644 program-libs/zero-copy/tests/derive/main.rs rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/random.rs (99%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui.rs (68%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/01_empty_struct.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/01_empty_struct.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/07_tuple_struct.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/07_tuple_struct.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/08_newtype_pattern.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/08_newtype_pattern.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/47_tuple_struct_empty.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/47_tuple_struct_empty.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/48_tuple_single_field.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/48_tuple_single_field.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/54_floating_point_types.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/54_floating_point_types.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/55_usize_isize_types.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/55_usize_isize_types.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/58_array_of_options.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/58_array_of_options.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/67_char_type.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/67_char_type.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/missing_repr_c.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/missing_repr_c.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/unsupported_field_type.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/unsupported_field_type.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/unsupported_tuple_struct.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/unsupported_tuple_struct.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/unsupported_union.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail/unsupported_union.stderr (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail_mut/missing_repr_c_mut.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/fail_mut/missing_repr_c_mut.stderr (84%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/02_single_u8_field.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/03_all_primitives.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/04_nested_vecs.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/05_nested_options.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/06_array_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/09_enum_unit_variants.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/10_enum_mixed_variants.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/11_pubkey_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/12_mixed_visibility.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/13_large_struct.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/14_vec_of_arrays.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/15_option_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/16_bool_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/17_signed_integers.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/18_zero_sized_arrays.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/19_max_sized_array.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/20_nested_struct_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/21_enum_single_variant.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/22_primitive_after_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/23_multiple_options_after_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/24_vec_option_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/25_all_optional.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/26_deep_nesting.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/27_mixed_arrays.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/28_field_named_data.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/29_field_named_bytes.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/30_underscore_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/31_numeric_suffix_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/32_camel_case_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/33_single_letter_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/34_vec_of_bools.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/35_option_bool.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/36_array_of_bools.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/37_meta_boundary_primitive.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/38_meta_boundary_option.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/39_enum_with_array.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/40_enum_discriminant_order.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/41_struct_with_lifetime_name.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/42_reserved_keywords.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/43_alternating_types.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/44_all_vecs.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/45_single_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/46_single_option.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/49_max_meta_fields.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/50_combination_all_features.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/51_deep_nested_structs.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/52_enum_containing_struct.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/53_enum_containing_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/56_all_derives.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/57_option_of_array.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/59_vec_of_options.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/60_option_pubkey.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/61_vec_pubkey.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/62_array_pubkey.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/63_arrays_only.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/64_option_first_field.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/65_vec_of_vec.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/66_triple_nested_option.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/68_enum_containing_option.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/69_very_long_field_names.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/70_rust_type_field_names.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/basic_enum.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/basic_struct.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/complex_enum.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/readme.md (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/repr_c_packed_test.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/with_arrays.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/with_options.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/with_pubkey.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass/with_vectors.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass_mut/basic_mut.rs (100%) rename program-libs/{zero-copy-derive/tests => zero-copy/tests/derive}/ui/pass_mut/complex_mut.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index cfa9571078..7301e7d6f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3680,7 +3680,8 @@ dependencies = [ [[package]] name = "light-profiler-macro" version = "0.1.0" -source = "git+https://github.com/Lightprotocol/light-program-profiler?rev=36a75e14f54dd862bf2f338c97435ffc7e3e8de9#36a75e14f54dd862bf2f338c97435ffc7e3e8de9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea8e975b7151078d0ce470657b2cc5546d8dab75ad0fe8c62c5ac5b980eb6735" dependencies = [ "proc-macro2", "quote", @@ -3690,7 +3691,8 @@ dependencies = [ [[package]] name = "light-program-profiler" version = "0.1.0" -source = "git+https://github.com/Lightprotocol/light-program-profiler?rev=36a75e14f54dd862bf2f338c97435ffc7e3e8de9#36a75e14f54dd862bf2f338c97435ffc7e3e8de9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d6510198436b28f85a5995c6ccfff8ad58bbc5985e8d60cc5ea9702d4e52d2" dependencies = [ "light-profiler-macro", ] @@ -3973,6 +3975,7 @@ dependencies = [ "pinocchio", "rand 0.8.5", "solana-program-error", + "trybuild", "zerocopy", ] @@ -3980,15 +3983,11 @@ dependencies = [ name = "light-zero-copy-derive" version = "0.3.0" dependencies = [ - "borsh 0.10.4", "lazy_static", - "light-zero-copy", "proc-macro2", "quote", "rand 0.8.5", "syn 2.0.106", - "trybuild", - "zerocopy", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b90591431c..f4c750c3db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -200,7 +200,7 @@ light-bounded-vec = { version = "2.0.0" } light-poseidon = { version = "0.3.0" } light-test-utils = { path = "program-tests/utils", version = "1.2.1" } light-indexed-array = { path = "program-libs/indexed-array", version = "0.1.0" } -light-program-profiler = { git = "https://github.com/Lightprotocol/light-program-profiler", rev = "36a75e14f54dd862bf2f338c97435ffc7e3e8de9", version = "0.1.0" } +light-program-profiler = { version = "0.1.0" } create-address-program-test = { path = "program-tests/create-address-test-program", version = "1.0.0" } groth16-solana = { version = "0.2.0" } bytemuck = { version = "1.19.0" } diff --git a/anchor-programs/system/Cargo.toml b/anchor-programs/system/Cargo.toml index 3519fd65a1..fedfdba10b 100644 --- a/anchor-programs/system/Cargo.toml +++ b/anchor-programs/system/Cargo.toml @@ -5,6 +5,7 @@ description = "ZK Compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/forester-utils/Cargo.toml b/forester-utils/Cargo.toml index cc7e1af82c..8f9ca48d9f 100644 --- a/forester-utils/Cargo.toml +++ b/forester-utils/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" license = "Apache-2.0" repository = "https://github.com/lightprotocol/light-protocol" description = "Utility library for Light's Forester node implementation" +publish = false [features] default = ["v2"] diff --git a/forester/Cargo.toml b/forester/Cargo.toml index 79601efe11..7d0a390285 100644 --- a/forester/Cargo.toml +++ b/forester/Cargo.toml @@ -2,6 +2,7 @@ name = "forester" version = "1.1.0" edition = "2021" +publish = false [dependencies] anchor-lang = { workspace = true } diff --git a/program-libs/zero-copy-derive/Cargo.toml b/program-libs/zero-copy-derive/Cargo.toml index b3580549dd..ca5248e12b 100644 --- a/program-libs/zero-copy-derive/Cargo.toml +++ b/program-libs/zero-copy-derive/Cargo.toml @@ -19,8 +19,4 @@ syn = { version = "2.0", features = ["full", "extra-traits"] } lazy_static = "1.4" [dev-dependencies] -trybuild = "1.0" -rand = "0.8" -borsh = { workspace = true } -light-zero-copy = { workspace = true, features = ["std", "derive"] } -zerocopy = { workspace = true, features = ["derive"] } +rand = { workspace = true } diff --git a/program-libs/zero-copy/Cargo.toml b/program-libs/zero-copy/Cargo.toml index bb1c88738d..ba1ceb2691 100644 --- a/program-libs/zero-copy/Cargo.toml +++ b/program-libs/zero-copy/Cargo.toml @@ -24,3 +24,5 @@ light-zero-copy-derive = { workspace = true, optional = true } rand = { workspace = true } zerocopy = { workspace = true, features = ["derive"] } borsh = { workspace = true } +trybuild = "1.0" +light-zero-copy-derive = { workspace = true } diff --git a/program-libs/zero-copy-derive/tests/instruction_data.rs b/program-libs/zero-copy/tests/derive/instruction_data.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/instruction_data.rs rename to program-libs/zero-copy/tests/derive/instruction_data.rs index e2a1be8926..9ad02cef54 100644 --- a/program-libs/zero-copy-derive/tests/instruction_data.rs +++ b/program-libs/zero-copy/tests/derive/instruction_data.rs @@ -15,13 +15,13 @@ use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout, Ref, Unaligned}; Copy, PartialEq, Clone, + Default, Immutable, FromBytes, IntoBytes, KnownLayout, BorshDeserialize, BorshSerialize, - Default, Unaligned, )] #[repr(C)] diff --git a/program-libs/zero-copy/tests/derive/main.rs b/program-libs/zero-copy/tests/derive/main.rs new file mode 100644 index 0000000000..597d5b4da1 --- /dev/null +++ b/program-libs/zero-copy/tests/derive/main.rs @@ -0,0 +1,5 @@ +#![cfg(feature = "mut")] + +pub mod instruction_data; +mod random; +mod ui; diff --git a/program-libs/zero-copy-derive/tests/random.rs b/program-libs/zero-copy/tests/derive/random.rs similarity index 99% rename from program-libs/zero-copy-derive/tests/random.rs rename to program-libs/zero-copy/tests/derive/random.rs index 41bfcc01fb..187eece048 100644 --- a/program-libs/zero-copy-derive/tests/random.rs +++ b/program-libs/zero-copy/tests/derive/random.rs @@ -9,7 +9,7 @@ use rand::{ Rng, }; -mod instruction_data; +use super::instruction_data; use instruction_data::{ CompressedAccount, CompressedAccountConfig, diff --git a/program-libs/zero-copy-derive/tests/ui.rs b/program-libs/zero-copy/tests/derive/ui.rs similarity index 68% rename from program-libs/zero-copy-derive/tests/ui.rs rename to program-libs/zero-copy/tests/derive/ui.rs index 473ff1aa0d..028701a7e4 100644 --- a/program-libs/zero-copy-derive/tests/ui.rs +++ b/program-libs/zero-copy/tests/derive/ui.rs @@ -6,10 +6,10 @@ fn ui_tests() { let t = trybuild::TestCases::new(); // Test cases that should compile successfully - t.pass("tests/ui/pass/*.rs"); + t.pass("tests/derive/ui/pass/*.rs"); // Test cases that should fail compilation with helpful error messages - //t.compile_fail("tests/ui/fail/*.rs"); + //t.compile_fail("tests/derive/ui/fail/*.rs"); } #[test] @@ -17,6 +17,6 @@ fn ui_tests_zerocopy_mut() { let t = trybuild::TestCases::new(); // Test ZeroCopyMut-specific cases - t.pass("tests/ui/pass_mut/*.rs"); - t.compile_fail("tests/ui/fail_mut/*.rs"); + t.pass("tests/derive/ui/pass_mut/*.rs"); + t.compile_fail("tests/derive/ui/fail_mut/*.rs"); } diff --git a/program-libs/zero-copy-derive/tests/ui/fail/01_empty_struct.rs b/program-libs/zero-copy/tests/derive/ui/fail/01_empty_struct.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/01_empty_struct.rs rename to program-libs/zero-copy/tests/derive/ui/fail/01_empty_struct.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/01_empty_struct.stderr b/program-libs/zero-copy/tests/derive/ui/fail/01_empty_struct.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/01_empty_struct.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/01_empty_struct.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/07_tuple_struct.rs b/program-libs/zero-copy/tests/derive/ui/fail/07_tuple_struct.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/07_tuple_struct.rs rename to program-libs/zero-copy/tests/derive/ui/fail/07_tuple_struct.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/07_tuple_struct.stderr b/program-libs/zero-copy/tests/derive/ui/fail/07_tuple_struct.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/07_tuple_struct.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/07_tuple_struct.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/08_newtype_pattern.rs b/program-libs/zero-copy/tests/derive/ui/fail/08_newtype_pattern.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/08_newtype_pattern.rs rename to program-libs/zero-copy/tests/derive/ui/fail/08_newtype_pattern.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/08_newtype_pattern.stderr b/program-libs/zero-copy/tests/derive/ui/fail/08_newtype_pattern.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/08_newtype_pattern.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/08_newtype_pattern.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/47_tuple_struct_empty.rs b/program-libs/zero-copy/tests/derive/ui/fail/47_tuple_struct_empty.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/47_tuple_struct_empty.rs rename to program-libs/zero-copy/tests/derive/ui/fail/47_tuple_struct_empty.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/47_tuple_struct_empty.stderr b/program-libs/zero-copy/tests/derive/ui/fail/47_tuple_struct_empty.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/47_tuple_struct_empty.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/47_tuple_struct_empty.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/48_tuple_single_field.rs b/program-libs/zero-copy/tests/derive/ui/fail/48_tuple_single_field.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/48_tuple_single_field.rs rename to program-libs/zero-copy/tests/derive/ui/fail/48_tuple_single_field.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/48_tuple_single_field.stderr b/program-libs/zero-copy/tests/derive/ui/fail/48_tuple_single_field.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/48_tuple_single_field.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/48_tuple_single_field.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/54_floating_point_types.rs b/program-libs/zero-copy/tests/derive/ui/fail/54_floating_point_types.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/54_floating_point_types.rs rename to program-libs/zero-copy/tests/derive/ui/fail/54_floating_point_types.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/54_floating_point_types.stderr b/program-libs/zero-copy/tests/derive/ui/fail/54_floating_point_types.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/54_floating_point_types.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/54_floating_point_types.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/55_usize_isize_types.rs b/program-libs/zero-copy/tests/derive/ui/fail/55_usize_isize_types.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/55_usize_isize_types.rs rename to program-libs/zero-copy/tests/derive/ui/fail/55_usize_isize_types.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/55_usize_isize_types.stderr b/program-libs/zero-copy/tests/derive/ui/fail/55_usize_isize_types.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/55_usize_isize_types.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/55_usize_isize_types.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/58_array_of_options.rs b/program-libs/zero-copy/tests/derive/ui/fail/58_array_of_options.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/58_array_of_options.rs rename to program-libs/zero-copy/tests/derive/ui/fail/58_array_of_options.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/58_array_of_options.stderr b/program-libs/zero-copy/tests/derive/ui/fail/58_array_of_options.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/58_array_of_options.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/58_array_of_options.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/67_char_type.rs b/program-libs/zero-copy/tests/derive/ui/fail/67_char_type.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/67_char_type.rs rename to program-libs/zero-copy/tests/derive/ui/fail/67_char_type.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/67_char_type.stderr b/program-libs/zero-copy/tests/derive/ui/fail/67_char_type.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/67_char_type.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/67_char_type.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/missing_repr_c.rs b/program-libs/zero-copy/tests/derive/ui/fail/missing_repr_c.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/missing_repr_c.rs rename to program-libs/zero-copy/tests/derive/ui/fail/missing_repr_c.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/missing_repr_c.stderr b/program-libs/zero-copy/tests/derive/ui/fail/missing_repr_c.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/missing_repr_c.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/missing_repr_c.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/unsupported_field_type.rs b/program-libs/zero-copy/tests/derive/ui/fail/unsupported_field_type.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/unsupported_field_type.rs rename to program-libs/zero-copy/tests/derive/ui/fail/unsupported_field_type.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/unsupported_field_type.stderr b/program-libs/zero-copy/tests/derive/ui/fail/unsupported_field_type.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/unsupported_field_type.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/unsupported_field_type.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/unsupported_tuple_struct.rs b/program-libs/zero-copy/tests/derive/ui/fail/unsupported_tuple_struct.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/unsupported_tuple_struct.rs rename to program-libs/zero-copy/tests/derive/ui/fail/unsupported_tuple_struct.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/unsupported_tuple_struct.stderr b/program-libs/zero-copy/tests/derive/ui/fail/unsupported_tuple_struct.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/unsupported_tuple_struct.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/unsupported_tuple_struct.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail/unsupported_union.rs b/program-libs/zero-copy/tests/derive/ui/fail/unsupported_union.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/unsupported_union.rs rename to program-libs/zero-copy/tests/derive/ui/fail/unsupported_union.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail/unsupported_union.stderr b/program-libs/zero-copy/tests/derive/ui/fail/unsupported_union.stderr similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail/unsupported_union.stderr rename to program-libs/zero-copy/tests/derive/ui/fail/unsupported_union.stderr diff --git a/program-libs/zero-copy-derive/tests/ui/fail_mut/missing_repr_c_mut.rs b/program-libs/zero-copy/tests/derive/ui/fail_mut/missing_repr_c_mut.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/fail_mut/missing_repr_c_mut.rs rename to program-libs/zero-copy/tests/derive/ui/fail_mut/missing_repr_c_mut.rs diff --git a/program-libs/zero-copy-derive/tests/ui/fail_mut/missing_repr_c_mut.stderr b/program-libs/zero-copy/tests/derive/ui/fail_mut/missing_repr_c_mut.stderr similarity index 84% rename from program-libs/zero-copy-derive/tests/ui/fail_mut/missing_repr_c_mut.stderr rename to program-libs/zero-copy/tests/derive/ui/fail_mut/missing_repr_c_mut.stderr index e6797a2e9d..9e3381adb9 100644 --- a/program-libs/zero-copy-derive/tests/ui/fail_mut/missing_repr_c_mut.stderr +++ b/program-libs/zero-copy/tests/derive/ui/fail_mut/missing_repr_c_mut.stderr @@ -1,5 +1,5 @@ error: ZeroCopyMut requires #[repr(C)] attribute for memory layout safety. Add #[repr(C)] above the zerocopymut declaration. - --> tests/ui/fail_mut/missing_repr_c_mut.rs:4:10 + --> tests/derive/ui/fail_mut/missing_repr_c_mut.rs:4:10 | 4 | #[derive(ZeroCopyMut)] | ^^^^^^^^^^^ diff --git a/program-libs/zero-copy-derive/tests/ui/pass/02_single_u8_field.rs b/program-libs/zero-copy/tests/derive/ui/pass/02_single_u8_field.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/02_single_u8_field.rs rename to program-libs/zero-copy/tests/derive/ui/pass/02_single_u8_field.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/03_all_primitives.rs b/program-libs/zero-copy/tests/derive/ui/pass/03_all_primitives.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/03_all_primitives.rs rename to program-libs/zero-copy/tests/derive/ui/pass/03_all_primitives.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/04_nested_vecs.rs b/program-libs/zero-copy/tests/derive/ui/pass/04_nested_vecs.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/04_nested_vecs.rs rename to program-libs/zero-copy/tests/derive/ui/pass/04_nested_vecs.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/05_nested_options.rs b/program-libs/zero-copy/tests/derive/ui/pass/05_nested_options.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/05_nested_options.rs rename to program-libs/zero-copy/tests/derive/ui/pass/05_nested_options.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/06_array_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/06_array_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/06_array_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/06_array_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/09_enum_unit_variants.rs b/program-libs/zero-copy/tests/derive/ui/pass/09_enum_unit_variants.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/09_enum_unit_variants.rs rename to program-libs/zero-copy/tests/derive/ui/pass/09_enum_unit_variants.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/10_enum_mixed_variants.rs b/program-libs/zero-copy/tests/derive/ui/pass/10_enum_mixed_variants.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/10_enum_mixed_variants.rs rename to program-libs/zero-copy/tests/derive/ui/pass/10_enum_mixed_variants.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/11_pubkey_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/11_pubkey_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/11_pubkey_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/11_pubkey_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/12_mixed_visibility.rs b/program-libs/zero-copy/tests/derive/ui/pass/12_mixed_visibility.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/12_mixed_visibility.rs rename to program-libs/zero-copy/tests/derive/ui/pass/12_mixed_visibility.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/13_large_struct.rs b/program-libs/zero-copy/tests/derive/ui/pass/13_large_struct.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/13_large_struct.rs rename to program-libs/zero-copy/tests/derive/ui/pass/13_large_struct.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/14_vec_of_arrays.rs b/program-libs/zero-copy/tests/derive/ui/pass/14_vec_of_arrays.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/14_vec_of_arrays.rs rename to program-libs/zero-copy/tests/derive/ui/pass/14_vec_of_arrays.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/15_option_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/15_option_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/15_option_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/15_option_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/16_bool_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/16_bool_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/16_bool_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/16_bool_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/17_signed_integers.rs b/program-libs/zero-copy/tests/derive/ui/pass/17_signed_integers.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/17_signed_integers.rs rename to program-libs/zero-copy/tests/derive/ui/pass/17_signed_integers.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/18_zero_sized_arrays.rs b/program-libs/zero-copy/tests/derive/ui/pass/18_zero_sized_arrays.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/18_zero_sized_arrays.rs rename to program-libs/zero-copy/tests/derive/ui/pass/18_zero_sized_arrays.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/19_max_sized_array.rs b/program-libs/zero-copy/tests/derive/ui/pass/19_max_sized_array.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/19_max_sized_array.rs rename to program-libs/zero-copy/tests/derive/ui/pass/19_max_sized_array.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/20_nested_struct_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/20_nested_struct_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/20_nested_struct_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/20_nested_struct_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/21_enum_single_variant.rs b/program-libs/zero-copy/tests/derive/ui/pass/21_enum_single_variant.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/21_enum_single_variant.rs rename to program-libs/zero-copy/tests/derive/ui/pass/21_enum_single_variant.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/22_primitive_after_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/22_primitive_after_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/22_primitive_after_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/22_primitive_after_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/23_multiple_options_after_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/23_multiple_options_after_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/23_multiple_options_after_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/23_multiple_options_after_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/24_vec_option_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/24_vec_option_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/24_vec_option_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/24_vec_option_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/25_all_optional.rs b/program-libs/zero-copy/tests/derive/ui/pass/25_all_optional.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/25_all_optional.rs rename to program-libs/zero-copy/tests/derive/ui/pass/25_all_optional.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/26_deep_nesting.rs b/program-libs/zero-copy/tests/derive/ui/pass/26_deep_nesting.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/26_deep_nesting.rs rename to program-libs/zero-copy/tests/derive/ui/pass/26_deep_nesting.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/27_mixed_arrays.rs b/program-libs/zero-copy/tests/derive/ui/pass/27_mixed_arrays.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/27_mixed_arrays.rs rename to program-libs/zero-copy/tests/derive/ui/pass/27_mixed_arrays.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/28_field_named_data.rs b/program-libs/zero-copy/tests/derive/ui/pass/28_field_named_data.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/28_field_named_data.rs rename to program-libs/zero-copy/tests/derive/ui/pass/28_field_named_data.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/29_field_named_bytes.rs b/program-libs/zero-copy/tests/derive/ui/pass/29_field_named_bytes.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/29_field_named_bytes.rs rename to program-libs/zero-copy/tests/derive/ui/pass/29_field_named_bytes.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/30_underscore_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/30_underscore_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/30_underscore_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/30_underscore_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/31_numeric_suffix_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/31_numeric_suffix_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/31_numeric_suffix_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/31_numeric_suffix_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/32_camel_case_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/32_camel_case_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/32_camel_case_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/32_camel_case_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/33_single_letter_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/33_single_letter_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/33_single_letter_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/33_single_letter_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/34_vec_of_bools.rs b/program-libs/zero-copy/tests/derive/ui/pass/34_vec_of_bools.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/34_vec_of_bools.rs rename to program-libs/zero-copy/tests/derive/ui/pass/34_vec_of_bools.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/35_option_bool.rs b/program-libs/zero-copy/tests/derive/ui/pass/35_option_bool.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/35_option_bool.rs rename to program-libs/zero-copy/tests/derive/ui/pass/35_option_bool.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/36_array_of_bools.rs b/program-libs/zero-copy/tests/derive/ui/pass/36_array_of_bools.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/36_array_of_bools.rs rename to program-libs/zero-copy/tests/derive/ui/pass/36_array_of_bools.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/37_meta_boundary_primitive.rs b/program-libs/zero-copy/tests/derive/ui/pass/37_meta_boundary_primitive.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/37_meta_boundary_primitive.rs rename to program-libs/zero-copy/tests/derive/ui/pass/37_meta_boundary_primitive.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/38_meta_boundary_option.rs b/program-libs/zero-copy/tests/derive/ui/pass/38_meta_boundary_option.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/38_meta_boundary_option.rs rename to program-libs/zero-copy/tests/derive/ui/pass/38_meta_boundary_option.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/39_enum_with_array.rs b/program-libs/zero-copy/tests/derive/ui/pass/39_enum_with_array.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/39_enum_with_array.rs rename to program-libs/zero-copy/tests/derive/ui/pass/39_enum_with_array.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/40_enum_discriminant_order.rs b/program-libs/zero-copy/tests/derive/ui/pass/40_enum_discriminant_order.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/40_enum_discriminant_order.rs rename to program-libs/zero-copy/tests/derive/ui/pass/40_enum_discriminant_order.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/41_struct_with_lifetime_name.rs b/program-libs/zero-copy/tests/derive/ui/pass/41_struct_with_lifetime_name.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/41_struct_with_lifetime_name.rs rename to program-libs/zero-copy/tests/derive/ui/pass/41_struct_with_lifetime_name.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/42_reserved_keywords.rs b/program-libs/zero-copy/tests/derive/ui/pass/42_reserved_keywords.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/42_reserved_keywords.rs rename to program-libs/zero-copy/tests/derive/ui/pass/42_reserved_keywords.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/43_alternating_types.rs b/program-libs/zero-copy/tests/derive/ui/pass/43_alternating_types.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/43_alternating_types.rs rename to program-libs/zero-copy/tests/derive/ui/pass/43_alternating_types.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/44_all_vecs.rs b/program-libs/zero-copy/tests/derive/ui/pass/44_all_vecs.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/44_all_vecs.rs rename to program-libs/zero-copy/tests/derive/ui/pass/44_all_vecs.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/45_single_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/45_single_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/45_single_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/45_single_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/46_single_option.rs b/program-libs/zero-copy/tests/derive/ui/pass/46_single_option.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/46_single_option.rs rename to program-libs/zero-copy/tests/derive/ui/pass/46_single_option.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/49_max_meta_fields.rs b/program-libs/zero-copy/tests/derive/ui/pass/49_max_meta_fields.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/49_max_meta_fields.rs rename to program-libs/zero-copy/tests/derive/ui/pass/49_max_meta_fields.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/50_combination_all_features.rs b/program-libs/zero-copy/tests/derive/ui/pass/50_combination_all_features.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/50_combination_all_features.rs rename to program-libs/zero-copy/tests/derive/ui/pass/50_combination_all_features.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/51_deep_nested_structs.rs b/program-libs/zero-copy/tests/derive/ui/pass/51_deep_nested_structs.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/51_deep_nested_structs.rs rename to program-libs/zero-copy/tests/derive/ui/pass/51_deep_nested_structs.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/52_enum_containing_struct.rs b/program-libs/zero-copy/tests/derive/ui/pass/52_enum_containing_struct.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/52_enum_containing_struct.rs rename to program-libs/zero-copy/tests/derive/ui/pass/52_enum_containing_struct.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/53_enum_containing_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/53_enum_containing_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/53_enum_containing_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/53_enum_containing_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/56_all_derives.rs b/program-libs/zero-copy/tests/derive/ui/pass/56_all_derives.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/56_all_derives.rs rename to program-libs/zero-copy/tests/derive/ui/pass/56_all_derives.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/57_option_of_array.rs b/program-libs/zero-copy/tests/derive/ui/pass/57_option_of_array.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/57_option_of_array.rs rename to program-libs/zero-copy/tests/derive/ui/pass/57_option_of_array.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/59_vec_of_options.rs b/program-libs/zero-copy/tests/derive/ui/pass/59_vec_of_options.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/59_vec_of_options.rs rename to program-libs/zero-copy/tests/derive/ui/pass/59_vec_of_options.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/60_option_pubkey.rs b/program-libs/zero-copy/tests/derive/ui/pass/60_option_pubkey.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/60_option_pubkey.rs rename to program-libs/zero-copy/tests/derive/ui/pass/60_option_pubkey.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/61_vec_pubkey.rs b/program-libs/zero-copy/tests/derive/ui/pass/61_vec_pubkey.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/61_vec_pubkey.rs rename to program-libs/zero-copy/tests/derive/ui/pass/61_vec_pubkey.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/62_array_pubkey.rs b/program-libs/zero-copy/tests/derive/ui/pass/62_array_pubkey.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/62_array_pubkey.rs rename to program-libs/zero-copy/tests/derive/ui/pass/62_array_pubkey.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/63_arrays_only.rs b/program-libs/zero-copy/tests/derive/ui/pass/63_arrays_only.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/63_arrays_only.rs rename to program-libs/zero-copy/tests/derive/ui/pass/63_arrays_only.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/64_option_first_field.rs b/program-libs/zero-copy/tests/derive/ui/pass/64_option_first_field.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/64_option_first_field.rs rename to program-libs/zero-copy/tests/derive/ui/pass/64_option_first_field.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/65_vec_of_vec.rs b/program-libs/zero-copy/tests/derive/ui/pass/65_vec_of_vec.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/65_vec_of_vec.rs rename to program-libs/zero-copy/tests/derive/ui/pass/65_vec_of_vec.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/66_triple_nested_option.rs b/program-libs/zero-copy/tests/derive/ui/pass/66_triple_nested_option.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/66_triple_nested_option.rs rename to program-libs/zero-copy/tests/derive/ui/pass/66_triple_nested_option.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/68_enum_containing_option.rs b/program-libs/zero-copy/tests/derive/ui/pass/68_enum_containing_option.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/68_enum_containing_option.rs rename to program-libs/zero-copy/tests/derive/ui/pass/68_enum_containing_option.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/69_very_long_field_names.rs b/program-libs/zero-copy/tests/derive/ui/pass/69_very_long_field_names.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/69_very_long_field_names.rs rename to program-libs/zero-copy/tests/derive/ui/pass/69_very_long_field_names.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/70_rust_type_field_names.rs b/program-libs/zero-copy/tests/derive/ui/pass/70_rust_type_field_names.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/70_rust_type_field_names.rs rename to program-libs/zero-copy/tests/derive/ui/pass/70_rust_type_field_names.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/basic_enum.rs b/program-libs/zero-copy/tests/derive/ui/pass/basic_enum.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/basic_enum.rs rename to program-libs/zero-copy/tests/derive/ui/pass/basic_enum.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/basic_struct.rs b/program-libs/zero-copy/tests/derive/ui/pass/basic_struct.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/basic_struct.rs rename to program-libs/zero-copy/tests/derive/ui/pass/basic_struct.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/complex_enum.rs b/program-libs/zero-copy/tests/derive/ui/pass/complex_enum.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/complex_enum.rs rename to program-libs/zero-copy/tests/derive/ui/pass/complex_enum.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/readme.md b/program-libs/zero-copy/tests/derive/ui/pass/readme.md similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/readme.md rename to program-libs/zero-copy/tests/derive/ui/pass/readme.md diff --git a/program-libs/zero-copy-derive/tests/ui/pass/repr_c_packed_test.rs b/program-libs/zero-copy/tests/derive/ui/pass/repr_c_packed_test.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/repr_c_packed_test.rs rename to program-libs/zero-copy/tests/derive/ui/pass/repr_c_packed_test.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/with_arrays.rs b/program-libs/zero-copy/tests/derive/ui/pass/with_arrays.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/with_arrays.rs rename to program-libs/zero-copy/tests/derive/ui/pass/with_arrays.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/with_options.rs b/program-libs/zero-copy/tests/derive/ui/pass/with_options.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/with_options.rs rename to program-libs/zero-copy/tests/derive/ui/pass/with_options.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/with_pubkey.rs b/program-libs/zero-copy/tests/derive/ui/pass/with_pubkey.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/with_pubkey.rs rename to program-libs/zero-copy/tests/derive/ui/pass/with_pubkey.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass/with_vectors.rs b/program-libs/zero-copy/tests/derive/ui/pass/with_vectors.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass/with_vectors.rs rename to program-libs/zero-copy/tests/derive/ui/pass/with_vectors.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass_mut/basic_mut.rs b/program-libs/zero-copy/tests/derive/ui/pass_mut/basic_mut.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass_mut/basic_mut.rs rename to program-libs/zero-copy/tests/derive/ui/pass_mut/basic_mut.rs diff --git a/program-libs/zero-copy-derive/tests/ui/pass_mut/complex_mut.rs b/program-libs/zero-copy/tests/derive/ui/pass_mut/complex_mut.rs similarity index 100% rename from program-libs/zero-copy-derive/tests/ui/pass_mut/complex_mut.rs rename to program-libs/zero-copy/tests/derive/ui/pass_mut/complex_mut.rs diff --git a/program-tests/account-compression-test/Cargo.toml b/program-tests/account-compression-test/Cargo.toml index 6f07ddbc56..efc50b01e5 100644 --- a/program-tests/account-compression-test/Cargo.toml +++ b/program-tests/account-compression-test/Cargo.toml @@ -3,6 +3,7 @@ name = "account-compression-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/batched-merkle-tree-test/Cargo.toml b/program-tests/batched-merkle-tree-test/Cargo.toml index adb3876530..131931c079 100644 --- a/program-tests/batched-merkle-tree-test/Cargo.toml +++ b/program-tests/batched-merkle-tree-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Batch Merkle tree integration tests." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [dev-dependencies] light-batched-merkle-tree = { workspace = true , features = ["test-only", "solana"]} diff --git a/program-tests/batched-merkle-tree-test/src/lib.rs b/program-tests/batched-merkle-tree-test/src/lib.rs index e69de29bb2..8b13789179 100644 --- a/program-tests/batched-merkle-tree-test/src/lib.rs +++ b/program-tests/batched-merkle-tree-test/src/lib.rs @@ -0,0 +1 @@ + diff --git a/program-tests/compressed-token-test/Cargo.toml b/program-tests/compressed-token-test/Cargo.toml index 8f7ba53810..9e3aa84e8a 100644 --- a/program-tests/compressed-token-test/Cargo.toml +++ b/program-tests/compressed-token-test/Cargo.toml @@ -3,6 +3,7 @@ name = "compressed-token-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/create-address-test-program/Cargo.toml b/program-tests/create-address-test-program/Cargo.toml index 6a94aa779f..ba7ed0438e 100644 --- a/program-tests/create-address-test-program/Cargo.toml +++ b/program-tests/create-address-test-program/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/e2e-test/Cargo.toml b/program-tests/e2e-test/Cargo.toml index c426ba18d2..eb711647c5 100644 --- a/program-tests/e2e-test/Cargo.toml +++ b/program-tests/e2e-test/Cargo.toml @@ -3,6 +3,7 @@ name = "e2e-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/registry-test/Cargo.toml b/program-tests/registry-test/Cargo.toml index 3712c6d286..42bd2846d0 100644 --- a/program-tests/registry-test/Cargo.toml +++ b/program-tests/registry-test/Cargo.toml @@ -3,6 +3,7 @@ name = "registry-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/system-cpi-test/Cargo.toml b/program-tests/system-cpi-test/Cargo.toml index b84dc81a96..dde01c17c3 100644 --- a/program-tests/system-cpi-test/Cargo.toml +++ b/program-tests/system-cpi-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/system-cpi-v2-test/Cargo.toml b/program-tests/system-cpi-v2-test/Cargo.toml index 6c0fb0c08d..8093e50f65 100644 --- a/program-tests/system-cpi-v2-test/Cargo.toml +++ b/program-tests/system-cpi-v2-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/system-test/Cargo.toml b/program-tests/system-test/Cargo.toml index 9e5d07ebf3..3ef28c6aa1 100644 --- a/program-tests/system-test/Cargo.toml +++ b/program-tests/system-test/Cargo.toml @@ -3,6 +3,7 @@ name = "system-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/program-tests/utils/Cargo.toml b/program-tests/utils/Cargo.toml index 5ac0d3d6e6..00cb536fc3 100644 --- a/program-tests/utils/Cargo.toml +++ b/program-tests/utils/Cargo.toml @@ -5,6 +5,7 @@ description = "Utilities used in Light Protocol program tests" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [features] default = [] diff --git a/programs/account-compression/Cargo.toml b/programs/account-compression/Cargo.toml index 80cbb95903..cbe50c45ab 100644 --- a/programs/account-compression/Cargo.toml +++ b/programs/account-compression/Cargo.toml @@ -5,6 +5,7 @@ description = "Solana account compression program" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/programs/compressed-token/Cargo.toml b/programs/compressed-token/Cargo.toml index 4c1604dcdf..1ed38de11d 100644 --- a/programs/compressed-token/Cargo.toml +++ b/programs/compressed-token/Cargo.toml @@ -5,6 +5,7 @@ description = "Generalized token compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/programs/registry/Cargo.toml b/programs/registry/Cargo.toml index 9bb0937d59..2fb2645575 100644 --- a/programs/registry/Cargo.toml +++ b/programs/registry/Cargo.toml @@ -5,6 +5,7 @@ description = "Light core protocol logic" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/programs/system/Cargo.toml b/programs/system/Cargo.toml index 1134ca19a5..9817ee655f 100644 --- a/programs/system/Cargo.toml +++ b/programs/system/Cargo.toml @@ -5,6 +5,7 @@ description = "ZK Compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/scripts/create-release-pr.sh b/scripts/create-release-pr.sh index eb33ca14a7..a9175765a3 100755 --- a/scripts/create-release-pr.sh +++ b/scripts/create-release-pr.sh @@ -32,23 +32,111 @@ echo "Changed files:" git diff --name-only | grep Cargo.toml || echo " (no Cargo.toml changes)" echo "" -# Extract version changes +# Extract version changes with crate names +VERSION_CHANGES=$(git diff -- '**/Cargo.toml' | awk ' + /^diff --git/ { + split($3, parts, "/"); + if (parts[2] == "program-libs" && parts[4] == "Cargo.toml") { + crate = parts[3]; + } else if (parts[2] == "sdk-libs" && parts[4] == "Cargo.toml") { + crate = parts[3]; + } else { + crate = ""; + } + } + /^-version = / { + old_ver = $3; + gsub(/"/, "", old_ver); + } + /^\+version = / { + new_ver = $3; + gsub(/"/, "", new_ver); + if (crate && old_ver && new_ver) { + printf " %s: %s → %s\n", crate, old_ver, new_ver; + crate = ""; + old_ver = ""; + new_ver = ""; + } + } +') + echo "Version changes:" -git diff | grep -E '^\+version|^-version' | head -20 || echo " (could not detect)" +if [ -z "$VERSION_CHANGES" ]; then + echo " (no version changes detected)" + echo "" + echo "Error: No version changes found. Please bump versions first." + exit 1 +else + echo "$VERSION_CHANGES" +fi echo "" -read -p "Create release PR with these changes? (y/N) " -n 1 -r +# Create release branch +BRANCH_NAME="release/${RELEASE_TYPE}" +PR_TITLE="chore(${RELEASE_TYPE}): Bump versions" + +echo "Will create:" +echo " Branch: $BRANCH_NAME" +echo " PR: $PR_TITLE" +echo "" +read -p "Create release branch and PR with these changes? (y/N) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Cancelled." exit 1 fi -# Create release branch -BRANCH_NAME="release/${RELEASE_TYPE}" +echo "" +echo "=========================================" +echo "Running cargo release dry-run validation..." +echo "=========================================" +echo "" + +# Determine which packages to validate +if [ "$RELEASE_TYPE" == "program-libs" ]; then + PACKAGES=( + "light-account-checks" "aligned-sized" "light-batched-merkle-tree" + "light-bloom-filter" "light-compressed-account" "light-concurrent-merkle-tree" + "light-hash-set" "light-hasher" "light-heap" "light-indexed-array" + "light-indexed-merkle-tree" "light-macros" "light-merkle-tree-metadata" + "light-merkle-tree-reference" "light-verifier" "light-zero-copy-derive" "light-zero-copy" + ) +else + PACKAGES=( + "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" + "light-sdk" "light-client" "photon-api" "light-program-test" + ) +fi +# Build package args for workspace publish command +PACKAGE_ARGS="" +for pkg in "${PACKAGES[@]}"; do + PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" +done + +echo "Validating packages in correct dependency order..." +ERROR_OUTPUT=$(cargo publish --dry-run --allow-dirty $PACKAGE_ARGS 2>&1) +if [ $? -ne 0 ]; then + echo "āœ— Validation failed" + echo "" + echo "Error output:" + echo "$ERROR_OUTPUT" + echo "" + + echo "The GitHub Actions PR validation will run the same checks." + echo "Continue anyway and let CI validate? (y/N) " + read -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Cancelled." + exit 1 + fi +else + echo "āœ“ All crates validated successfully" +fi echo "" -echo "Creating release branch: $BRANCH_NAME" + +echo "Creating release branch..." git checkout -b "$BRANCH_NAME" # Commit changes @@ -62,19 +150,28 @@ git push -u origin "$BRANCH_NAME" # Create PR echo "" echo "Creating pull request..." -gh pr create \ - --title "chore(${RELEASE_TYPE}): Bump versions" \ - --body "## ${RELEASE_TYPE^} Release + +PR_BODY="## ${RELEASE_TYPE^} Release This PR bumps versions for ${RELEASE_TYPE} crates. +### Version Bumps + +\`\`\` +${VERSION_CHANGES} +\`\`\` + ### Release Process 1. Versions bumped in Cargo.toml files 2. PR validation (dry-run) will run automatically 3. After merge, GitHub Action will publish each crate individually to crates.io and create releases --- -*Generated by \`scripts/create-release-pr.sh ${RELEASE_TYPE}\`*" \ +*Generated by \`scripts/create-release-pr.sh ${RELEASE_TYPE}\`*" + +gh pr create \ + --title "$PR_TITLE" \ + --body "$PR_BODY" \ --label "release" echo "" diff --git a/sdk-tests/client-test/Cargo.toml b/sdk-tests/client-test/Cargo.toml index 59e3dc76c1..1e0a043292 100644 --- a/sdk-tests/client-test/Cargo.toml +++ b/sdk-tests/client-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Tests for light-client and light-program-test." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["lib"] diff --git a/sdk-tests/sdk-anchor-test/programs/sdk-anchor-test/Cargo.toml b/sdk-tests/sdk-anchor-test/programs/sdk-anchor-test/Cargo.toml index f0faca1233..574f53df9a 100644 --- a/sdk-tests/sdk-anchor-test/programs/sdk-anchor-test/Cargo.toml +++ b/sdk-tests/sdk-anchor-test/programs/sdk-anchor-test/Cargo.toml @@ -4,6 +4,7 @@ version = "0.7.0" description = "Test program for Light SDK and Light Macros" edition = "2021" license = "Apache-2.0" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/sdk-tests/sdk-native-test/Cargo.toml b/sdk-tests/sdk-native-test/Cargo.toml index 979cfe922c..942bf05e84 100644 --- a/sdk-tests/sdk-native-test/Cargo.toml +++ b/sdk-tests/sdk-native-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/sdk-tests/sdk-pinocchio-v1-test/Cargo.toml b/sdk-tests/sdk-pinocchio-v1-test/Cargo.toml index 623a741e17..b8ee71e2f1 100644 --- a/sdk-tests/sdk-pinocchio-v1-test/Cargo.toml +++ b/sdk-tests/sdk-pinocchio-v1-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/sdk-tests/sdk-pinocchio-v2-test/Cargo.toml b/sdk-tests/sdk-pinocchio-v2-test/Cargo.toml index d4c61a7ac8..8789dfb2d3 100644 --- a/sdk-tests/sdk-pinocchio-v2-test/Cargo.toml +++ b/sdk-tests/sdk-pinocchio-v2-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/sdk-tests/sdk-v1-native-test/Cargo.toml b/sdk-tests/sdk-v1-native-test/Cargo.toml index 89160fb969..a69e035b32 100644 --- a/sdk-tests/sdk-v1-native-test/Cargo.toml +++ b/sdk-tests/sdk-v1-native-test/Cargo.toml @@ -5,6 +5,7 @@ description = "Test program using generalized account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [lib] crate-type = ["cdylib", "lib"] diff --git a/sparse-merkle-tree/Cargo.toml b/sparse-merkle-tree/Cargo.toml index ac8f7f6afa..79b6dd4525 100644 --- a/sparse-merkle-tree/Cargo.toml +++ b/sparse-merkle-tree/Cargo.toml @@ -5,6 +5,7 @@ description = "Implementation of a sparse indexed (and concurrent) Merkle tree i repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" +publish = false [dependencies] light-hasher = { workspace = true } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 8258907b2f..a96212b98f 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -2,6 +2,7 @@ name = "xtask" version = "1.1.0" edition = "2021" +publish = false [dependencies] account-compression = { workspace = true } From 0eb8140ff3f96fb1d578d8388bab51416e63946f Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 6 Oct 2025 18:55:45 +0100 Subject: [PATCH 5/6] update script --- .github/workflows/release-publish.yml | 4 +- scripts/create-release-pr.sh | 81 +++++++++++---------------- 2 files changed, 35 insertions(+), 50 deletions(-) diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index e0b3381e24..8e79e2862f 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -64,7 +64,7 @@ jobs: ) echo "Publishing program-libs crates individually..." - > /tmp/published_tags.txt + : > /tmp/published_tags.txt for pkg in "${PROGRAM_LIBS[@]}"; do echo "----------------------------------------" @@ -106,7 +106,7 @@ jobs: ) echo "Publishing sdk-libs crates individually..." - > /tmp/published_tags.txt + : > /tmp/published_tags.txt for pkg in "${SDK_LIBS[@]}"; do echo "----------------------------------------" diff --git a/scripts/create-release-pr.sh b/scripts/create-release-pr.sh index a9175765a3..02925533d5 100755 --- a/scripts/create-release-pr.sh +++ b/scripts/create-release-pr.sh @@ -32,33 +32,30 @@ echo "Changed files:" git diff --name-only | grep Cargo.toml || echo " (no Cargo.toml changes)" echo "" -# Extract version changes with crate names -VERSION_CHANGES=$(git diff -- '**/Cargo.toml' | awk ' - /^diff --git/ { - split($3, parts, "/"); - if (parts[2] == "program-libs" && parts[4] == "Cargo.toml") { - crate = parts[3]; - } else if (parts[2] == "sdk-libs" && parts[4] == "Cargo.toml") { - crate = parts[3]; - } else { - crate = ""; - } - } - /^-version = / { - old_ver = $3; - gsub(/"/, "", old_ver); - } - /^\+version = / { - new_ver = $3; - gsub(/"/, "", new_ver); - if (crate && old_ver && new_ver) { - printf " %s: %s → %s\n", crate, old_ver, new_ver; - crate = ""; - old_ver = ""; - new_ver = ""; - } - } -') +# Extract version changes with package names +VERSION_CHANGES="" +PACKAGES=() + +# Get list of changed Cargo.toml files in program-libs, sdk-libs, and program-tests/merkle-tree +for file in $(git diff --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree)/'); do + # Extract old and new version from the diff + versions=$(git diff "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---') + old_ver=$(echo "$versions" | grep '^-version' | head -1 | awk -F'"' '{print $2}') + new_ver=$(echo "$versions" | grep '^\+version' | head -1 | awk -F'"' '{print $2}') + + # Only process if version actually changed + if [ -n "$old_ver" ] && [ -n "$new_ver" ] && [ "$old_ver" != "$new_ver" ]; then + # Extract actual package name from Cargo.toml + pkg_name=$(grep '^name = ' "$file" | head -1 | awk -F'"' '{print $2}') + + if [ -n "$pkg_name" ]; then + VERSION_CHANGES="${VERSION_CHANGES} ${pkg_name}: ${old_ver} → ${new_ver}\n" + PACKAGES+=("$pkg_name") + fi + fi +done + +VERSION_CHANGES=$(echo -e "$VERSION_CHANGES") echo "Version changes:" if [ -z "$VERSION_CHANGES" ]; then @@ -73,7 +70,7 @@ echo "" # Create release branch BRANCH_NAME="release/${RELEASE_TYPE}" -PR_TITLE="chore(${RELEASE_TYPE}): Bump versions" +PR_TITLE="chore: bump ${RELEASE_TYPE} versions" echo "Will create:" echo " Branch: $BRANCH_NAME" @@ -92,30 +89,14 @@ echo "Running cargo release dry-run validation..." echo "=========================================" echo "" -# Determine which packages to validate -if [ "$RELEASE_TYPE" == "program-libs" ]; then - PACKAGES=( - "light-account-checks" "aligned-sized" "light-batched-merkle-tree" - "light-bloom-filter" "light-compressed-account" "light-concurrent-merkle-tree" - "light-hash-set" "light-hasher" "light-heap" "light-indexed-array" - "light-indexed-merkle-tree" "light-macros" "light-merkle-tree-metadata" - "light-merkle-tree-reference" "light-verifier" "light-zero-copy-derive" "light-zero-copy" - ) -else - PACKAGES=( - "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" - "light-sdk" "light-client" "photon-api" "light-program-test" - ) -fi - -# Build package args for workspace publish command +# Build package args for workspace publish command (using detected packages from version changes) PACKAGE_ARGS="" for pkg in "${PACKAGES[@]}"; do PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" done -echo "Validating packages in correct dependency order..." -ERROR_OUTPUT=$(cargo publish --dry-run --allow-dirty $PACKAGE_ARGS 2>&1) +echo "Validating packages with cargo publis --dry-run" +ERROR_OUTPUT=$(cargo publish --dry-run --allow-dirty $PACKAGE_ARGS ) if [ $? -ne 0 ]; then echo "āœ— Validation failed" echo "" @@ -151,7 +132,11 @@ git push -u origin "$BRANCH_NAME" echo "" echo "Creating pull request..." -PR_BODY="## ${RELEASE_TYPE^} Release +# Capitalize first letter of release type (bash 3.2 compatible) +RELEASE_TYPE_CAPS="$(echo ${RELEASE_TYPE:0:1} | tr '[:lower:]' '[:upper:]')${RELEASE_TYPE:1}" + +# Build PR body with proper escaping +PR_BODY="## ${RELEASE_TYPE_CAPS} Release This PR bumps versions for ${RELEASE_TYPE} crates. From 4cdcc9525e3d30d0e91e3973136c2e24810a39a1 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 6 Oct 2025 20:05:45 +0100 Subject: [PATCH 6/6] update pr validation --- .github/workflows/release-pr-validation.yml | 95 +----------- .github/workflows/release-publish.yml | 155 +++++--------------- Cargo.lock | 2 +- Cargo.toml | 2 +- program-libs/account-checks/Cargo.toml | 2 +- scripts/create-release-pr.sh | 110 ++++++++------ scripts/detect-version-changes.sh | 47 ++++++ scripts/validate-packages.sh | 82 +++++++++++ 8 files changed, 236 insertions(+), 259 deletions(-) create mode 100755 scripts/detect-version-changes.sh create mode 100755 scripts/validate-packages.sh diff --git a/.github/workflows/release-pr-validation.yml b/.github/workflows/release-pr-validation.yml index e50c608229..0e36562c40 100644 --- a/.github/workflows/release-pr-validation.yml +++ b/.github/workflows/release-pr-validation.yml @@ -2,7 +2,6 @@ name: Release PR Validation permissions: contents: read - issues: write on: pull_request: @@ -19,98 +18,16 @@ jobs: 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: Detect release type - id: detect_type - env: - BRANCH_NAME: ${{ github.head_ref }} - run: | - if [[ "$BRANCH_NAME" == release/program-libs-* ]]; then - echo "type=program-libs" >> "$GITHUB_OUTPUT" - elif [[ "$BRANCH_NAME" == release/sdk-libs-* ]]; then - echo "type=sdk-libs" >> "$GITHUB_OUTPUT" - else - echo "type=unknown" >> "$GITHUB_OUTPUT" - fi - - - name: Dry-run publish (program-libs) - if: steps.detect_type.outputs.type == 'program-libs' - run: | - PROGRAM_LIBS=( - "light-account-checks" "aligned-sized" "light-batched-merkle-tree" - "light-bloom-filter" "light-compressed-account" "light-concurrent-merkle-tree" - "light-hash-set" "light-hasher" "light-heap" "light-indexed-array" - "light-indexed-merkle-tree" "light-macros" "light-merkle-tree-metadata" - "light-verifier" "light-zero-copy-derive" "light-zero-copy" - ) - - echo "Running dry-run publish for program-libs individually..." - FAILED_CRATES=() - - for pkg in "${PROGRAM_LIBS[@]}"; do - echo "----------------------------------------" - echo "Validating $pkg..." - if cargo publish --dry-run -p "$pkg"; then - echo "āœ“ $pkg validation passed" - else - echo "āœ— $pkg validation failed" - FAILED_CRATES+=("$pkg") - fi - done - - if [ ${#FAILED_CRATES[@]} -ne 0 ]; then - echo "" - echo "Failed crates: ${FAILED_CRATES[*]}" - exit 1 - fi - - echo "" - echo "āœ“ All program-libs crates validated successfully" + - name: Install cargo-release + run: cargo install cargo-release - - name: Dry-run publish (sdk-libs) - if: steps.detect_type.outputs.type == 'sdk-libs' - run: | - SDK_LIBS=( - "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" - "light-sdk" "light-client" "photon-api" "light-program-test" - ) - - echo "Running dry-run publish for sdk-libs individually..." - FAILED_CRATES=() - - for pkg in "${SDK_LIBS[@]}"; do - echo "----------------------------------------" - echo "Validating $pkg..." - if cargo publish --dry-run -p "$pkg"; then - echo "āœ“ $pkg validation passed" - else - echo "āœ— $pkg validation failed" - FAILED_CRATES+=("$pkg") - fi - done - - if [ ${#FAILED_CRATES[@]} -ne 0 ]; then - echo "" - echo "Failed crates: ${FAILED_CRATES[*]}" - exit 1 - fi - - echo "" - echo "āœ“ All sdk-libs crates validated successfully" - - - name: Comment PR with validation result - if: success() - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: '**Release validation passed!**\n\nDry-run publish completed successfully. This PR is ready to merge.' - }); + - name: Validate packages for publishing + run: ./scripts/validate-packages.sh diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 8e79e2862f..ea49614248 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -34,141 +34,56 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Detect release type from PR - id: detect_type + - name: Validate packages before publishing env: - PR_BRANCH: ${{ github.event.pull_request.head.ref }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | - if [[ "$PR_BRANCH" == release/program-libs-* ]]; then - echo "type=program-libs" >> "$GITHUB_OUTPUT" - elif [[ "$PR_BRANCH" == release/sdk-libs-* ]]; then - echo "type=sdk-libs" >> "$GITHUB_OUTPUT" - else - echo "type=unknown" >> "$GITHUB_OUTPUT" - echo "Error: Could not detect release type from branch: $PR_BRANCH" - exit 1 - fi + echo "=========================================" + echo "Phase 1: Validation (dry-run)" + echo "=========================================" + ./scripts/validate-packages.sh "$BASE_SHA" "$HEAD_SHA" - - name: Publish to crates.io (program-libs) - if: steps.detect_type.outputs.type == 'program-libs' + - name: Publish packages to crates.io env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | - PROGRAM_LIBS=( - "light-account-checks" "aligned-sized" "light-batched-merkle-tree" - "light-bloom-filter" "light-compressed-account" "light-concurrent-merkle-tree" - "light-hash-set" "light-hasher" "light-heap" "light-indexed-array" - "light-indexed-merkle-tree" "light-macros" "light-merkle-tree-metadata" - "light-verifier" "light-zero-copy-derive" "light-zero-copy" - ) - - echo "Publishing program-libs crates individually..." - : > /tmp/published_tags.txt - - for pkg in "${PROGRAM_LIBS[@]}"; do - echo "----------------------------------------" - echo "Publishing $pkg..." - - # Publish to crates.io and create tag - if cargo release publish -p "$pkg" --execute --no-confirm; then - echo "āœ“ Published $pkg" - - # Get the tag that was just created - VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"$pkg\") | .version") - TAG="${pkg}-v${VERSION}" - - # Create GitHub release - echo "Creating GitHub release for $TAG..." - if gh release create "$TAG" --generate-notes --title "$TAG"; then - echo "āœ“ Created release for $TAG" - echo "$TAG" >> /tmp/published_tags.txt - else - echo "Warning: Failed to create release for $TAG" - fi - - # Rate limiting: wait between publishes - sleep 10 - else - echo "Warning: Failed to publish $pkg" - fi - done + echo "" + echo "=========================================" + echo "Phase 2: Publishing (atomic)" + echo "=========================================" + ./scripts/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA" - - name: Publish to crates.io (sdk-libs) - if: steps.detect_type.outputs.type == 'sdk-libs' + - name: Create GitHub releases env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | - SDK_LIBS=( - "light-sdk-macros" "light-sdk-types" "light-sdk-pinocchio" - "light-sdk" "light-client" "photon-api" "light-program-test" - ) + echo "" + echo "=========================================" + echo "Phase 3: Creating GitHub releases" + echo "=========================================" - echo "Publishing sdk-libs crates individually..." - : > /tmp/published_tags.txt + # Detect packages that were published + PACKAGES_STRING=$(./scripts/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA") + read -ra PACKAGES <<< "$PACKAGES_STRING" - for pkg in "${SDK_LIBS[@]}"; do + for pkg in "${PACKAGES[@]}"; do echo "----------------------------------------" - echo "Publishing $pkg..." - - # Publish to crates.io and create tag - if cargo release publish -p "$pkg" --execute --no-confirm; then - echo "āœ“ Published $pkg" - - # Get the tag that was just created - VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r ".packages[] | select(.name == \"$pkg\") | .version") - TAG="${pkg}-v${VERSION}" + # 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}" - # Create GitHub release - echo "Creating GitHub release for $TAG..." - if gh release create "$TAG" --generate-notes --title "$TAG"; then - echo "āœ“ Created release for $TAG" - echo "$TAG" >> /tmp/published_tags.txt - else - echo "Warning: Failed to create release for $TAG" - fi - - # Rate limiting: wait between publishes - sleep 10 + 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 publish $pkg" + echo "Warning: Failed to create release for $TAG" fi done - - name: Comment on PR - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - let publishedTags = []; - - try { - publishedTags = fs.readFileSync('/tmp/published_tags.txt', 'utf8').trim().split('\n').filter(t => t); - } catch (e) { - console.log('No published tags file found'); - } - - let body = '**Release published successfully!**\n\n'; - - if (publishedTags.length > 0) { - body += '**Published versions:**\n'; - publishedTags.forEach(tag => { - const crateUrl = `https://crates.io/crates/${tag.split('-v')[0]}`; - body += `- [\`${tag}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${tag}) ([crates.io](${crateUrl}))\n`; - }); - } else { - body += 'No new versions published (all crates were up to date).\n'; - } - - body += '\n---\n'; - body += 'āœ“ Crates published to crates.io\n'; - body += 'āœ“ Git tags created and pushed\n'; - body += 'āœ“ GitHub releases created\n'; - - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: body - }); + echo "" + echo "āœ“ GitHub releases created" diff --git a/Cargo.lock b/Cargo.lock index 7301e7d6f9..571bfe9579 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3367,7 +3367,7 @@ dependencies = [ [[package]] name = "light-account-checks" -version = "0.3.0" +version = "0.4.0" dependencies = [ "borsh 0.10.4", "pinocchio", diff --git a/Cargo.toml b/Cargo.toml index f4c750c3db..4c1cb00282 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -169,7 +169,7 @@ light-sdk-pinocchio = { path = "sdk-libs/sdk-pinocchio", version = "0.13.0" } light-sdk-macros = { path = "sdk-libs/macros", version = "0.13.0" } light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.13.0" } light-compressed-account = { path = "program-libs/compressed-account", version = "0.4.0" } -light-account-checks = { path = "program-libs/account-checks", version = "0.3.0" } +light-account-checks = { path = "program-libs/account-checks", version = "0.4.0" } light-verifier = { path = "program-libs/verifier", version = "3.0.0" } light-zero-copy = { path = "program-libs/zero-copy", version = "0.3.0" } light-zero-copy-derive = { path = "program-libs/zero-copy-derive", version = "0.3.0" } diff --git a/program-libs/account-checks/Cargo.toml b/program-libs/account-checks/Cargo.toml index 3f77092681..3812761937 100644 --- a/program-libs/account-checks/Cargo.toml +++ b/program-libs/account-checks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-account-checks" -version = "0.3.0" +version = "0.4.0" description = "Checks for solana accounts." repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/scripts/create-release-pr.sh b/scripts/create-release-pr.sh index 02925533d5..d4871e302f 100755 --- a/scripts/create-release-pr.sh +++ b/scripts/create-release-pr.sh @@ -2,20 +2,57 @@ set -euo pipefail # Create release PR with current changes -# Usage: ./scripts/create-release-pr.sh +# Usage: ./scripts/create-release-pr.sh [target-branch] +# Arguments: +# release-type: Type of release (program-libs or sdk-libs) +# target-branch: Branch to compare against (default: origin/main) -if [ $# -ne 1 ]; then - echo "Usage: $0 " +if [ $# -lt 1 ] || [ $# -gt 2 ]; then + echo "Usage: $0 [target-branch]" exit 1 fi RELEASE_TYPE=$1 +TARGET_BRANCH="${2:-origin/main}" + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [[ ! "$RELEASE_TYPE" =~ ^(program-libs|sdk-libs)$ ]]; then echo "Error: Release type must be 'program-libs' or 'sdk-libs'" exit 1 fi +# Function to get version changes between two git refs +# Output format: One line per package: "package-name old-version new-version" +get_version_changes() { + local base_ref="$1" + local head_ref="$2" + + # Fetch if comparing against remote refs + if [[ "$base_ref" == origin/* ]]; then + local branch="${base_ref#origin/}" + git fetch origin "$branch" 2>/dev/null || true + fi + + # Get list of changed Cargo.toml files in program-libs, sdk-libs, and program-tests/merkle-tree + for file in $(git diff "$base_ref"..."$head_ref" --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree)/'); do + # Extract old and new version from the diff + local versions=$(git diff "$base_ref"..."$head_ref" "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---') + local old_ver=$(echo "$versions" | grep '^-version' | head -1 | awk -F'"' '{print $2}') + local new_ver=$(echo "$versions" | grep '^\+version' | head -1 | awk -F'"' '{print $2}') + + # Only process if version actually changed + if [ -n "$old_ver" ] && [ -n "$new_ver" ] && [ "$old_ver" != "$new_ver" ]; then + # Extract actual package name from Cargo.toml + local pkg_name=$(grep '^name = ' "$file" | head -1 | awk -F'"' '{print $2}') + + if [ -n "$pkg_name" ]; then + echo "$pkg_name $old_ver $new_ver" + fi + fi + done +} + # Check if there are changes if git diff --quiet; then echo "No changes detected. Please bump versions first." @@ -32,41 +69,29 @@ echo "Changed files:" git diff --name-only | grep Cargo.toml || echo " (no Cargo.toml changes)" echo "" -# Extract version changes with package names -VERSION_CHANGES="" -PACKAGES=() +# Detect packages with version changes +echo "Detecting packages with version changes..." +echo "Comparing against: $TARGET_BRANCH" +echo "" -# Get list of changed Cargo.toml files in program-libs, sdk-libs, and program-tests/merkle-tree -for file in $(git diff --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree)/'); do - # Extract old and new version from the diff - versions=$(git diff "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---') - old_ver=$(echo "$versions" | grep '^-version' | head -1 | awk -F'"' '{print $2}') - new_ver=$(echo "$versions" | grep '^\+version' | head -1 | awk -F'"' '{print $2}') - - # Only process if version actually changed - if [ -n "$old_ver" ] && [ -n "$new_ver" ] && [ "$old_ver" != "$new_ver" ]; then - # Extract actual package name from Cargo.toml - pkg_name=$(grep '^name = ' "$file" | head -1 | awk -F'"' '{print $2}') - - if [ -n "$pkg_name" ]; then - VERSION_CHANGES="${VERSION_CHANGES} ${pkg_name}: ${old_ver} → ${new_ver}\n" - PACKAGES+=("$pkg_name") - fi +# Get version changes using the function +VERSION_CHANGES_RAW=$(get_version_changes "$TARGET_BRANCH" "HEAD") + +# Build packages array and formatted version changes +PACKAGES=() +VERSION_CHANGES="" +while IFS= read -r line; do + if [ -n "$line" ]; then + read -r pkg old_ver new_ver <<< "$line" + PACKAGES+=("$pkg") + VERSION_CHANGES="${VERSION_CHANGES} ${pkg}: ${old_ver} → ${new_ver}\n" fi -done +done <<< "$VERSION_CHANGES_RAW" VERSION_CHANGES=$(echo -e "$VERSION_CHANGES") echo "Version changes:" -if [ -z "$VERSION_CHANGES" ]; then - echo " (no version changes detected)" - echo "" - echo "Error: No version changes found. Please bump versions first." - exit 1 -else - echo "$VERSION_CHANGES" -fi -echo "" +echo "$VERSION_CHANGES" # Create release branch BRANCH_NAME="release/${RELEASE_TYPE}" @@ -89,21 +114,14 @@ echo "Running cargo release dry-run validation..." echo "=========================================" echo "" -# Build package args for workspace publish command (using detected packages from version changes) -PACKAGE_ARGS="" -for pkg in "${PACKAGES[@]}"; do - PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" -done - -echo "Validating packages with cargo publis --dry-run" -ERROR_OUTPUT=$(cargo publish --dry-run --allow-dirty $PACKAGE_ARGS ) -if [ $? -ne 0 ]; then - echo "āœ— Validation failed" +# Validate packages using the validation script +if "$SCRIPT_DIR/validate-packages.sh" "$TARGET_BRANCH" "HEAD"; then + echo "" + echo "āœ“ All crates validated successfully" +else echo "" - echo "Error output:" - echo "$ERROR_OUTPUT" + echo "āœ— Validation failed" echo "" - echo "The GitHub Actions PR validation will run the same checks." echo "Continue anyway and let CI validate? (y/N) " read -n 1 -r @@ -112,8 +130,6 @@ if [ $? -ne 0 ]; then echo "Cancelled." exit 1 fi -else - echo "āœ“ All crates validated successfully" fi echo "" diff --git a/scripts/detect-version-changes.sh b/scripts/detect-version-changes.sh new file mode 100755 index 0000000000..3a31052d0d --- /dev/null +++ b/scripts/detect-version-changes.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Detect packages with version changes between two git refs +# Usage: ./scripts/detect-version-changes.sh [base-ref] [head-ref] +# Arguments: +# base-ref: Base reference to compare against (default: origin/main) +# head-ref: Head reference to compare (default: HEAD) +# Outputs: Space-separated list of package names to stdout + +BASE_REF="${1:-origin/main}" +HEAD_REF="${2:-HEAD}" + +# Fetch if comparing against remote refs +if [[ "$BASE_REF" == origin/* ]]; then + BRANCH="${BASE_REF#origin/}" + git fetch origin "$BRANCH" +fi + +# Extract packages with version changes +PACKAGES=() + +# Get list of changed Cargo.toml files in program-libs, sdk-libs, and program-tests/merkle-tree +for file in $(git diff "$BASE_REF"..."$HEAD_REF" --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree)/'); do + # Extract old and new version from the diff + versions=$(git diff "$BASE_REF"..."$HEAD_REF" "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---') + old_ver=$(echo "$versions" | grep '^-version' | head -1 | awk -F'"' '{print $2}') + new_ver=$(echo "$versions" | grep '^\+version' | head -1 | awk -F'"' '{print $2}') + + # Only process if version actually changed + if [ -n "$old_ver" ] && [ -n "$new_ver" ] && [ "$old_ver" != "$new_ver" ]; then + # Extract actual package name from Cargo.toml + pkg_name=$(grep '^name = ' "$file" | head -1 | awk -F'"' '{print $2}') + + if [ -n "$pkg_name" ]; then + PACKAGES+=("$pkg_name") + fi + fi +done + +if [ ${#PACKAGES[@]} -eq 0 ]; then + echo "No packages with version changes detected" >&2 + exit 1 +fi + +# Output space-separated list to stdout +echo "${PACKAGES[*]}" diff --git a/scripts/validate-packages.sh b/scripts/validate-packages.sh new file mode 100755 index 0000000000..e304f07970 --- /dev/null +++ b/scripts/validate-packages.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Validate or publish packages using cargo-release +# Usage: +# ./scripts/validate-packages.sh [base-ref] [head-ref] # Dry-run validation +# ./scripts/validate-packages.sh --execute [base-ref] [head-ref] # Actual publish +# Arguments: +# --execute: Actually publish to crates.io (default: dry-run only) +# base-ref: Base reference to compare against (default: origin/main) +# head-ref: Head reference to compare (default: HEAD) +# Exits with 0 on success, 1 on failure + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Parse --execute flag +EXECUTE_FLAG="" +if [ "${1:-}" = "--execute" ]; then + EXECUTE_FLAG="--execute" + shift +fi + +BASE_REF="${1:-origin/main}" +HEAD_REF="${2:-HEAD}" + +echo "Detecting packages with version changes..." +echo "Comparing: $BASE_REF...$HEAD_REF" +echo "" + +# Detect packages using the detection script +PACKAGES_STRING=$("$SCRIPT_DIR/detect-version-changes.sh" "$BASE_REF" "$HEAD_REF") + +# Convert to array +read -ra PACKAGES <<< "$PACKAGES_STRING" + +if [ -n "$EXECUTE_FLAG" ]; then + echo "Publishing packages to crates.io..." +else + echo "Running dry-run validation for packages..." +fi +echo "Packages: ${PACKAGES[*]}" + +# Build package args for cargo-release +PACKAGE_ARGS="" +for pkg in "${PACKAGES[@]}"; do + PACKAGE_ARGS="$PACKAGE_ARGS -p $pkg" +done + +echo "" +if [ -n "$EXECUTE_FLAG" ]; then + echo "Running: cargo release publish $PACKAGE_ARGS --execute --no-confirm" +else + echo "Running: cargo release publish $PACKAGE_ARGS --allow-branch HEAD" +fi +echo "----------------------------------------" + +# cargo-release handles dependency ordering +# Without --execute: dry-run validation (allow HEAD for GitHub Actions detached checkout) +# With --execute: actual publish to crates.io (requires main or release/* branch) +if [ -n "$EXECUTE_FLAG" ]; then + cargo release publish $PACKAGE_ARGS --execute --no-confirm +else + cargo release publish $PACKAGE_ARGS --allow-branch HEAD +fi + +if [ $? -eq 0 ]; then + echo "" + if [ -n "$EXECUTE_FLAG" ]; then + echo "āœ“ All crates published successfully" + else + echo "āœ“ All crates validated successfully" + fi + exit 0 +else + echo "" + if [ -n "$EXECUTE_FLAG" ]; then + echo "āœ— Publishing failed" + else + echo "āœ— Validation failed" + fi + exit 1 +fi