-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* -D clippy * scripts * fmt * commented out * diff clippy and build * fix * push -> main
- Loading branch information
1 parent
f16731a
commit a4fdc15
Showing
9 changed files
with
204 additions
and
16 deletions.
There are no files selected for viewing
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,52 @@ | ||
name: Cargo Nightly Clippy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
SCCACHE_GHA_ENABLED: true | ||
RUSTC_WRAPPER: sccache | ||
SCCACHE_CACHE_SIZE: "1G" | ||
|
||
jobs: | ||
build_and_test: | ||
name: lite-rpc full build | ||
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 | ||
toolchain: nightly | ||
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: Run fmt+clippy | ||
run: | | ||
cargo fmt --all --check | ||
cargo clippy --locked --workspace --all-targets -- -D warnings |
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 |
---|---|---|
|
@@ -2,6 +2,8 @@ name: Integration Test with Validator | |
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
|
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,75 @@ | ||
#!/bin/bash | ||
|
||
# Function to display help message | ||
show_help() { | ||
echo "Usage: $0 [stable|nightly] [command]" | ||
echo | ||
echo "This script is used to run a specified cargo command with either the stable or nightly Rust toolchain." | ||
echo | ||
echo "Arguments:" | ||
echo " stable - Use the stable Rust toolchain." | ||
echo " nightly - Use the nightly Rust toolchain." | ||
echo " command - The cargo command to run (e.g., clippy, build)." | ||
echo | ||
echo "Examples:" | ||
echo " $0 stable clippy - Run clippy with the stable Rust version." | ||
echo " $0 nightly build - Build with the nightly Rust version." | ||
} | ||
|
||
# Function to run a specified cargo command with a specified toolchain | ||
run_cargo_command() { | ||
local toolchain=$1 | ||
local command=$2 | ||
echo "Running cargo $command with Rust $toolchain version..." | ||
cargo +"$toolchain" "$command" | ||
} | ||
|
||
# Check if the first argument is -h or --help | ||
if [[ $1 == "-h" || $1 == "--help" ]]; then | ||
show_help | ||
exit 0 | ||
fi | ||
|
||
# Check if the second argument is not provided | ||
if [[ -z $2 ]]; then | ||
echo "Error: No command specified." | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
# Path to the rust-version.sh script | ||
rust_version_script="./ci/rust-version.sh" | ||
|
||
# Check if rust-version.sh exists and is executable | ||
if [[ -f "$rust_version_script" && -x "$rust_version_script" ]]; then | ||
# Source the rust-version.sh script | ||
source "$rust_version_script" | ||
else | ||
echo "Error: rust-version.sh not found or not executable." | ||
exit 1 | ||
fi | ||
|
||
|
||
# Main execution logic based on passed arguments | ||
case $1 in | ||
stable) | ||
# Check if Rust stable version is set | ||
if [[ -z $rust_stable ]]; then | ||
echo "Error: Rust stable version is not set." | ||
exit 1 | ||
fi | ||
run_cargo_command "$rust_stable" "$2" | ||
;; | ||
nightly) | ||
# Check if Rust nightly version is set | ||
if [[ -z $rust_nightly ]]; then | ||
echo "Error: Rust nightly version is not set." | ||
exit 1 | ||
fi | ||
run_cargo_command "$rust_nightly" "$2" | ||
;; | ||
*) | ||
echo "Usage: $0 [stable|nightly] [command]" | ||
exit 1 | ||
;; | ||
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,62 @@ | ||
readCargoVariable() { | ||
declare variable="$1" | ||
declare Cargo_toml="$2" | ||
|
||
while read -r name equals value _; do | ||
if [[ $name = "$variable" && $equals = = ]]; then | ||
echo "${value//\"/}" | ||
return | ||
fi | ||
done < <(cat "$Cargo_toml") | ||
echo "Unable to locate $variable in $Cargo_toml" 1>&2 | ||
} | ||
|
||
if [[ -n $RUST_STABLE_VERSION ]]; then | ||
stable_version="$RUST_STABLE_VERSION" | ||
else | ||
# read rust version from rust-toolchain.toml file | ||
base="$(dirname "${BASH_SOURCE[0]}")" | ||
stable_version=$(readCargoVariable channel "$base/../rust-toolchain.toml") | ||
fi | ||
|
||
if [[ -n $RUST_NIGHTLY_VERSION ]]; then | ||
nightly_version="$RUST_NIGHTLY_VERSION" | ||
else | ||
nightly_version=2023-11-16 | ||
fi | ||
|
||
echo "stable_version: $stable_version" | ||
echo "nightly_version: $nightly_version" | ||
|
||
export rust_stable="$stable_version" | ||
export rust_nightly=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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[toolchain] | ||
channel = "1.70.0" | ||
channel = "1.73.0" |