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

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

Merged
merged 6 commits into from
Aug 12, 2024
Merged
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
123 changes: 104 additions & 19 deletions .github/assets/check_wasm.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,111 @@
#!/usr/bin/env bash
set +e # Disable immediate exit on error

# Array of crates
wasm_crates=(
# The following were confirmed not working in the past, but could be enabled if issues have been resolved
# reth-consensus
# reth-db
# reth-evm-ethereum
# The following are confirmed working
reth-codecs
reth-errors
reth-ethereum-forks
reth-evm
reth-network-peers
reth-primitives
reth-primitives-traits
reth-revm
# Array of crates to compile
crates=($(cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | grep '^reth' | sort))
# Array of crates to exclude
exclude_crates=(
# The following are not working yet, but known to be fixable
reth-consensus
reth-exex-types # https://github.com/paradigmxyz/reth/issues/9946
# The following require investigation if they can be fixed
reth-auto-seal-consensus
reth-basic-payload-builder
reth-beacon-consensus
reth-bench
reth-blockchain-tree
reth-chain-state
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
Comment on lines +69 to +81
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattsse can you confirm these aren't supposed to work? I'm not sure about some of them, e.g. feels like reth-transaction-pool and reth-trie-parallel should be decoupled from c-kzg and db accordingly?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but not a big deal imo

)

# Array to hold the results
results=()
# Flag to track if any command fails
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"

if [ -n "$CI" ]; then
Expand All @@ -32,15 +114,17 @@ for crate in "${wasm_crates[@]}"; do
printf "\n%s:\n %s\n" "$crate" "$cmd"
fi

set +e # Disable immediate exit on error
# Run the command and capture the return code
$cmd
ret_code=$?
set -e # Re-enable immediate exit on error

# Store the result in the dictionary
if [ $ret_code -eq 0 ]; then
results+=("✅:$crate")
results+=("1:✅:$crate")
else
results+=("❌:$crate")
results+=("2:❌:$crate")
any_failed=1
fi

Expand All @@ -56,7 +140,8 @@ unset IFS
# Print summary
echo -e "\nSummary of build results:"
for result in "${sorted_results[@]}"; do
status="${result%%:*}"
status="${result#*:}"
status="${status%%:*}"
crate="${result##*:}"
echo "$status $crate"
done
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: dcarbone/install-jq-action@v2
- name: Run Wasm checks
run: .github/assets/check_wasm.sh

Expand Down
Loading