-
Notifications
You must be signed in to change notification settings - Fork 483
feat: steel clippy fmt and contributing guidelines #326
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
+171
−36
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4e4a97a
steel clippy fmt and contributing guidelines
heyAyushh 8c74d41
clippy and fmt run fix, steel workspace check
heyAyushh cda04aa
fixes
heyAyushh e395585
fixes returns
heyAyushh 3bc30ae
fixes 3: starting of the end
heyAyushh ebd36df
Improve contributing
heyAyushh 52a4231
added pnpm change
heyAyushh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,40 @@ jobs: | |
| echo "matrix=[$(echo $indices | tr ' ' ',')]" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| rust-checks: | ||
| needs: changes | ||
| if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.total_projects != '0' }} | ||
| name: Rust Checks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt, clippy | ||
| - name: Run sccache-cache | ||
| if: github.event_name != 'release' | ||
| uses: mozilla-actions/[email protected] | ||
| - name: Set Rust cache env vars | ||
| if: github.event_name != 'release' | ||
| run: | | ||
| echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
| - name: Run fmt and clippy | ||
| run: | | ||
| readarray -t all_projects < <(echo '${{ needs.changes.outputs.changed_projects }}' | jq -r '.[]?') | ||
| for project in "${all_projects[@]}"; do | ||
| echo "::group::Checking ${project}" | ||
| if [ ! -f "${project}/Cargo.toml" ]; then | ||
| echo "::error::No Cargo.toml found in ${project}" | ||
| exit 1 | ||
| fi | ||
| cd "${project}" | ||
| cargo fmt --check | ||
| cargo clippy --all-features -- -D warnings | ||
| cd - > /dev/null | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| build-and-test: | ||
| needs: changes | ||
| if: needs.changes.outputs.total_projects != '0' | ||
|
|
@@ -103,6 +137,19 @@ jobs: | |
| failed_projects: ${{ steps.set-failed.outputs.failed_projects }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - name: Run sccache-cache | ||
| if: github.event_name != 'release' | ||
| uses: mozilla-actions/[email protected] | ||
| - name: Set Rust cache env vars | ||
| if: github.event_name != 'release' | ||
| run: | | ||
| echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | ||
| - uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.cargo/bin/steel | ||
| key: ${{ runner.os }}-steel-cli | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
|
|
@@ -111,6 +158,8 @@ jobs: | |
| - name: Setup build environment | ||
| id: setup | ||
| run: | | ||
| npm install --global pnpm | ||
|
|
||
| # Create the build and test function | ||
| cat << 'EOF' > build_and_test.sh | ||
| function build_and_test() { | ||
|
|
@@ -120,27 +169,53 @@ jobs: | |
| cd "$project" || return 1 | ||
|
|
||
| # Install dependencies | ||
| if ! pnpm install --frozen-lockfile; then | ||
| echo "::error::pnpm install failed for $project" | ||
| echo "$project: pnpm install failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
| if [ -f "package.json" ]; then | ||
| if ! pnpm install --frozen-lockfile; then | ||
| echo "::error::pnpm install failed for $project" | ||
| echo "$project: pnpm install failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
|
|
||
| # Build | ||
| if ! pnpm build; then | ||
| echo "::error::build failed for $project" | ||
| echo "$project: build failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
| # Build | ||
| if ! pnpm build; then | ||
| echo "::error::build failed for $project" | ||
| echo "$project: build failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
|
|
||
| # Test | ||
| if ! pnpm build-and-test; then | ||
| echo "::error::tests failed for $project" | ||
| echo "$project: tests failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| # Test | ||
| if ! pnpm build-and-test; then | ||
| echo "::error::tests failed for $project" | ||
| echo "$project: tests failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
| else | ||
| # Use Steel CLI | ||
| if ! cargo install --quiet steel-cli; then | ||
| echo "::error::steel-cli installation failed for $project" | ||
| echo "$project: steel-cli installation failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
|
|
||
| # Build | ||
| if ! steel build; then | ||
| echo "::error::steel build failed for $project" | ||
| echo "$project: steel build failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
|
|
||
| # Test | ||
| if ! steel test; then | ||
| echo "::error::steel test failed for $project" | ||
| echo "$project: steel test failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt | ||
| cd - > /dev/null | ||
| return 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "Build and tests succeeded for $project with $solana_version version." | ||
|
|
@@ -177,28 +252,34 @@ jobs: | |
| # Make the script executable | ||
| chmod +x build_and_test.sh | ||
|
|
||
| # Install pnpm | ||
| npm install --global pnpm | ||
| - name: Setup Solana stable | ||
| uses: heyAyushh/[email protected] | ||
| with: | ||
| solana-cli-version: stable | ||
| - name: Build and Test with Stable | ||
| env: | ||
| SCCACHE_GHA_ENABLED: "true" | ||
| RUSTC_WRAPPER: "sccache" | ||
| run: | | ||
| source build_and_test.sh | ||
| solana -V | ||
| rustc -V | ||
| process_projects "stable" | ||
| sccache --show-stats | ||
| - name: Setup Solana 1.18.17 | ||
| uses: heyAyushh/[email protected] | ||
| with: | ||
| solana-cli-version: 1.18.17 | ||
| - name: Build and Test with 1.18.17 | ||
| env: | ||
| SCCACHE_GHA_ENABLED: "true" | ||
| RUSTC_WRAPPER: "sccache" | ||
| run: | | ||
| source build_and_test.sh | ||
| solana -V | ||
| rustc -V | ||
| process_projects "1.18.17" | ||
| sccache --show-stats | ||
|
|
||
| - name: Set failed projects output | ||
| id: set-failed | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| [workspace] | ||
| resolver = "2" | ||
| members = ["program"] | ||
|
|
||
| [workspace.package] | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| license = "Apache-2.0" | ||
| homepage = "" | ||
| documentation = "" | ||
| repository = "" | ||
| readme = "./README.md" | ||
| keywords = ["solana"] | ||
|
|
||
| [workspace.dependencies] | ||
| bytemuck = "1.14" | ||
| num_enum = "0.7" | ||
| solana-program = "1.18" | ||
| steel = "2.0" | ||
| thiserror = "1.0" | ||
| solana-sdk = "1.18" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.