forked from solana-labs/solana-program-library
-
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.
Simplify github action with scripts (solana-labs#769)
* Simplify github action with scripts * fix deps * fix path * feedback * feedback * shift some things * clean up * Update pull-request.yml
- Loading branch information
Showing
10 changed files
with
272 additions
and
254 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
cd "$(dirname "$0")" | ||
cd .. | ||
|
||
source ./ci/rust-version.sh stable | ||
source ./ci/solana-version.sh install | ||
|
||
export RUSTFLAGS="-D warnings" | ||
export RUSTBACKTRACE=1 | ||
|
||
set -x | ||
|
||
# For all BPF programs | ||
for Xargo_toml in $(git ls-files -- '*/Xargo.toml'); do | ||
program_dir=$(dirname "$Xargo_toml") | ||
|
||
if [ "$program_dir" == "token-swap/program" ]; then | ||
address="SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8" | ||
SWAP_PROGRAM_OWNER_FEE_ADDRESS="$address" cargo build-bpf --manifest-path=token-swap/program/Cargo.toml --dump --features production | ||
mv spl_token_swap.so spl_token_swap_production.so | ||
fi | ||
|
||
cargo +"$rust_stable" build-bpf --manifest-path="$program_dir"/Cargo.toml --dump | ||
done | ||
|
||
|
||
cargo +"$rust_stable" build | ||
cargo +"$rust_stable" test -- --nocapture | ||
cargo +"$rust_stable" run --manifest-path=utils/test-client/Cargo.toml | ||
cargo +"$rust_stable" test --manifest-path=themis/client_ristretto/Cargo.toml -- --nocapture | ||
|
||
# # Check generated C headers | ||
# cargo run --manifest-path=utils/cgen/Cargo.toml | ||
# | ||
# git diff --exit-code token/program/inc/token.h | ||
# cc token/program/inc/token.h -o target/token.gch | ||
# 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 |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main" | ||
sudo apt-get update | ||
sudo apt-get install -y clang-7 --allow-unauthenticated | ||
sudo apt-get install -y openssl --allow-unauthenticated | ||
sudo apt-get install -y libssl-dev --allow-unauthenticated | ||
sudo apt-get install -y libssl1.1 --allow-unauthenticated | ||
sudo apt-get install -y libudev-dev | ||
clang-7 --version |
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,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
source ci/rust-version.sh stable | ||
source ci/solana-version.sh install | ||
|
||
set -x | ||
|
||
cargo --version | ||
cargo install rustfilt || true | ||
|
||
export PATH="$HOME"/.local/share/solana/install/active_release/bin:"$PATH" | ||
solana --version | ||
cargo +"$rust_stable" build-bpf --version |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
cd "$(dirname "$0")" | ||
|
||
(cd ../token/js && npm install) | ||
|
||
cd ../token-lending/js | ||
npm install | ||
npm run lint | ||
npm run build | ||
npm run cluster:localnet | ||
npm run localnet:update | ||
npm run localnet:up | ||
npm run start | ||
npm run localnet:down |
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,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
cd "$(dirname "$0")" | ||
|
||
(cd ../token/js && npm install) | ||
|
||
cd ../token-swap/js | ||
npm install | ||
npm run lint | ||
npm run flow | ||
npx tsc module.d.ts | ||
npm run cluster:localnet | ||
npm run localnet:update | ||
npm run localnet:up | ||
npm run start | ||
(cd ../../target/bpfel-unknown-unknown/release && mv spl_token_swap_production.so spl_token_swap.so) | ||
SWAP_PROGRAM_OWNER_FEE_ADDRESS="SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8" npm run start | ||
npm run localnet:down |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
cd "$(dirname "$0")" | ||
cd ../token/js | ||
|
||
npm install | ||
npm run lint | ||
npm run flow | ||
npx tsc module.d.ts | ||
npm run cluster:localnet | ||
npm run localnet:update | ||
npm run localnet:up | ||
npm run start | ||
PROGRAM_VERSION=2.0.4 npm run start | ||
npm run localnet:down |
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,65 @@ | ||
# | ||
# This file maintains the rust versions for use by CI. | ||
# | ||
# Obtain the environment variables without any automatic toolchain updating: | ||
# $ source ci/rust-version.sh | ||
# | ||
# Obtain the environment variables updating both stable and nightly, only stable, or | ||
# only nightly: | ||
# $ source ci/rust-version.sh all | ||
# $ source ci/rust-version.sh stable | ||
# $ source ci/rust-version.sh nightly | ||
|
||
# Then to build with either stable or nightly: | ||
# $ cargo +"$rust_stable" build | ||
# $ cargo +"$rust_nightly" build | ||
# | ||
|
||
if [[ -n $RUST_STABLE_VERSION ]]; then | ||
stable_version="$RUST_STABLE_VERSION" | ||
else | ||
stable_version=1.47.0 | ||
fi | ||
|
||
# if [[ -n $RUST_NIGHTLY_VERSION ]]; then | ||
# nightly_version="$RUST_NIGHTLY_VERSION" | ||
# else | ||
# nightly_version=2020-08-17 | ||
# fi | ||
|
||
|
||
export rust_stable="$stable_version" | ||
export rust_stable_docker_image=solanalabs/rust:"$stable_version" | ||
|
||
# export rust_nightly=nightly-"$nightly_version" | ||
# export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version" | ||
|
||
[[ -z $1 ]] || ( | ||
|
||
rustup_install() { | ||
declare toolchain=$1 | ||
if ! cargo +"$toolchain" -V > /dev/null; then | ||
echo "$0: Missing toolchain? Installing...: $toolchain" >&2 | ||
rustup install "$toolchain" | ||
cargo +"$toolchain" -V | ||
fi | ||
} | ||
|
||
set -e | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
case $1 in | ||
stable) | ||
rustup_install "$rust_stable" | ||
;; | ||
# nightly) | ||
# rustup_install "$rust_nightly" | ||
# ;; | ||
all) | ||
rustup_install "$rust_stable" | ||
rustup_install "$rust_nightly" | ||
;; | ||
*) | ||
echo "$0: Note: ignoring unknown argument: $1" >&2 | ||
;; | ||
esac | ||
) |
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,35 @@ | ||
# | ||
# This file maintains the solana versions for use by CI. | ||
# | ||
# Obtain the environment variables without any automatic updating: | ||
# $ source ci/solana-version.sh | ||
# | ||
# Obtain the environment variables and install update: | ||
# $ source ci/solana-version.sh install | ||
|
||
# Then to access the solana version: | ||
# $ echo "$solana_version" | ||
# | ||
|
||
if [[ -n $SOLANA_VERSION ]]; then | ||
solana_version="$SOLANA_VERSION" | ||
else | ||
solana_version=v1.4.4 | ||
fi | ||
|
||
export solana_version="$solana_version" | ||
export solana_docker_image=solanalabs/solana:"$solana_version" | ||
|
||
[[ -z $1 ]] || ( | ||
|
||
set -e | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
case $1 in | ||
install) | ||
sh -c "$(curl -sSfL https://release.solana.com/$solana_version/install)" | ||
;; | ||
*) | ||
echo "$0: Note: ignoring unknown argument: $1" >&2 | ||
;; | ||
esac | ||
) |