Merge pull request #203 from blockworks-foundation/improve-ci-github-actions
Improve ci GitHub actions
This commit is contained in:
commit
2e7a617a6e
|
@ -4,52 +4,53 @@ on:
|
|||
push:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
SCCACHE_GHA_ENABLED: true
|
||||
RUSTC_WRAPPER: sccache
|
||||
SCCACHE_CACHE_SIZE: "1G"
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
name: Rust project - latest
|
||||
runs-on: ubuntu-latest
|
||||
name: lite-rpc full build
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Install Dependencies
|
||||
- name: Install Linux Packages
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install libssl-dev openssl -y
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# The toolchain action should definitely be run before the cache action
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
# use toolchain version from rust-toolchain.toml
|
||||
components: rustfmt, clippy
|
||||
cache: true
|
||||
# avoid the default "-D warnings" which thrashes cache
|
||||
rustflags: ""
|
||||
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.3
|
||||
|
||||
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
|
||||
# https://blog.arriven.wtf/posts/rust-ci-cache/
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# will be covered by sscache
|
||||
cache-targets: false
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
|
||||
- name: Early Build
|
||||
run: cargo build --workspace --tests
|
||||
run: |
|
||||
cargo build --locked --workspace --all-targets
|
||||
|
||||
- name: Check Rust Code Format
|
||||
run: cargo fmt -- --check
|
||||
|
||||
- name: Run Rust Clippy
|
||||
run: cargo clippy --all-targets -- -D warnings
|
||||
- name: Run fmt+clippy
|
||||
run: |
|
||||
cargo fmt --all --check
|
||||
cargo clippy --locked --workspace --all-targets
|
||||
|
||||
- name: Run Tests
|
||||
run: RUST_LOG=info cargo test
|
||||
|
||||
- name: Install node deps
|
||||
run: yarn
|
||||
|
||||
- name: Setup validator
|
||||
run: |
|
||||
sh -c "$(curl -sSfL https://release.solana.com/v1.15.2/install)"
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
||||
ls "$HOME/.local/share/solana/install/active_release/bin"
|
||||
echo "Solana Cli installed"
|
||||
solana --version
|
||||
echo "Generating keypair..."
|
||||
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent
|
||||
solana config set --url "http://0.0.0.0:8899"
|
||||
|
||||
- name: Run and Test
|
||||
run: |
|
||||
bash ./test.bash
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
name: Integration Test with Validator
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
SCCACHE_GHA_ENABLED: true
|
||||
RUSTC_WRAPPER: sccache
|
||||
SCCACHE_CACHE_SIZE: "1G"
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
name: Test lite-rpc against running Validator
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Install Linux Packages
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install libssl-dev openssl -y
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# The toolchain action should definitely be run before the cache action
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
# use toolchain version from rust-toolchain.toml
|
||||
components: rustfmt, clippy
|
||||
cache: true
|
||||
# avoid the default "-D warnings" which thrashes cache
|
||||
rustflags: ""
|
||||
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.3
|
||||
|
||||
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
|
||||
# https://blog.arriven.wtf/posts/rust-ci-cache/
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# will be covered by sscache
|
||||
cache-targets: false
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Install node deps
|
||||
run: yarn
|
||||
|
||||
- name: Setup Solana Validator v1.16.13
|
||||
run: |
|
||||
sh -c "$(curl -sSfL https://release.solana.com/v1.16.13/install)"
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
||||
ls "$HOME/.local/share/solana/install/active_release/bin"
|
||||
echo "Solana Cli installed"
|
||||
solana --version
|
||||
echo "Generating keypair..."
|
||||
solana-keygen new -o "$HOME/.config/solana/id.json" --no-passphrase --silent
|
||||
solana config set --url "http://0.0.0.0:8899"
|
||||
|
||||
- name: Run and Test
|
||||
run: |
|
||||
bash ./test.bash
|
|
@ -94,6 +94,7 @@ pub fn small_tx_batch_unstake_direct() {
|
|||
});
|
||||
}
|
||||
|
||||
#[ignore]
|
||||
#[test]
|
||||
pub fn with_100_transactions_direct() {
|
||||
configure_logging(false);
|
||||
|
@ -105,6 +106,7 @@ pub fn with_100_transactions_direct() {
|
|||
});
|
||||
}
|
||||
|
||||
#[ignore]
|
||||
#[test]
|
||||
pub fn with_1000_transactions_direct() {
|
||||
configure_logging(false);
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "1.70.0"
|
|
@ -4,7 +4,7 @@
|
|||
trap 'kill $(jobs -pr)' SIGINT SIGTERM EXIT
|
||||
|
||||
echo "Doing an early build"
|
||||
cargo build --workspace --tests
|
||||
cargo build --bin lite-rpc --tests
|
||||
yarn
|
||||
|
||||
echo "Switching to local lite-rpc rpc config"
|
||||
|
@ -17,7 +17,7 @@ echo "Air Dropping 10000 sol"
|
|||
sleep 20 && solana airdrop 10000
|
||||
|
||||
echo "Starting LiteRpc"
|
||||
cargo run &
|
||||
cargo run --bin lite-rpc &
|
||||
|
||||
echo "Running cargo tests in 20s"
|
||||
sleep 20 && cargo test
|
||||
|
|
Loading…
Reference in New Issue