Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
name: Setup Environment
description: Setup Rust, Solana CLI, and Light CLI for testing
description: Setup Rust, Solana CLI, and optionally Node.js for testing

inputs:
example:
description: "Example directory path (used for Rust workspace caching)"
required: false
default: ""
node-version:
description: "Node.js version to install (optional, empty = minimal Node for Light CLI only)"
required: false
default: ""
solana-cli-version:
description: "Solana CLI version"
required: false
default: "2.1.21"
default: "2.3.11"
rust-toolchain:
description: "Rust toolchain version"
required: false
default: "1.85.0"
default: "1.90.0"
light-cli-version:
description: "Light CLI version"
required: false
default: "alpha"
photon-indexer:
description: "Install Photon indexer (required for TypeScript tests)"
required: false
default: "false"

runs:
using: composite
Expand All @@ -22,18 +34,19 @@ runs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ inputs.rust-toolchain }}
cache: false
cache-workspaces: ${{ inputs.example || '.' }}

- name: Setup Node.js (for Light CLI)
- name: Setup Node.js
if: inputs.node-version != ''
uses: actions/setup-node@v4
with:
node-version: "22"
node-version: ${{ inputs.node-version }}

- name: Cache npm global packages
uses: actions/cache@v4
- name: Setup Node.js (for Light CLI)
if: inputs.node-version == ''
uses: actions/setup-node@v4
with:
path: ~/.npm
key: npm-${{ runner.os }}-light-cli-${{ inputs.light-cli-version }}
node-version: "22"

- name: Cache Solana CLI tools
uses: actions/cache@v4
Expand All @@ -53,6 +66,21 @@ runs:
shell: bash
run: npm install -g @lightprotocol/zk-compression-cli@${{ inputs.light-cli-version }}

- name: Cache Photon indexer
if: inputs.photon-indexer == 'true'
id: cache-photon
uses: actions/cache@v4
with:
path: ~/.cargo/bin/photon
key: photon-${{ runner.os }}-ac7df6c388db847b7693a7a1cb766a7c9d7809b5

- name: Install Photon indexer
if: inputs.photon-indexer == 'true' && steps.cache-photon.outputs.cache-hit != 'true'
shell: bash
env:
RUSTFLAGS: "-A dead-code"
run: cargo install --git https://github.com/lightprotocol/photon.git --rev ac7df6c388db847b7693a7a1cb766a7c9d7809b5 --locked --force

- name: Generate keypair
shell: bash
run: solana-keygen new --no-bip39-passphrase
Expand All @@ -64,4 +92,3 @@ runs:
cargo --version
solana --version
light --version

44 changes: 44 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Rust

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
SOLANA_CLI_VERSION: "2.3.11"
RUST_TOOLCHAIN: "1.90.0"

jobs:
test-rust:
name: ${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- escrow
- fundraiser
- light-token-minter
- swap_example
steps:
- uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/actions/setup
with:
example: programs/anchor
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Test
working-directory: programs/anchor
run: cargo test-sbf -p ${{ matrix.package }}
48 changes: 7 additions & 41 deletions .github/workflows/typescript-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ concurrency:
cancel-in-progress: true

env:
SOLANA_CLI_VERSION: "2.1.21"
SOLANA_CLI_VERSION: "2.3.11"
RUST_TOOLCHAIN: "1.90.0"
NODE_VERSION: "22"

jobs:
Expand All @@ -24,48 +25,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache Solana CLI tools
uses: actions/cache@v4
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-cli-${{ runner.os }}-${{ env.SOLANA_CLI_VERSION }}

- name: Install Solana CLI tools
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_CLI_VERSION }}/install)"
echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

- name: Install Light CLI
run: npm install -g @lightprotocol/zk-compression-cli@alpha

- name: Install Rust (for Photon)
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: false

- name: Cache Photon indexer
id: cache-photon
uses: actions/cache@v4
with:
path: ~/.cargo/bin/photon
key: photon-${{ runner.os }}-1a785036de52896b68d06413e3b0231122d6aa4a

- name: Install Photon indexer
if: steps.cache-photon.outputs.cache-hit != 'true'
run: cargo install --git https://github.com/lightprotocol/photon.git --rev 1a785036de52896b68d06413e3b0231122d6aa4a --locked
env:
RUSTFLAGS: "-A dead-code"

- name: Generate keypair
run: solana-keygen new --no-bip39-passphrase
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
photon-indexer: "true"

- name: Install dependencies
working-directory: typescript-client
Expand Down
22 changes: 20 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
# Dependencies
**/node_modules/
**/dist/

# Environment and secrets
**/.env
**/.env.*
**/*-keypair.json
**/id.json

# Build artifacts
**/target
**/.anchor

# Test artifacts
**/test-ledger

# Lock files
**/pnpm-lock.yaml
**/package-lock.json

# Backups
**/*.json.bak
**/test-ledger
**/target

# Project-specific
cli/accounts/
bugs.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ TypeScript examples for light-token-sdk.

## Documentation

Learn more [about to Light-Token here](https://www.zkcompression.com/light-token/welcome).
Learn more [about Light-Token here](https://www.zkcompression.com/light-token/welcome).
30 changes: 30 additions & 0 deletions programs/anchor/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[toolchain]

[features]
resolution = true
skip-lint = false

[workspace]
members = [
"escrow",
"fundraiser",
"light-token-minter",
"token-swap",
]

[programs.localnet]
escrow = "FKJs6rp6TXJtxzLiPtdYhqa9ExRuBXG2zwh4fda6WATN"
fundraiser = "Eoiuq1dXvHxh6dLx3wh9gj8kSAUpga11krTrbfF5XYsC"
light_token_minter = "3EPJBoxM8Evtv3Wk7R2mSWsrSzUD7WSKAaYugLgpCitV"
swap_example = "AsGVFxWqEn8icRBFQApxJe68x3r9zvfSbmiEzYFATGYn"
counter = "PDAm7XVHEkBvzBYDh8qF3z8NxnYQzPjGQJKcHVmMZpT"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
Loading
Loading