Add check and release scripts.
Had to slightly adjust package names to make this work.
This commit is contained in:
38
substreams/Cargo.lock
generated
38
substreams/Cargo.lock
generated
@@ -208,6 +208,25 @@ dependencies = [
|
|||||||
"tiny-keccak",
|
"tiny-keccak",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethereum-balancer"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"bytes",
|
||||||
|
"ethabi 18.0.0",
|
||||||
|
"getrandom",
|
||||||
|
"hex",
|
||||||
|
"hex-literal 0.4.1",
|
||||||
|
"itertools 0.12.1",
|
||||||
|
"num-bigint",
|
||||||
|
"prost 0.11.9",
|
||||||
|
"prost-types 0.12.3",
|
||||||
|
"substreams",
|
||||||
|
"substreams-ethereum",
|
||||||
|
"tycho-substreams",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethereum-types"
|
name = "ethereum-types"
|
||||||
version = "0.13.1"
|
version = "0.13.1"
|
||||||
@@ -899,25 +918,6 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "substreams-ethereum-balancer"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"bytes",
|
|
||||||
"ethabi 18.0.0",
|
|
||||||
"getrandom",
|
|
||||||
"hex",
|
|
||||||
"hex-literal 0.4.1",
|
|
||||||
"itertools 0.12.1",
|
|
||||||
"num-bigint",
|
|
||||||
"prost 0.11.9",
|
|
||||||
"prost-types 0.12.3",
|
|
||||||
"substreams",
|
|
||||||
"substreams-ethereum",
|
|
||||||
"tycho-substreams",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substreams-ethereum-core"
|
name = "substreams-ethereum-core"
|
||||||
version = "0.9.9"
|
version = "0.9.9"
|
||||||
|
|||||||
6
substreams/check.sh
Executable file
6
substreams/check.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
set -e
|
||||||
|
|
||||||
|
cargo +nightly fmt -- --check
|
||||||
|
cargo +nightly clippy --all --all-features --all-targets -- -D warnings
|
||||||
|
cargo build --target wasm32-unknown-unknown --all-targets --all-features
|
||||||
|
cargo test --workspace --all-targets --all-features
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "substreams-ethereum-balancer"
|
name = "ethereum-balancer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "substreams_ethereum_balancer"
|
name = "ethereum_balancer"
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
specVersion: v0.1.0
|
specVersion: v0.1.0
|
||||||
package:
|
package:
|
||||||
name: "substreams_ethereum_balancer"
|
name: "ethereum_balancer"
|
||||||
version: v0.1.0
|
version: v0.1.0
|
||||||
|
|
||||||
protobuf:
|
|
||||||
files:
|
|
||||||
- tycho/evm/v1/vm.proto
|
|
||||||
- tycho/evm/v1/common.proto
|
|
||||||
- tycho/evm/v1/utils.proto
|
|
||||||
importPaths:
|
|
||||||
- ../../proto
|
|
||||||
|
|
||||||
binaries:
|
binaries:
|
||||||
default:
|
default:
|
||||||
type: wasm/rust-v1
|
type: wasm/rust-v1
|
||||||
file: target/wasm32-unknown-unknown/release/substreams_ethereum_balancer.wasm
|
file: ../target/wasm32-unknown-unknown/release/ethereum_balancer.wasm
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
- name: map_pools_created
|
- name: map_pools_created
|
||||||
|
|||||||
60
substreams/release.sh
Executable file
60
substreams/release.sh
Executable file
@@ -0,0 +1,60 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Allows releasing multiple substream packages within the same repo.
|
||||||
|
# To trigger a release simply create a tag with [package-name]-[semver].
|
||||||
|
# The script will look for these tags, then infer which package needs to be built and
|
||||||
|
# released.
|
||||||
|
|
||||||
|
# Try to get the tag name associated with the current HEAD commit
|
||||||
|
current_tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -n "$current_tag" ]; then
|
||||||
|
# If the HEAD is at a tag, extract the prefix and version
|
||||||
|
if [[ $current_tag =~ ^([a-zA-Z-]*-)?([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||||
|
# Prefix without the trailing hyphen (if any)
|
||||||
|
package="${BASH_REMATCH[1]%?}"
|
||||||
|
# Semantic version
|
||||||
|
version="${BASH_REMATCH[2]}"
|
||||||
|
tag=$current_tag
|
||||||
|
|
||||||
|
cargo_version=$(cargo pkgid -p ethereum-balancer | cut -d# -f2 | cut -d: -f2)
|
||||||
|
if [[ "$cargo_version" != "$version" ]]; then
|
||||||
|
echo "Error: Cargo version: ${cargo_version} does not match tag version: ${version}!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Check if the Git repository is dirty
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
echo "Error: The repository is dirty. Please commit or stash your changes."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Current tag ($current_tag) does not match the expected format."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# If the HEAD is not at a tag, construct the tag name with the pre-release postfix
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Error: package argument is required to create a pre release!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
package=$1
|
||||||
|
|
||||||
|
version_prefix=$(git describe --tags --match "$package-*" --abbrev=0 2>/dev/null)
|
||||||
|
if [ -z "$version_prefix" ]; then
|
||||||
|
# If no tags are found in the history, default to version 0.0.1
|
||||||
|
version_prefix="0.0.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the short commit hash of the current HEAD
|
||||||
|
commit_hash=$(git rev-parse --short HEAD)
|
||||||
|
version="${version_prefix}-pre.${commit_hash}"
|
||||||
|
# Combine version prefix with commit hash
|
||||||
|
tag="${package}-${version}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cargo build --target wasm32-unknown-unknown --release -p "$package"
|
||||||
|
mkdir -p ./target/spkg/
|
||||||
|
substreams pack $package/substreams.yaml -o ./target/spkg/$package-$version.spkg
|
||||||
|
aws s3 cp ./target/spkg/$package-$version.spkg "s3://repository.propeller/substreams/$package/$version.spkg"
|
||||||
|
|
||||||
|
echo "Released substreams package: "s3://repository.propeller/substreams/$package/$version.spkg""
|
||||||
Reference in New Issue
Block a user