Skip to content

Commit

Permalink
repo boilerplate setup
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya committed Aug 22, 2024
1 parent 1234087 commit d33b1ff
Show file tree
Hide file tree
Showing 11 changed files with 440 additions and 2 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
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @danipopes @gakonst @mattsse @onbjerg @prestwich @evalir
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-FORM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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:
- meta-crate
- contract
- consensus, eips, genesis
- network, json-rpc
- node-bindings
- provider, pubsub
- rpc
- serde
- signers
- transports
- other
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
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-FORM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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:
- meta-crate
- contract
- consensus, eips, genesis
- network, json-rpc
- node-bindings
- provider, pubsub
- rpc
- serde
- signers
- transports
- other
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
209 changes: 209 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
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.os }} ${{ matrix.rust }} ${{ matrix.flags }}
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
rust:
- "stable"
- "nightly"
- "1.76" # MSRV
flags:
# No features
- "--no-default-features"
# Default features
- ""
# All features
- "--all-features"
exclude:
# All features on MSRV
- rust: "1.76" # MSRV
flags: "--all-features"
steps:
- uses: actions/checkout@v4
- 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
shell: bash
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

wasm-unknown:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo hack
run: |
cargo hack build --workspace --target wasm32-unknown-unknown \
--exclude alloy-contract \
--exclude alloy-network \
--exclude alloy-node-bindings \
--exclude alloy-provider \
--exclude alloy-signer \
--exclude alloy-signer-aws \
--exclude alloy-signer-gcp \
--exclude alloy-signer-ledger \
--exclude alloy-signer-local \
--exclude alloy-signer-trezor \
--exclude alloy-transport-ipc
wasm-wasi:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip1
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: pin cc # https://github.com/rust-lang/cc-rs/issues/1109
run: cargo update cc --precise 1.0.99
- name: cargo hack
run: |
cargo hack build --workspace --target wasm32-wasip1 \
--exclude alloy-signer-gcp \
--exclude alloy-signer-ledger \
--exclude alloy-signer-trezor \
--exclude alloy-transport-ipc
# Ledger signer requires one of `browser` or `node` features.
- name: build ledger
run: cargo build -p alloy-signer-ledger --features browser --target wasm32-wasip1

no-std:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- 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@v4
- 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@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Build documentation
run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings --show-type-layout --generate-link-to-definition -Zunstable-options

fmt:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- 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@v4
- 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@v4
- 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 d33b1ff

Please sign in to comment.