Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jun 21, 2024
0 parents commit 78d22fe
Show file tree
Hide file tree
Showing 23 changed files with 1,077 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[profile.default]
retries = { backoff = "exponential", count = 2, delay = "2s", jitter = true }
slow-timeout = { period = "30s", terminate-after = 4 }
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @danipopes @gakonst @mattsse @onbjerg @prestwich @evalir
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-FORM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Bug report
description: File a bug report
labels: ["bug"]
title: "[Bug] "
body:
- type: markdown
attributes:
value: |
Please ensure that the bug has not already been filed in the issue tracker.
Thanks for taking the time to report this bug!
- type: dropdown
attributes:
label: Component
description: What component is the bug in?
multiple: true
options:
- contract
- consensus, eips, genesis
- network, json-rpc
- nodes
- provider, pubsub
- rpc
- signers
- transports
validations:
required: true
- type: input
attributes:
label: What version of Alloy are you on?
placeholder: "Run `cargo tree | grep alloy` and paste the output here"
- type: dropdown
attributes:
label: Operating System
description: What operating system are you on?
options:
- Windows
- macOS (Intel)
- macOS (Apple Silicon)
- Linux
- Other (please specify)
- type: textarea
attributes:
label: Describe the bug
description: Please include code snippets as well if relevant.
validations:
required: true
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-FORM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Feature request
description: Suggest a feature
labels: ["enhancement"]
title: "[Feature] "
body:
- type: markdown
attributes:
value: |
Please ensure that the feature has not already been requested in the issue tracker.
- type: dropdown
attributes:
label: Component
description: What component is the feature for?
multiple: true
options:
- contract
- consensus, eips, genesis
- network, json-rpc
- nodes
- provider, pubsub
- rpc
- signers
- transports
validations:
required: true
- type: textarea
attributes:
label: Describe the feature you would like
description:
Please also describe your goals for the feature. What problems it solves, how it would be
used, etc.
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Add any other context to the feature (like screenshots, resources)
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Support
url: https://t.me/ethers_rs
about: This issue tracker is only for bugs and feature requests. Support is available on Telegram!
34 changes: 34 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.
Bug fixes and new features should include tests.
Contributors guide: https://github.com/alloy-rs/core/blob/main/CONTRIBUTING.md
The contributors guide includes instructions for running rustfmt and building the
documentation.
-->

<!-- ** Please select "Allow edits from maintainers" in the PR Options ** -->

## Motivation

<!--
Explain the context and why you're making that change. What is the problem
you're trying to solve? In some cases there is not a problem and this can be
thought of as being the motivation for your change.
-->

## Solution

<!--
Summarize the solution and provide any necessary context needed to understand
the code change.
-->

## PR Checklist

- [ ] Added Tests
- [ ] Added Documentation
- [ ] Breaking changes
51 changes: 51 additions & 0 deletions .github/scripts/install_test_binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Installs Solc and Geth binaries
# Note: intended for use only with CI (x86_64 Ubuntu, MacOS or Windows)
set -e

GETH_BUILD=${GETH_BUILD:-"1.11.2-73b01f40"}

BIN_DIR=${BIN_DIR:-"$HOME/bin"}

PLATFORM="$(uname -s | awk '{print tolower($0)}')"
if [ "$PLATFORM" != "linux" ] && [ "$PLATFORM" != "darwin" ]; then
EXT=".exe"
fi

main() {
mkdir -p "$BIN_DIR"
cd "$BIN_DIR"
export PATH="$BIN_DIR:$PATH"
if [ "$GITHUB_PATH" ]; then
echo "$BIN_DIR" >> "$GITHUB_PATH"
fi

install_geth

echo ""
echo "Installed Geth:"
geth version
}

# Installs geth from https://geth.ethereum.org/downloads
install_geth() {
case "$PLATFORM" in
linux|darwin)
name="geth-$PLATFORM-amd64-$GETH_BUILD"
curl -s "https://gethstore.blob.core.windows.net/builds/$name.tar.gz" | tar -xzf -
mv -f "$name/geth" ./
rm -rf "$name"
chmod +x geth
;;
*)
name="geth-windows-amd64-$GETH_BUILD"
zip="$name.zip"
curl -so "$zip" "https://gethstore.blob.core.windows.net/builds/$zip"
unzip "$zip"
mv -f "$name/geth.exe" ./
rm -rf "$name" "$zip"
;;
esac
}

main
154 changes: 154 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: CI

on:
push:
branches: [main]
pull_request:

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
name: test ${{ matrix.rust }} ${{ matrix.flags }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
rust: ["stable", "nightly", "1.76"] # MSRV
flags: ["--no-default-features", "", "--all-features"]
exclude:
# Some features have higher MSRV.
- rust: "1.76" # MSRV
flags: "--all-features"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install test binaries
shell: bash
run: ./.github/scripts/install_test_binaries.sh
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Only run tests on latest stable and above
- name: Install cargo-nextest
if: ${{ matrix.rust != '1.76' }} # MSRV
uses: taiki-e/install-action@nextest
- name: build
if: ${{ matrix.rust == '1.76' }} # MSRV
run: cargo build --workspace ${{ matrix.flags }}
- name: test
if: ${{ matrix.rust != '1.76' }} # MSRV
run: cargo nextest run --workspace ${{ matrix.flags }}

doctest:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo test --workspace --doc
- run: cargo test --all-features --workspace --doc

no-std:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: riscv32imac-unknown-none-elf
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: check
run: ./scripts/check_no_std.sh

feature-checks:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo hack
run: cargo hack check --feature-powerset --depth 1

clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo +stable clippy --workspace --all-targets --all-features
env:
RUSTFLAGS: -Dwarnings

docs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS:
--cfg docsrs -D warnings --show-type-layout --generate-link-to-definition
--enable-index-page -Zunstable-options
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/doc
force_orphan: true

fmt:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all --check

cfg-check:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo check -Zcheck-cfg --workspace
18 changes: 18 additions & 0 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: deps

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule: [cron: "00 00 * * *"]

jobs:
cargo-deny:
name: cargo deny check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/target
/Cargo.lock
.vscode
.idea
.env
.DS_Store
Loading

0 comments on commit 78d22fe

Please sign in to comment.