diff --git a/.github/actions/setup-test-runner/action.yml b/.github/actions/setup-test-runner/action.yml new file mode 100644 index 0000000000..daa5dd884f --- /dev/null +++ b/.github/actions/setup-test-runner/action.yml @@ -0,0 +1,159 @@ +name: Setup test runner +description: Lightweight setup for test jobs that download pre-built artifacts instead of compiling + +inputs: + skip-components: + description: 'Comma-separated list of components to skip (e.g., "go,photon"). If not specified, all components are installed.' + required: false + default: "" + build-artifact-name: + description: 'Name of the build artifact to download' + required: false + default: "build-artifacts" + +runs: + using: "composite" + steps: + - name: Install system dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev pkg-config build-essential protobuf-compiler + + - name: Load versions + id: versions + shell: bash + run: | + source scripts/devenv/versions.sh + echo "rust=${RUST_VERSION}" >> $GITHUB_OUTPUT + echo "node=${NODE_VERSION}" >> $GITHUB_OUTPUT + echo "pnpm=${PNPM_VERSION}" >> $GITHUB_OUTPUT + echo "solana=${SOLANA_VERSION}" >> $GITHUB_OUTPUT + echo "anchor=${ANCHOR_VERSION}" >> $GITHUB_OUTPUT + echo "photon=${PHOTON_VERSION}" >> $GITHUB_OUTPUT + echo "photon_commit=${PHOTON_COMMIT}" >> $GITHUB_OUTPUT + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ steps.versions.outputs.rust }} + cache-key: "test-runner" + cache-workspaces: . + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ steps.versions.outputs.node }} + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ steps.versions.outputs.pnpm }} + run_install: false + + - name: Cache Solana CLI + id: cache-solana + uses: actions/cache@v4 + with: + path: | + .local/bin/solana* + .local/bin/agave* + .local/bin/cargo-* + .local/bin/platform-tools-sdk + key: ${{ runner.os }}-solana-${{ steps.versions.outputs.solana }} + + - name: Install Solana CLI + if: steps.cache-solana.outputs.cache-hit != 'true' + shell: bash + run: bash scripts/devenv/install-solana.sh + + - name: Cache Anchor CLI + id: cache-anchor + uses: actions/cache@v4 + with: + path: | + .local/cargo/bin/avm + .local/cargo/bin/anchor + key: ${{ runner.os }}-anchor-${{ steps.versions.outputs.anchor }} + + - name: Install Anchor CLI + if: steps.cache-anchor.outputs.cache-hit != 'true' + shell: bash + run: bash scripts/devenv/install-anchor.sh + + - name: Cache Photon indexer + if: "!contains(inputs.skip-components, 'photon')" + id: cache-photon + uses: actions/cache@v4 + with: + path: .local/cargo/bin/photon + key: ${{ runner.os }}-photon-${{ steps.versions.outputs.photon }}-${{ steps.versions.outputs.photon_commit }} + + - name: Install Photon indexer + if: "!contains(inputs.skip-components, 'photon') && steps.cache-photon.outputs.cache-hit != 'true'" + shell: bash + run: bash scripts/devenv/install-photon.sh + + - name: Install just + uses: extractions/setup-just@v2 + + - name: Set Light Protocol environment variables + shell: bash + run: | + echo "${PWD}/.local/bin" >> $GITHUB_PATH + echo "${PWD}/.local/cargo/bin" >> $GITHUB_PATH + echo "CARGO_FEATURES=v2_ix" >> $GITHUB_ENV + echo "REDIS_URL=redis://localhost:6379" >> $GITHUB_ENV + echo "SBF_OUT_DIR=target/deploy" >> $GITHUB_ENV + + - name: Get pnpm store directory + id: pnpm-store + shell: bash + run: | + STORE_PATH=$(pnpm store path --silent) + echo "STORE_PATH=${STORE_PATH}" >> $GITHUB_ENV + echo "path=${STORE_PATH}" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + id: pnpm-cache + uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-store.outputs.path }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + shell: bash + run: | + pnpm install --frozen-lockfile + if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules 2>/dev/null)" ]; then + echo "Error: node_modules not created after pnpm install" + exit 1 + fi + + - name: Save pnpm cache + if: steps.pnpm-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: ${{ steps.pnpm-store.outputs.path }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Generate Solana keypair + shell: bash + run: | + mkdir -p /home/runner/.config/solana/ + if [ ! -f /home/runner/.config/solana/id.json ]; then + solana-keygen new --no-bip39-passphrase -o /home/runner/.config/solana/id.json + fi + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.build-artifact-name }} + + - name: Extract build artifacts + shell: bash + run: | + tar -xzf build-artifacts.tar.gz + rm build-artifacts.tar.gz diff --git a/.github/workflows/cli-v1.yml b/.github/workflows/cli-v1.yml deleted file mode 100644 index b6dd4c82d5..0000000000 --- a/.github/workflows/cli-v1.yml +++ /dev/null @@ -1,76 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - "*" - types: - - opened - - synchronize - - reopened - - ready_for_review - -name: cli-tests-v1 - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - cli-v1: - name: cli-v1 - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - - services: - redis: - image: redis:8.0.1 - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - env: - LIGHT_PROTOCOL_VERSION: V1 - REDIS_URL: redis://localhost:6379 - CI: true - - steps: - - name: Checkout sources - uses: actions/checkout@v6 - with: - submodules: true - - - name: Setup and build - uses: ./.github/actions/setup-and-build - with: - skip-components: "redis,disk-cleanup,go" - cache-key: "js" - - - name: Build stateless.js with V1 - run: | - cd js/stateless.js - pnpm build:v1 - - - name: Build compressed-token with V1 - run: | - cd js/compressed-token - pnpm build:v1 - - - name: Build CLI - run: | - just cli build - - - name: Run CLI tests with V1 - run: | - just cli test - - - name: Display prover logs on failure - if: failure() - run: | - echo "=== Displaying prover logs ===" - find cli/test-ledger -name "*prover*.log" -type f -exec echo "=== Contents of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; || echo "No prover logs found" diff --git a/.github/workflows/cli-v2.yml b/.github/workflows/cli-v2.yml deleted file mode 100644 index edf752987e..0000000000 --- a/.github/workflows/cli-v2.yml +++ /dev/null @@ -1,76 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - "*" - types: - - opened - - synchronize - - reopened - - ready_for_review - -name: cli-tests-v2 - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - cli-v2: - name: cli-v2 - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - - services: - redis: - image: redis:8.0.1 - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - env: - LIGHT_PROTOCOL_VERSION: V2 - REDIS_URL: redis://localhost:6379 - CI: true - - steps: - - name: Checkout sources - uses: actions/checkout@v6 - with: - submodules: true - - - name: Setup and build - uses: ./.github/actions/setup-and-build - with: - skip-components: "redis,disk-cleanup,go" - cache-key: "js" - - - name: Build stateless.js with V2 - run: | - cd js/stateless.js - pnpm build:v2 - - - name: Build compressed-token with V2 - run: | - cd js/compressed-token - pnpm build:v2 - - - name: Build CLI with V2 - run: | - just cli build - - - name: Run CLI tests with V2 - run: | - just cli test - - - name: Display prover logs on failure - if: failure() - run: | - echo "=== Displaying prover logs ===" - find . -path "*/test-ledger/*prover*.log" -type f -exec echo "=== Contents of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; || echo "No prover logs found" diff --git a/.github/workflows/forester-tests.yml b/.github/workflows/forester-tests.yml index 635cff83f5..9cccd34866 100644 --- a/.github/workflows/forester-tests.yml +++ b/.github/workflows/forester-tests.yml @@ -44,7 +44,7 @@ env: jobs: test: name: Forester e2e test - runs-on: warp-ubuntu-latest-x64-4x + runs-on: ubuntu-latest timeout-minutes: 60 services: @@ -86,7 +86,7 @@ jobs: compressible-tests: name: Forester compressible tests - runs-on: warp-ubuntu-latest-x64-4x + runs-on: ubuntu-latest timeout-minutes: 60 services: diff --git a/.github/workflows/js-cli-v1.yml b/.github/workflows/js-cli-v1.yml new file mode 100644 index 0000000000..70f9ee5f40 --- /dev/null +++ b/.github/workflows/js-cli-v1.yml @@ -0,0 +1,196 @@ +on: + push: + branches: + - main + paths: + - "js/**" + - "cli/**" + - "programs/**" + - "program-libs/**" + - "pnpm-lock.yaml" + - ".github/workflows/js-cli-v1.yml" + pull_request: + branches: + - "*" + paths: + - "js/**" + - "cli/**" + - "programs/**" + - "program-libs/**" + - "pnpm-lock.yaml" + - ".github/workflows/js-cli-v1.yml" + types: + - opened + - synchronize + - reopened + - ready_for_review + +name: js-cli-tests-v1 + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + timeout-minutes: 60 + + env: + LIGHT_PROTOCOL_VERSION: V1 + CI: true + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup and build + uses: ./.github/actions/setup-and-build + with: + skip-components: "redis,disk-cleanup,go" + cache-key: "js" + + - name: Build stateless.js with V1 + run: | + cd js/stateless.js + pnpm build:v1 + + - name: Build compressed-token with V1 + run: | + cd js/compressed-token + pnpm build:v1 + + - name: Build CLI + run: | + just cli build + + - name: Package build artifacts + run: | + DIRS=() + for d in target/deploy target/idl target/types cli/bin cli/dist js/stateless.js/dist js/compressed-token/dist; do + [ -d "$d" ] && DIRS+=("$d") + done + tar -czf build-artifacts.tar.gz "${DIRS[@]}" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: js-cli-v1-build-artifacts + path: build-artifacts.tar.gz + retention-days: 1 + compression-level: 0 + + js-tests: + name: js-tests-v1 + needs: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + services: + redis: + image: redis:8.0.1 + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + LIGHT_PROTOCOL_VERSION: V1 + REDIS_URL: redis://localhost:6379 + CI: true + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup test runner + uses: ./.github/actions/setup-test-runner + with: + build-artifact-name: js-cli-v1-build-artifacts + + - name: Run stateless.js tests with V1 + run: | + echo "Running stateless.js tests with retry logic (max 2 attempts)..." + attempt=1 + max_attempts=2 + until just js test-stateless; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Tests passed on attempt $attempt" + + - name: Run compressed-token tests with V1 + run: | + echo "Running compressed-token tests with retry logic (max 2 attempts)..." + attempt=1 + max_attempts=2 + until just js test-compressed-token; do + attempt=$((attempt + 1)) + if [ $attempt -gt $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt/$max_attempts failed, retrying..." + sleep 5 + done + echo "Tests passed on attempt $attempt" + + cli-tests: + name: cli-tests-v1 + needs: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + services: + redis: + image: redis:8.0.1 + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + LIGHT_PROTOCOL_VERSION: V1 + REDIS_URL: redis://localhost:6379 + CI: true + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup test runner + uses: ./.github/actions/setup-test-runner + with: + build-artifact-name: js-cli-v1-build-artifacts + + - name: Run CLI tests with V1 + run: | + just cli test + + - name: Display prover logs on failure + if: failure() + run: | + echo "=== Displaying prover logs ===" + find cli/test-ledger -name "*prover*.log" -type f -exec echo "=== Contents of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; || echo "No prover logs found" diff --git a/.github/workflows/js-v2.yml b/.github/workflows/js-cli-v2.yml similarity index 58% rename from .github/workflows/js-v2.yml rename to .github/workflows/js-cli-v2.yml index 024b0dd64c..c78d642e5f 100644 --- a/.github/workflows/js-v2.yml +++ b/.github/workflows/js-cli-v2.yml @@ -2,41 +2,47 @@ on: push: branches: - main + paths: + - "js/**" + - "cli/**" + - "programs/**" + - "program-libs/**" + - "pnpm-lock.yaml" + - ".github/workflows/js-cli-v2.yml" pull_request: branches: - "*" + paths: + - "js/**" + - "cli/**" + - "programs/**" + - "program-libs/**" + - "pnpm-lock.yaml" + - ".github/workflows/js-cli-v2.yml" types: - opened - synchronize - reopened - ready_for_review -name: js-tests-v2 +name: js-cli-tests-v2 + +permissions: + contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - stateless-js-v2: - name: stateless-js-v2 + build: + name: build if: github.event.pull_request.draft == false runs-on: ubuntu-latest - - services: - redis: - image: redis:8.0.1 - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 + timeout-minutes: 60 env: LIGHT_PROTOCOL_VERSION: V2 - REDIS_URL: redis://localhost:6379 CI: true steps: @@ -65,6 +71,55 @@ jobs: run: | just cli build + - name: Package build artifacts + run: | + DIRS=() + for d in target/deploy target/idl target/types cli/bin cli/dist js/stateless.js/dist js/compressed-token/dist; do + [ -d "$d" ] && DIRS+=("$d") + done + tar -czf build-artifacts.tar.gz "${DIRS[@]}" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: js-cli-v2-build-artifacts + path: build-artifacts.tar.gz + retention-days: 1 + compression-level: 0 + + js-tests: + name: js-tests-v2 + needs: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + services: + redis: + image: redis:8.0.1 + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + LIGHT_PROTOCOL_VERSION: V2 + REDIS_URL: redis://localhost:6379 + CI: true + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup test runner + uses: ./.github/actions/setup-test-runner + with: + build-artifact-name: js-cli-v2-build-artifacts + - name: Run stateless.js tests with V2 run: | echo "Running stateless.js tests with retry logic (max 2 attempts)..." @@ -124,3 +179,46 @@ jobs: run: | echo "=== Displaying prover logs ===" find . -path "*/test-ledger/*prover*.log" -type f -exec echo "=== Contents of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; || echo "No prover logs found" + + cli-tests: + name: cli-tests-v2 + needs: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + services: + redis: + image: redis:8.0.1 + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + LIGHT_PROTOCOL_VERSION: V2 + REDIS_URL: redis://localhost:6379 + CI: true + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup test runner + uses: ./.github/actions/setup-test-runner + with: + build-artifact-name: js-cli-v2-build-artifacts + + - name: Run CLI tests with V2 + run: | + just cli test + + - name: Display prover logs on failure + if: failure() + run: | + echo "=== Displaying prover logs ===" + find . -path "*/test-ledger/*prover*.log" -type f -exec echo "=== Contents of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; || echo "No prover logs found" diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml deleted file mode 100644 index e9a00443a1..0000000000 --- a/.github/workflows/js.yml +++ /dev/null @@ -1,98 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - "*" - types: - - opened - - synchronize - - reopened - - ready_for_review - -name: js-tests-v1 - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - stateless-js-v1: - name: stateless-js-v1 - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - - services: - redis: - image: redis:8.0.1 - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - env: - LIGHT_PROTOCOL_VERSION: V1 - REDIS_URL: redis://localhost:6379 - CI: true - - steps: - - name: Checkout sources - uses: actions/checkout@v6 - with: - submodules: true - - - name: Setup and build - uses: ./.github/actions/setup-and-build - with: - skip-components: "redis,disk-cleanup,go" - cache-key: "js" - - - name: Build stateless.js with V1 - run: | - cd js/stateless.js - pnpm build:v1 - - - name: Build compressed-token with V1 - run: | - cd js/compressed-token - pnpm build:v1 - - - name: Build CLI - run: | - just cli build - - - name: Run stateless.js tests with V1 - run: | - echo "Running stateless.js tests with retry logic (max 2 attempts)..." - attempt=1 - max_attempts=2 - until just js test-stateless; do - attempt=$((attempt + 1)) - if [ $attempt -gt $max_attempts ]; then - echo "Tests failed after $max_attempts attempts" - exit 1 - fi - echo "Attempt $attempt/$max_attempts failed, retrying..." - sleep 5 - done - echo "Tests passed on attempt $attempt" - - - name: Run compressed-token tests with V1 - run: | - echo "Running compressed-token tests with retry logic (max 2 attempts)..." - attempt=1 - max_attempts=2 - until just js test-compressed-token; do - attempt=$((attempt + 1)) - if [ $attempt -gt $max_attempts ]; then - echo "Tests failed after $max_attempts attempts" - exit 1 - fi - echo "Attempt $attempt/$max_attempts failed, retrying..." - sleep 5 - done - echo "Tests passed on attempt $attempt" diff --git a/.github/workflows/programs.yml b/.github/workflows/programs.yml index 59ea010058..684e87a23f 100644 --- a/.github/workflows/programs.yml +++ b/.github/workflows/programs.yml @@ -32,10 +32,49 @@ concurrency: cancel-in-progress: true jobs: - system-programs: + build: + name: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup and build + uses: ./.github/actions/setup-and-build + with: + skip-components: "redis,disk-cleanup,go" + cache-key: "rust" + + - name: Build CLI + run: | + just cli build + + - name: Package build artifacts + run: | + DIRS=() + for d in target/deploy target/idl target/types cli/bin cli/dist js/stateless.js/dist js/compressed-token/dist; do + [ -d "$d" ] && DIRS+=("$d") + done + tar -czf build-artifacts.tar.gz "${DIRS[@]}" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: programs-build-artifacts + path: build-artifacts.tar.gz + retention-days: 1 + compression-level: 0 + + test: name: ${{ matrix.test-group }} + needs: build if: github.event.pull_request.draft == false - runs-on: warp-ubuntu-latest-x64-4x + runs-on: ubuntu-latest timeout-minutes: 90 services: @@ -70,15 +109,10 @@ jobs: with: submodules: true - - name: Setup and build - uses: ./.github/actions/setup-and-build + - name: Setup test runner + uses: ./.github/actions/setup-test-runner with: - skip-components: "redis,disk-cleanup" - cache-key: "rust" - - - name: Build CLI - run: | - just cli build + build-artifact-name: programs-build-artifacts - name: Run tests working-directory: program-tests diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 540f2a3f3f..660e09db2c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,6 +18,9 @@ on: - ".github/workflows/rust.yml" types: [opened, synchronize, reopened, ready_for_review] +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -27,9 +30,47 @@ env: RUSTFLAGS: "-D warnings" jobs: + build: + name: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup and build + uses: ./.github/actions/setup-and-build + with: + skip-components: "redis,disk-cleanup,go" + cache-key: "rust" + + - name: Build CLI + run: | + just cli build + + - name: Package build artifacts + run: | + DIRS=() + for d in target/deploy target/idl target/types cli/bin cli/dist js/stateless.js/dist js/compressed-token/dist; do + [ -d "$d" ] && DIRS+=("$d") + done + tar -czf build-artifacts.tar.gz "${DIRS[@]}" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: rust-build-artifacts + path: build-artifacts.tar.gz + retention-days: 1 + compression-level: 0 + test: if: github.event.pull_request.draft == false - runs-on: warp-ubuntu-latest-x64-4x + needs: build + runs-on: ubuntu-latest strategy: matrix: @@ -62,15 +103,10 @@ jobs: with: submodules: true - - name: Setup and build - uses: ./.github/actions/setup-and-build + - name: Setup test runner + uses: ./.github/actions/setup-test-runner with: - skip-components: "redis,disk-cleanup,go" - cache-key: "rust" - - - name: Build CLI - run: | - just cli build + build-artifact-name: rust-build-artifacts - name: Run tests for ${{ matrix.group.name }} run: | diff --git a/.github/workflows/sdk-tests.yml b/.github/workflows/sdk-tests.yml index c7b6f542d8..0c8bfe7a84 100644 --- a/.github/workflows/sdk-tests.yml +++ b/.github/workflows/sdk-tests.yml @@ -19,13 +19,55 @@ on: name: examples-tests +permissions: + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - system-programs: - name: system-programs + build: + name: build + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup and build + uses: ./.github/actions/setup-and-build + with: + skip-components: "redis,disk-cleanup,go" + cache-key: "rust" + + - name: Build CLI + run: | + just cli build + + - name: Package build artifacts + run: | + DIRS=() + for d in target/deploy target/idl target/types cli/bin cli/dist js/stateless.js/dist js/compressed-token/dist; do + [ -d "$d" ] && DIRS+=("$d") + done + tar -czf build-artifacts.tar.gz "${DIRS[@]}" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: sdk-tests-build-artifacts + path: build-artifacts.tar.gz + retention-days: 1 + compression-level: 0 + + test: + name: ${{ matrix.program }} + needs: build if: github.event.pull_request.draft == false runs-on: ubuntu-latest timeout-minutes: 60 @@ -57,21 +99,17 @@ jobs: sub-tests: '["cargo-test-sbf -p sdk-token-test", "cargo-test-sbf -p token-client-test"]' - program: sdk-libs test_cmd: just sdk-libs test + steps: - name: Checkout sources uses: actions/checkout@v6 with: submodules: true - - name: Setup and build - uses: ./.github/actions/setup-and-build + - name: Setup test runner + uses: ./.github/actions/setup-test-runner with: - skip-components: "redis,disk-cleanup,go" - cache-key: "rust" - - - name: Build CLI - run: | - just cli build + build-artifact-name: sdk-tests-build-artifacts - name: Install bun if: matrix.program == 'sdk-libs' diff --git a/js/compressed-token/CHANGELOG.md b/js/compressed-token/CHANGELOG.md index 35beb46c54..44c6eda8a7 100644 --- a/js/compressed-token/CHANGELOG.md +++ b/js/compressed-token/CHANGELOG.md @@ -60,11 +60,13 @@ const ix = await CompressedTokenProgram.decompress({ - new type: TokenPoolInfo - Instruction Changes: + - `compress`, `mintTo`, `approveAndMintTo`, `compressSplTokenAccount` now require valid TokenPoolInfo - `decompress` now requires an array of one or more TokenPoolInfos. - `decompress`, `transfer` now do not allow state tree overrides. - Action Changes: + - Removed optional tokenProgramId: PublicKey - removed optional merkleTree: PublicKey - removed optional outputStateTree: PublicKey diff --git a/js/stateless.js/CHANGELOG.md b/js/stateless.js/CHANGELOG.md index 0b853bd9eb..a079b46073 100644 --- a/js/stateless.js/CHANGELOG.md +++ b/js/stateless.js/CHANGELOG.md @@ -185,6 +185,7 @@ Fixed a bug where we lose precision on token amounts if compressed token account ### Added - Multiple State Tree support. Allows you to pass non-default state tree pubkeys to actions and instructions. Comes out of the box with public state trees. + - `pickRandomStateTreeAndQueue` - `getLightStateTreeInfo` diff --git a/scripts/lint.sh b/scripts/lint.sh index 80dfd168d8..5c56f77d8e 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -26,113 +26,127 @@ done echo "Testing feature combinations..." -# Test no-default-features for all library crates -echo "Testing all library crates with --no-default-features..." -NO_DEFAULT_CRATES=( - "light-account-checks" - "light-batched-merkle-tree" - "light-bloom-filter" - "light-compressed-account" - "light-compressible" - "light-concurrent-merkle-tree" - "light-token-interface" - "light-hash-set" - "light-hasher" - "light-indexed-merkle-tree" - "light-macros" - "light-merkle-tree-metadata" - "light-verifier" - "light-zero-copy" - "light-heap" - "light-array-map" - "light-indexed-array" - "aligned-sized" - "light-sdk-types" - "light-sdk-pinocchio" - "light-token-pinocchio" - "light-sdk-macros" - "light-token" - "light-token-types" - "light-sdk" - "light-account" - "light-account-pinocchio" - "light-client" - "light-compressed-token-sdk" - "light-instruction-decoder" - "light-program-test" - "light-token-client" - "csdk-anchor-full-derived-test" -) +# Batched feature checks - cargo can check multiple -p flags in one invocation, +# sharing compilation work and drastically reducing wall-clock time. -for crate in "${NO_DEFAULT_CRATES[@]}"; do - echo "Checking $crate with --no-default-features..." - cargo check -p "$crate" --no-default-features -done - -# Test pinocchio feature for all crates that have it -PINOCCHIO_CRATES=( - "light-hasher" - "light-indexed-merkle-tree" - "light-zero-copy" - "light-bloom-filter" - "light-compressed-account" - "light-merkle-tree-metadata" - "light-macros" - "light-batched-merkle-tree" - "light-concurrent-merkle-tree" - "light-verifier" - "light-account-checks" - "light-compressible" -) - -for crate in "${PINOCCHIO_CRATES[@]}"; do - echo "Checking $crate with pinocchio feature..." - cargo check -p "$crate" --features pinocchio -done +echo "Checking all library crates with --no-default-features..." +cargo check \ + -p light-account-checks \ + -p light-batched-merkle-tree \ + -p light-bloom-filter \ + -p light-compressed-account \ + -p light-compressible \ + -p light-concurrent-merkle-tree \ + -p light-token-interface \ + -p light-hash-set \ + -p light-hasher \ + -p light-indexed-merkle-tree \ + -p light-macros \ + -p light-merkle-tree-metadata \ + -p light-verifier \ + -p light-zero-copy \ + -p light-heap \ + -p light-array-map \ + -p light-indexed-array \ + -p aligned-sized \ + -p light-sdk-types \ + -p light-sdk-pinocchio \ + -p light-token-pinocchio \ + -p light-sdk-macros \ + -p light-token \ + -p light-token-types \ + -p light-sdk \ + -p light-account \ + -p light-account-pinocchio \ + -p light-client \ + -p light-compressed-token-sdk \ + -p light-instruction-decoder \ + -p light-program-test \ + -p light-token-client \ + -p csdk-anchor-full-derived-test \ + --no-default-features -# Test solana feature for all crates that have it -SOLANA_CRATES=( - "light-hasher" - "light-indexed-merkle-tree" - "light-zero-copy" - "light-bloom-filter" - "light-compressed-account" - "light-hash-set" - "light-merkle-tree-metadata" - "light-token-interface" - "light-macros" - "light-batched-merkle-tree" - "light-concurrent-merkle-tree" - "light-verifier" - "light-account-checks" - "light-compressible" -) +echo "Checking pinocchio feature..." +cargo check \ + -p light-hasher \ + -p light-indexed-merkle-tree \ + -p light-zero-copy \ + -p light-bloom-filter \ + -p light-compressed-account \ + -p light-merkle-tree-metadata \ + -p light-macros \ + -p light-batched-merkle-tree \ + -p light-concurrent-merkle-tree \ + -p light-verifier \ + -p light-account-checks \ + -p light-compressible \ + --features pinocchio -for crate in "${SOLANA_CRATES[@]}"; do - echo "Checking $crate with solana feature..." - cargo check -p "$crate" --features solana -done - -# Test anchor feature for all crates that have it -ANCHOR_CRATES=( - "light-indexed-merkle-tree" - "light-compressed-account" - "light-merkle-tree-metadata" - "light-token-interface" - "light-verifier" - "light-compressible" - "light-sdk-types" - "light-sdk" - "light-token" - "light-token-types" -) +echo "Checking solana feature..." +cargo check \ + -p light-hasher \ + -p light-indexed-merkle-tree \ + -p light-zero-copy \ + -p light-bloom-filter \ + -p light-compressed-account \ + -p light-hash-set \ + -p light-merkle-tree-metadata \ + -p light-token-interface \ + -p light-macros \ + -p light-batched-merkle-tree \ + -p light-concurrent-merkle-tree \ + -p light-verifier \ + -p light-account-checks \ + -p light-compressible \ + --features solana -for crate in "${ANCHOR_CRATES[@]}"; do - echo "Checking $crate with anchor feature..." - cargo check -p "$crate" --features anchor -done +echo "Checking anchor feature..." +cargo check \ + -p light-indexed-merkle-tree \ + -p light-compressed-account \ + -p light-merkle-tree-metadata \ + -p light-token-interface \ + -p light-verifier \ + -p light-compressible \ + -p light-sdk-types \ + -p light-sdk \ + -p light-token \ + -p light-token-types \ + --features anchor -for crate in "${NO_DEFAULT_CRATES[@]}"; do - echo "Checking $crate with --no-default-features..." - cargo test -p "$crate" --no-run -done +echo "Checking all library crates compile tests..." +cargo test \ + -p light-account-checks \ + -p light-batched-merkle-tree \ + -p light-bloom-filter \ + -p light-compressed-account \ + -p light-compressible \ + -p light-concurrent-merkle-tree \ + -p light-token-interface \ + -p light-hash-set \ + -p light-hasher \ + -p light-indexed-merkle-tree \ + -p light-macros \ + -p light-merkle-tree-metadata \ + -p light-verifier \ + -p light-zero-copy \ + -p light-heap \ + -p light-array-map \ + -p light-indexed-array \ + -p aligned-sized \ + -p light-sdk-types \ + -p light-sdk-pinocchio \ + -p light-token-pinocchio \ + -p light-sdk-macros \ + -p light-token \ + -p light-token-types \ + -p light-sdk \ + -p light-account \ + -p light-account-pinocchio \ + -p light-client \ + -p light-compressed-token-sdk \ + -p light-instruction-decoder \ + -p light-program-test \ + -p light-token-client \ + -p csdk-anchor-full-derived-test \ + --no-run