diff --git a/.github/.ghaignore b/.github/.ghaignore index bcff41972..b2da530d8 100644 --- a/.github/.ghaignore +++ b/.github/.ghaignore @@ -64,4 +64,4 @@ tokens/escrow/steel tokens/pda-mint-authority/steel tokens/spl-token-minter/steel tokens/token-swap/steel -tokens/transfer-tokens/steel \ No newline at end of file +tokens/transfer-tokens/steel diff --git a/.github/workflows/anchor.yml b/.github/workflows/anchor.yml index 9b606c95d..c9213863e 100644 --- a/.github/workflows/anchor.yml +++ b/.github/workflows/anchor.yml @@ -6,8 +6,6 @@ on: push: branches: - main - - anchor-1.0 - - fix-biome-errors pull_request: types: [opened, synchronize, reopened] branches: @@ -17,10 +15,6 @@ env: MAX_JOBS: 64 MIN_PROJECTS_PER_JOB: 4 MIN_PROJECTS_FOR_MATRIX: 4 - # Force all JavaScript-based actions to use Node.js 24 runtime. - # Node.js 20 actions are deprecated and will stop working June 2026. - # This catches composite actions whose internal dependencies still reference @v4. - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: changes: @@ -110,18 +104,20 @@ jobs: failed_projects: ${{ steps.set-failed.outputs.failed_projects }} steps: - uses: actions/checkout@v5 + - uses: pnpm/action-setup@v4 + with: + version: 10 - uses: heyAyushh/setup-anchor@v4.999 with: anchor-version: 0.32.1 solana-cli-version: stable - - name: Display Versions and Install pnpm + - name: Display Versions run: | solana -V # it's okay to use --force in github action since all programs are tested in isolation solana-keygen new --no-bip39-passphrase --force rustc -V anchor -V - npm i -g pnpm - name: Build and Test env: TOTAL_PROJECTS: ${{ needs.changes.outputs.total_projects }} @@ -132,25 +128,26 @@ jobs: echo "Building and Testing $project" cd "$project" || return 1 - # Install dependencies first - if ! pnpm install --frozen-lockfile; then - echo "::error::pnpm install failed for $project" - echo "$project: pnpm install failed" >> $GITHUB_WORKSPACE/failed_projects.txt + # Build first — generates IDL and types that pnpm install/tests need + if ! anchor build; then + echo "::error::anchor build failed for $project" + echo "$project: anchor build failed" >> $GITHUB_WORKSPACE/failed_projects.txt + rm -rf target cd - > /dev/null return 1 fi - # Run anchor build - if ! anchor build; then - echo "::error::anchor build failed for $project" - echo "$project: anchor build failed" >> $GITHUB_WORKSPACE/failed_projects.txt + # Install dependencies (after build so generated types are available) + if ! pnpm install --frozen-lockfile; then + echo "::error::pnpm install failed for $project" + echo "$project: pnpm install failed" >> $GITHUB_WORKSPACE/failed_projects.txt rm -rf target cd - > /dev/null return 1 fi - # Run anchor test - if ! anchor test; then + # Run anchor test (--skip-build since we already built above) + if ! anchor test --skip-build; then echo "::error::anchor test failed for $project" echo "$project: anchor test failed" >> $GITHUB_WORKSPACE/failed_projects.txt rm -rf target node_modules diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 479939a96..b8d7aea81 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,19 +9,11 @@ on: push: branches: - main - - anchor-1.0 - - fix-biome-errors pull_request: types: [opened, synchronize, reopened] branches: - main -env: - # Force all JavaScript-based actions to use Node.js 24 runtime. - # Node.js 20 actions are deprecated and will stop working June 2026. - # This catches composite actions whose internal dependencies still reference @v4. - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true - # A workflow run is made up of one or more jobs, which run in parallel by default # Each job runs in a runner environment specified by runs-on jobs: diff --git a/.github/workflows/solana-native.yml b/.github/workflows/solana-native.yml index 8433af85f..7e820450b 100644 --- a/.github/workflows/solana-native.yml +++ b/.github/workflows/solana-native.yml @@ -6,7 +6,6 @@ on: push: branches: - main - - fix-biome-errors pull_request: types: [opened, synchronize, reopened] branches: @@ -16,10 +15,6 @@ env: MAX_JOBS: 64 MIN_PROJECTS_PER_JOB: 4 MIN_PROJECTS_FOR_MATRIX: 4 - # Force all JavaScript-based actions to use Node.js 24 runtime. - # Node.js 20 actions are deprecated and will stop working June 2026. - # This catches composite actions whose internal dependencies still reference @v4. - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: changes: diff --git a/.github/workflows/solana-pinocchio.yml b/.github/workflows/solana-pinocchio.yml index 2ec668298..fcaed4480 100644 --- a/.github/workflows/solana-pinocchio.yml +++ b/.github/workflows/solana-pinocchio.yml @@ -6,7 +6,6 @@ on: push: branches: - main - - fix-biome-errors pull_request: types: [opened, synchronize, reopened] branches: @@ -16,10 +15,6 @@ env: MAX_JOBS: 64 MIN_PROJECTS_PER_JOB: 4 MIN_PROJECTS_FOR_MATRIX: 4 - # Force all JavaScript-based actions to use Node.js 24 runtime. - # Node.js 20 actions are deprecated and will stop working June 2026. - # This catches composite actions whose internal dependencies still reference @v4. - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: changes: diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index b87e3d482..a22a19fcb 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -4,15 +4,11 @@ on: push: branches: - main - - fix-biome-errors pull_request: types: [opened, synchronize, reopened] branches: - main -env: - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true - jobs: biome: name: Biome check diff --git a/README.md b/README.md index e19d4b286..41fb73459 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ This repo contains Solana onchain programs (referred to as 'Smart Contracts' in > ⚠️ This repository uses **pnpm** as the default package manager. > Ensure pnpm is installed before running any examples. - Each folder includes examples for one or more of the following: - `anchor` - Written using [Anchor](https://www.anchor-lang.com/), the most popular framework for Solana development, which uses Rust. @@ -27,14 +26,10 @@ Each folder includes examples for one or more of the following: Build and test commands are the same as native examples. Run `pnpm test` to execute tests. - **If a given example is missing, please send us a PR to add it!** Our aim is to have every example available in every option. We'd also love to see more programs involving staking, wrapped tokens, oracles, compression and VRF. Follow the [contributing guidelines](./CONTRIBUTING.md) to keep things consistent. ## The example programs - -
- Basics - +## Basics ### Hello world [Hello World on Solana! A minimal program that logs a greeting.](./basics/hello-solana/README.md) @@ -124,11 +119,7 @@ How to store state that changes size in Solana. [Send SOL between two accounts.](./basics/transfer-sol/README.md) [anchor](./basics/transfer-sol/anchor) [native](./basics/transfer-sol/native) [pinocchio](./basics/transfer-sol/pinocchio) - -
-
- Tokens - +## Tokens ### Creating tokens [Create a token on Solana with a token symbol and icon.](./tokens/create-token/README.md) @@ -170,13 +161,7 @@ Allow two users to swap digital assets with each other, each getting 100% of wha [Create liquidity pools to allow trading of new digital assets and allows users that provide liquidity to be rewarded by creating an Automated Market Maker.](./tokens/token-swap/README.md) [anchor](./tokens/token-swap/anchor) - -
- -
- - Token Extensions - +## Token Extensions ### Basics - create token mints, mint tokens, and transfer tokens with Token Extensions Create token mints, mint tokens, and transfer tokens using Token Extensions. @@ -254,12 +239,7 @@ Create tokens that remain under the control of an account, even when transferred Create tokens with an inbuilt transfer fee. [anchor](./tokens/token-2022/transfer-fee/anchor) [native](./tokens/token-2022/transfer-fee/native) - -
-
- -Compression - +## Compression ### Cnft-burn Burn compressed NFTs. @@ -277,19 +257,11 @@ Store Metaplex compressed NFTs inside a PDA. Work with Metaplex compressed NFTs. [anchor](./compression/cutils/anchor) - -
- -
- -Oracles - +## Oracles ### pyth Use a data source for offchain data (called an Oracle) to perform activities onchain. [anchor](./oracles/pyth/anchor) -
- ---