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
32 changes: 29 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Setup Environment
description: Setup Rust, Solana CLI, and Light CLI for testing

inputs:
example:
description: "Example directory path"
required: true
solana-cli-version:
description: "Solana CLI version"
required: false
Expand All @@ -13,7 +16,15 @@ inputs:
light-cli-version:
description: "Light CLI version"
required: false
default: "alpha"
default: "0.27.1-alpha.11"
photon-version:
description: "Photon indexer version"
required: false
default: "0.51.2"
photon-commit:
description: "Photon indexer commit hash"
required: false
default: "ac7df6c388db847b7693a7a1cb766a7c9d7809b5"

runs:
using: composite
Expand All @@ -22,7 +33,7 @@ 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)
uses: actions/setup-node@v4
Expand All @@ -41,14 +52,29 @@ runs:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-cli-${{ runner.os }}-${{ inputs.solana-cli-version }}
key: solana-cli-${{ runner.os }}-build-${{ inputs.solana-cli-version }}

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

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

- name: Install Photon indexer
if: steps.cache-photon.outputs.cache-hit != 'true'
shell: bash
run: |
echo "Installing Photon indexer ${{ inputs.photon-version }} (commit ${{ inputs.photon-commit }})..."
RUSTFLAGS="-A dead-code" cargo install --git https://github.com/helius-labs/photon.git --rev ${{ inputs.photon-commit }} --locked --force
echo "Photon installed successfully"

- name: Install Light CLI
shell: bash
run: npm install -g @lightprotocol/zk-compression-cli@${{ inputs.light-cli-version }}
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- example: anchor
package: escrow
name: anchor/escrow
- example: anchor
package: light-token-minter
name: anchor/light-token-minter
steps:
- uses: actions/checkout@v4

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

- name: Build and test
working-directory: ${{ matrix.example }}
run: |
if [ -n "${{ matrix.package }}" ]; then
cargo test-sbf -p ${{ matrix.package }}
else
cargo test-sbf
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
**/test-ledger
**/target
cli/accounts/
bugs.md
19 changes: 19 additions & 0 deletions anchor/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[toolchain]

[features]
resolution = true
skip-lint = false

[programs.localnet]
escrow = "FKJs6rp6TXJtxzLiPtdYhqa9ExRuBXG2zwh4fda6WATN"
light_token_minter = "3EPJBoxM8Evtv3Wk7R2mSWsrSzUD7WSKAaYugLgpCitV"

[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