Skip to content

Introduce Steel framework in program-examples #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 8, 2024
Merged
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
117 changes: 117 additions & 0 deletions .github/workflows/steel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Steel

on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
solana-version: [stable]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- uses: heyAyushh/setup-solana@v5.4
with:
solana-cli-version: ${{ matrix.solana-version }}
- run: solana block
shell: bash
- name: Install pnpm
run: |
npm install --global pnpm
- name: Build Steel native programs
run: |
declare -a ProjectDirs=($(find . -type d -name "steel"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
echo "Projects to Build:"
printf "%s\n" "${ProjectDirs[@]}"
for projectDir in "${ProjectDirs[@]}"; do
echo "
********
Building $projectDir
********"
cd $projectDir
if pnpm build; then
echo "Build succeeded for $projectDir."
else
failed=true
failed_builds+=($projectDir)
echo "Build failed for $projectDir. Continuing with the next program."
fi
cd - > /dev/null
done
if [ "$failed" = true ]; then
echo "Programs that failed building:"
printf "%s\n" "${failed_builds[@]}"
exit 1
else
echo "All programs built successfully."
fi
shell: bash

test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
solana-version: [1.18.17, stable]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- uses: heyAyushh/setup-solana@v5.4
with:
solana-cli-version: ${{ matrix.solana-version }}
- run: solana block
shell: bash
- name: Install pnpm
run: |
npm install --global pnpm
- name: Test Steel native programs
run: |
solana -V
rustc -V
declare -a ProjectDirs=($(find . -type d -name "steel"| grep -v -f <(grep . .github/.ghaignore | grep -v '^$')))
echo "Projects to Test:"
printf "%s\n" "${ProjectDirs[@]}"
for projectDir in "${ProjectDirs[@]}"; do
echo "
********
Testing $projectDir
********"
cd $projectDir
pnpm install --frozen-lockfile
if pnpm build-and-test; then
echo "Tests succeeded for $projectDir."
else
failed=true
failed_tests+=($projectDir)
echo "Tests failed for $projectDir. Continuing with the next program."
fi
cd - > /dev/null
done
if [ "$failed" = true ]; then
echo "*****************************"
echo "Programs that failed testing:"
printf "%s\n" "${failed_tests[@]}"
exit 1
else
echo "All tests passed."
fi
shell: bash
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ When contributing code examples, please follow these guidelines to ensure progra

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).
3. Tests for Solana native, Steel and Anchor programs should be written with [ts-mocha](https://github.com/piotrwitek/ts-mocha).

4. Tests for solana native programs should be written with [solana-bankrun](https://kevinheavey.github.io/solana-bankrun)
4. Tests for solana native programs and steel framework programs should be written with [solana-bankrun](https://kevinheavey.github.io/solana-bankrun)

5. For Solana native programs ensure adding these mandatory pnpm run scripts to your `package.json`. file for successful ci/cd builds:
5. For Solana native programs and Steel framework programs ensure adding these mandatory pnpm run scripts to your `package.json`. file for successful ci/cd builds:

```json
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"basics/cross-program-invocation/anchor/programs/*",
"basics/hello-solana/native/program",
"basics/hello-solana/anchor/programs/*",
"basics/hello-solana/steel/program",
"basics/pda-rent-payer/native/program",
"basics/pda-rent-payer/anchor/programs/*",
"basics/processing-instructions/native/program",
Expand Down
Loading