Skip to content

Commit

Permalink
Merge branch 'solana-developers:main' into build-sbf
Browse files Browse the repository at this point in the history
  • Loading branch information
heyAyushh authored Jul 18, 2024
2 parents e5da768 + c7c58ae commit fed9b56
Show file tree
Hide file tree
Showing 37 changed files with 2,037 additions and 176 deletions.
5 changes: 5 additions & 0 deletions .github/.ghaignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ compression/cutils/anchor
compression/cnft-vault/anchor
# builds but need to test on localhost
compression/cnft-burn/anchor

# not building due to > spl 2.0 dependency issue
tokens/token-2022/group/anchor
tokens/token-2022/nft-meta-data-pointer/anchor-example/anchor
tokens/escrow/anchor
19 changes: 9 additions & 10 deletions .github/workflows/anchor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
node-version: [20.x]
solana-version: [1.18.8, stable]
solana-version: [1.18.17, stable]
anchor-version: [0.30.1]
steps:
- uses: actions/checkout@v4
Expand All @@ -35,8 +35,8 @@ jobs:
- added|modified: '**/workflows/anchor.yml'
- name: Setup Anchor
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
uses: heyAyushh/setup-anchor@v3.10
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule' || github.event_name == 'push'
uses: heyAyushh/setup-anchor@v3.12
with:
anchor-version: ${{ matrix.anchor-version }}
solana-cli-version: ${{ matrix.solana-version }}
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
shell: bash
# Skip Building all Programs if it's a PR to main branch
- name: Build All Anchor programs
if: github.event_name == 'schedule' || steps.changes.outputs.anchor_action == 'true'
if: github.event_name == 'schedule' || github.event_name == 'push' || steps.changes.outputs.anchor_action == 'true'
run: |
# Find all anchor projects and remove ignored projects
declare -a ProjectDirs=($(find . -type d -name 'anchor' | sed 's|^\./||'| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
Expand Down Expand Up @@ -137,8 +137,8 @@ jobs:
strategy:
matrix:
node-version: [20.x]
solana-version: [1.18.8, stable]
anchor-version: [0.30.0]
solana-version: [1.18.17, stable]
anchor-version: [0.30.1]
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
Expand All @@ -153,8 +153,8 @@ jobs:
- added|modified: '**/workflows/anchor.yml'
# Skip Installing and Displaying versions if theres no change in anchor programs or anchor action workflow file or isn't a schedule event
- name: Setup Anchor
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule'
uses: heyAyushh/setup-anchor@v3.10
if: steps.changes.outputs.anchor == 'true' || steps.changes.outputs.anchor_action == 'true' || github.event_name == 'schedule' || github.event_name == 'push'
uses: heyAyushh/setup-anchor@v3.12
with:
anchor-version: ${{ matrix.anchor-version }}
solana-cli-version: ${{ matrix.solana-version }}
Expand All @@ -180,8 +180,7 @@ jobs:
Testing $projectDir
********"
cd $projectDir
pnpm install --frozen-lockfile
if anchor test; then
if pnpm install --frozen-lockfile && anchor test; then
echo "Tests succeeded for $projectDir."
rm -rf target node_modules
else
Expand Down
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# Contribution Guidelines

Thank you for considering contributing to the Solana Program Examples repository. We greatly appreciate your interest and efforts in helping us improve and expand this valuable resource for the Solana developer community.

We believe that a welcoming and inclusive environment fosters collaboration and encourages participation from developers of all backgrounds and skill levels.

To ensure a smooth and effective contribution process, please take a moment to review and follow the guidelines outlined below.

## How to Contribute

We welcome contributions in the form of code, documentation, bug reports, feature requests, and other forms of feedback. Here are some ways you can contribute:

- **Code Contributions:** You can contribute code examples in Rust, Python, or Solidity that demonstrate various Solana program functionalities. You can also contribute improvements to existing examples, such as bug fixes, optimizations, or additional features.

- **Bug Reports, Ideas or Feedback:** If you encounter any issues or have ideas for new examples, please submit a bug report or feature request. Your feedback is valuable and helps us improve the quality and relevance of the examples.

## Contributing code examples:

When contributing code examples, please follow these guidelines to ensure programs build and test successfully:

1. Use pnpm as the default package manager for the project. You can install pnpm by following the instructions [here](https://pnpm.io/installation). Commit pnpm-lock.yaml to the repository.
1. Use pnpm as the default package manager for the project. You can [install pnpm by following the instructions](https://pnpm.io/installation). Commit `pnpm-lock.yaml` to the repository.

2. Programs written for Solana Native should be in directory `native` and Anchor programs should be in directory `anchor`.
2. Anchor programs should be in directory `anchor`, programs written for Solana Native should be in directory `native`.

3. Tests for Solana native and Anchor programs should be written with [ts-mocha](https://github.com/piotrwitek/ts-mocha).

Expand All @@ -37,13 +40,14 @@ When contributing code examples, please follow these guidelines to ensure progra
6. Test command for anchor should execute `pnpm test` instead of `yarn run test` for anchor programs. Replace `yarn` with `pnpm` in `[script]` table inside [Anchor.toml file.](https://www.anchor-lang.com/docs/manifest#scripts-required-for-testing)

7. TypeScript, JavaScript and JSON files are formatted and linted using
[Biome](https://biomejs.dev/). Execute the following command to format and lint your code at the root of this project before submitting a pull request:
[Biome](https://biomejs.dev/). Execute the following command to format and lint your code at the root of this project before submitting a pull request:

```bash
pnpm check:fix
```

## Code of Conduct

We are committed to providing a friendly, safe, and welcoming environment for all contributors, regardless of their background, experience level, or personal characteristics. As a contributor, you are expected to:

Be respectful and inclusive in your interactions with others.
Expand Down
2 changes: 1 addition & 1 deletion basics/counter/seahorse/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ cluster = "localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2 changes: 1 addition & 1 deletion basics/favorites/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ cluster = "Localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2 changes: 1 addition & 1 deletion basics/hello-solana/seahorse/hello_solana/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ cluster = "localnet"
wallet = "/home/thefunnyintrovert/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2 changes: 1 addition & 1 deletion basics/transfer-sol/seahorse/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ cluster = "Localnet"
wallet = "/Users/devenv/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2 changes: 1 addition & 1 deletion compression/cnft-burn/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ cluster = "Devnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/cnft-burn.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/cnft-burn.ts"
2 changes: 1 addition & 1 deletion compression/cnft-vault/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ cluster = "Devnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
2 changes: 1 addition & 1 deletion compression/cutils/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ cluster = "devnet"
wallet = "~/.config/solana/test.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
52 changes: 0 additions & 52 deletions make-table-of-contents.ts

This file was deleted.

2 changes: 1 addition & 1 deletion oracles/pyth/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cluster = "Localnet"
wallet = "~/.config/solana/id.json"

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

[test.validator]
url = "https://api.mainnet-beta.solana.com"
Expand Down
2 changes: 1 addition & 1 deletion oracles/pyth/seahorse/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cluster = "Localnet"
wallet = "~/.config/solana/id.json"

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

[test.validator]
url = "https://api.mainnet-beta.solana.com"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "program-examples",
"version": "1.0.0",
"description": "### :crab: Rust. :snake: Python. :link: All on-chain.",
"description": "### :crab: Rust. :snake: Python. :link: All onchain.",
"scripts": {
"sync-package-json": "ts-node scripts/sync-package-json.ts",
"format:fix": "pnpx @biomejs/biome format --write ./",
Expand Down
2 changes: 1 addition & 1 deletion tokens/escrow/anchor/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ cluster = "Localnet"
wallet = "~/.config/solana/id.json"

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

0 comments on commit fed9b56

Please sign in to comment.