feat(ci): check all crates for Wasm (#10084)

This commit is contained in:
Alexey Shekhirin
2024-08-12 14:57:38 -07:00
committed by GitHub
parent 52ae25a7c7
commit d2094d00d1
2 changed files with 105 additions and 19 deletions

View File

@ -1,21 +1,84 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set +e # Disable immediate exit on error set +e # Disable immediate exit on error
# Array of crates # Array of crates to compile
wasm_crates=( crates=($(cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | grep '^reth' | sort))
# The following were confirmed not working in the past, but could be enabled if issues have been resolved # Array of crates to exclude
# reth-consensus exclude_crates=(
# reth-db # The following are not working yet, but known to be fixable
# reth-evm-ethereum reth-consensus
# The following are confirmed working reth-exex-types # https://github.com/paradigmxyz/reth/issues/9946
reth-codecs # The following require investigation if they can be fixed
reth-errors reth-auto-seal-consensus
reth-ethereum-forks reth-basic-payload-builder
reth-evm reth-beacon-consensus
reth-network-peers reth-bench
reth-primitives reth-blockchain-tree
reth-primitives-traits reth-chain-state
reth-revm reth-cli
reth-cli-commands
reth-cli-runner
reth-consensus-debug-client
reth-db-common
reth-discv4
reth-discv5
reth-dns-discovery
reth-downloaders
reth-e2e-test-utils
reth-engine-primitives
reth-engine-service
reth-engine-tree
reth-engine-util
reth-eth-wire
reth-ethereum-cli
reth-ethereum-engine
reth-ethereum-engine-primitives
reth-ethereum-payload-builder
reth-etl
reth-evm-ethereum
reth-evm-optimism
reth-execution-errors
reth-exex
reth-exex-test-utils
reth-ipc
reth-net-nat
reth-network
reth-node-api
reth-node-builder
reth-node-core
reth-node-ethereum
reth-node-events
reth-node-metrics
reth-node-optimism
reth-optimism-cli
reth-optimism-payload-builder
reth-optimism-rpc
reth-payload-builder
reth-payload-primitives
reth-rpc
reth-rpc-api
reth-rpc-api-testing-util
reth-rpc-builder
reth-rpc-engine-api
reth-rpc-eth-api
reth-rpc-eth-types
reth-rpc-layer
reth-rpc-types
reth-stages
reth-storage-errors
# The following are not supposed to be working
reth # all of the crates below
reth-db # mdbx
reth-libmdbx # mdbx
reth-mdbx-sys # mdbx
reth-nippy-jar # sucds
reth-provider # reth-db, reth-nippy-jar
reth-prune # reth-db
reth-stages-api # reth-provider, reth-prune
reth-static-file # reth-nippy-jar
reth-transaction-pool # c-kzg
reth-trie-db # reth-db
reth-trie-parallel # reth-db
) )
# Array to hold the results # Array to hold the results
@ -23,7 +86,26 @@ results=()
# Flag to track if any command fails # Flag to track if any command fails
any_failed=0 any_failed=0
for crate in "${wasm_crates[@]}"; do # Function to check if a value exists in an array
contains() {
local array="$1[@]"
local seeking=$2
local in=1
for element in "${!array}"; do
if [[ "$element" == "$seeking" ]]; then
in=0
break
fi
done
return $in
}
for crate in "${crates[@]}"; do
if contains exclude_crates "$crate"; then
results+=("3:⏭️:$crate")
continue
fi
cmd="cargo +stable build -p $crate --target wasm32-wasip1 --no-default-features" cmd="cargo +stable build -p $crate --target wasm32-wasip1 --no-default-features"
if [ -n "$CI" ]; then if [ -n "$CI" ]; then
@ -32,15 +114,17 @@ for crate in "${wasm_crates[@]}"; do
printf "\n%s:\n %s\n" "$crate" "$cmd" printf "\n%s:\n %s\n" "$crate" "$cmd"
fi fi
set +e # Disable immediate exit on error
# Run the command and capture the return code # Run the command and capture the return code
$cmd $cmd
ret_code=$? ret_code=$?
set -e # Re-enable immediate exit on error
# Store the result in the dictionary # Store the result in the dictionary
if [ $ret_code -eq 0 ]; then if [ $ret_code -eq 0 ]; then
results+=("✅:$crate") results+=("1:✅:$crate")
else else
results+=("❌:$crate") results+=("2:❌:$crate")
any_failed=1 any_failed=1
fi fi
@ -56,7 +140,8 @@ unset IFS
# Print summary # Print summary
echo -e "\nSummary of build results:" echo -e "\nSummary of build results:"
for result in "${sorted_results[@]}"; do for result in "${sorted_results[@]}"; do
status="${result%%:*}" status="${result#*:}"
status="${status%%:*}"
crate="${result##*:}" crate="${result##*:}"
echo "$status $crate" echo "$status $crate"
done done

View File

@ -57,6 +57,7 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
cache-on-failure: true cache-on-failure: true
- uses: dcarbone/install-jq-action@v2
- name: Run Wasm checks - name: Run Wasm checks
run: .github/assets/check_wasm.sh run: .github/assets/check_wasm.sh