Skip to content
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

Improve CI run speed #120

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
43 changes: 0 additions & 43 deletions .github/workflows/pull-request-docs.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/pull-request-token-lending.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Token Lending Pull Request

on:
pull_request:
paths-ignore:
- 'docs/**'
push:
branches: [master]
paths-ignore:
- 'docs/**'

jobs:
cargo-test-sbf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}

- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-sbf-bins-${{ runner.os }}

- uses: actions/cache@v2
with:
path: ~/.cache/solana
key: solana-${{ env.SOLANA_VERSION }}

- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test
run: ./ci/cargo-test-sbf.sh token-lending

- name: Upload programs
uses: actions/upload-artifact@v2
with:
name: token-lending-programs
path: "target/deploy/*.so"
if-no-files-found: error
19 changes: 3 additions & 16 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Pull Request
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'docs/**'
push:
branches: [master]
paths-ignore:
- 'docs/**'
- 'docs/**'

jobs:
all_github_action_checks:
Expand All @@ -28,7 +28,6 @@ jobs:
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
Expand All @@ -51,7 +50,6 @@ jobs:
run: |
source ci/rust-version.sh
echo "RUST_NIGHTLY=$rust_nightly" >> $GITHUB_ENV

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_NIGHTLY }}
Expand All @@ -68,7 +66,6 @@ jobs:
key: cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-clippy-

- name: Install dependencies
run: ./ci/install-build-deps.sh

Expand All @@ -89,7 +86,6 @@ jobs:
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
Expand Down Expand Up @@ -121,14 +117,5 @@ jobs:
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

- name: Build and test
run: |
cargo test-bpf

- name: Upload programs
uses: actions/upload-artifact@v2
with:
name: programs
path: "target/deploy/*.so"
if-no-files-found: error
run: ./ci/cargo-build-test.sh
18 changes: 1 addition & 17 deletions ci/cargo-build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,15 @@ export RUSTBACKTRACE=1

set -x

# Build all C examples
make -C examples/c

# Build/test all BPF programs
cargo +"$rust_stable" test-bpf -- --nocapture
rm -rf target/debug # Prevents running out of space on github action runners

# Build/test all host crates
cargo +"$rust_stable" build
cargo +"$rust_stable" test -- --nocapture

# Run test-client sanity check
cargo +"$rust_stable" run --manifest-path=utils/test-client/Cargo.toml

# client_ristretto isn't in the workspace, test it explictly
# client_ristretto disabled because it requires RpcBanksService, which is no longer supported.
#cargo +"$rust_stable" test --manifest-path=themis/client_ristretto/Cargo.toml -- --nocapture

SWAP_PROGRAM_OWNER_FEE_ADDRESS="HfoTxFR1Tm6kGmWgYWD6J7YHVy1UwqSULUGVLXkJqaKN" \
cargo +"$rust_stable" build-bpf \
--manifest-path=token-swap/program/Cargo.toml \
--features production \
--bpf-out-dir target/deploy-production
mv target/deploy-production/spl_token_swap.so target/deploy/spl_token_swap_production.so

# # Check generated C headers
# cargo run --manifest-path=utils/cgen/Cargo.toml
#
Expand All @@ -44,4 +28,4 @@ mv target/deploy-production/spl_token_swap.so target/deploy/spl_token_swap_produ
# git diff --exit-code token-swap/program/inc/token-swap.h
# cc token-swap/program/inc/token-swap.h -o target/token-swap.gch

exit 0
exit 0
58 changes: 58 additions & 0 deletions ci/cargo-test-sbf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash

set -e
cd "$(dirname "$0")/.."

source ./ci/rust-version.sh stable
source ./ci/solana-version.sh

export RUSTFLAGS="-D warnings"
export RUSTBACKTRACE=1

usage() {
exitcode=0
if [[ -n "$1" ]]; then
exitcode=1
echo "Error: $*"
fi
echo "Usage: $0 [program-directory]"
exit $exitcode
}

program_directory=$1
if [[ -z $program_directory ]]; then
usage "No program directory provided"
fi

cd $program_directory
run_dir=$(pwd)

if [[ -r $run_dir/Cargo.toml ]]; then
# Build/test just one BPF program
set -x
cd $run_dir
cargo +"$rust_stable" test-sbf -- --nocapture
exit 0
fi

run_all=1
for program in $run_dir/program{,-*}; do
# Build/test all program directories
if [[ -r $program/Cargo.toml ]]; then
run_all=
(
set -x
cd $program
cargo +"$rust_stable" test-sbf -- --nocapture
)
fi
done

if [[ -n $run_all ]]; then
# Build/test all directories
set -x
for directory in $(ls -d $run_dir/*/); do
cd $directory
cargo +"$rust_stable" test-sbf -- --nocapture
done
fi
2 changes: 2 additions & 0 deletions token-lending/program/tests/update_reserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ async fn test_update_reserve() {
host_fee_percentage: 15,
},
deposit_staking_pool: COption::None,
deposit_limit: 2147483647u64,
borrow_limit: 2147483647u64,
};
let before_test_reserve = usdc_test_reserve.get_state(&mut banks_client).await;
assert_ne!(before_test_reserve.config, new_config);
Expand Down