-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci and test fix
- Loading branch information
Showing
7 changed files
with
170 additions
and
53 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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,93 @@ | ||
name: Rust CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
SOLANA_VERSION: "1.14.12" | ||
RUST_STABLE_VERSION: "1.66.1" | ||
|
||
defaults: | ||
run: | ||
working-directory: ./ | ||
|
||
jobs: | ||
lint: | ||
name: Linter | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install stable Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ env.RUST_STABLE_VERSION }} | ||
components: clippy | ||
cache: true | ||
|
||
- name: Install nightly Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
cache: true | ||
|
||
- name: Set default Rust toolchain | ||
run: | | ||
rustup show | ||
rustup override set ${{ env.RUST_STABLE_VERSION }} | ||
- name: Run fmt | ||
run: cargo +nightly fmt -- --check | ||
|
||
- name: Run clippy | ||
run: cargo clippy --all-targets --all-features --workspace -- -D warnings --allow=clippy::result_large_err --allow=clippy::await_holding_refcell_ref | ||
|
||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Linux dependencies | ||
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev | ||
|
||
- name: Install stable Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ env.RUST_STABLE_VERSION }} | ||
cache: true | ||
|
||
- name: Cache Solana binaries | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/solana | ||
key: ${{ runner.os }}-${{ env.RUST_STABLE_VERSION }} | ||
|
||
- name: Install Solana | ||
run: | | ||
sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_VERSION }}/install)" | ||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | ||
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" | ||
solana --version | ||
echo "Generating keypair..." | ||
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent | ||
- name: Switch toolchain | ||
run: | | ||
rustup override set ${{ env.RUST_STABLE_VERSION }} | ||
solana-install init ${{ env.SOLANA_VERSION }} | ||
- name: Append to Cargo.toml | ||
run: | | ||
echo "[profile.dev]" >> Cargo.toml | ||
echo "debug = 0" >> Cargo.toml | ||
- name: Run tests | ||
run: cargo test-bpf |
This file contains 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 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 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 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 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