Skip to content

Commit

Permalink
Updates readme, adds templates, updates makefile, and adds CI (#18)
Browse files Browse the repository at this point in the history
* chore: update readme

* chore: update readme, add templates

* chore: adds mock test and ci

* chore: update makefile, contributing.md, and codeowners

* chore: change workflow name

* feat: adds build check for macos and ubuntu

* Update .github/workflows/tests.yaml

Co-authored-by: Dennis <10233439+idea404@users.noreply.github.com>

* chore: fix clippy errors

---------

Co-authored-by: Dennis <10233439+idea404@users.noreply.github.com>
  • Loading branch information
dutterbutter and idea404 authored Jul 26, 2023
1 parent 064a8eb commit f5db37f
Show file tree
Hide file tree
Showing 16 changed files with 395 additions and 131 deletions.
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This CODEOWNERS file sets the individuals responsible for code in the era-test-node repository.

# These users are the default owners for everything in the repo.
# They will be requested for review when someone opens a pull request.
* @MexicanAce @uF4No @dutterbutter @mm-zk

# You can also specify code owners for specific directories or files.
# For example:
# /src/ @developer1 @developer2
# /docs/ @documenter
72 changes: 72 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Contributing

## Welcome! 👋

Hello there, contributor! We're delighted that you're considering contributing to the `era-test-node` project. This document is here to guide you through the steps and best practices for contributing to this Rust-based repository.

Please take a moment to review this document to ensure a smooth and efficient contribution process for everyone involved.

## Getting Started

- **Fork the repository.** Begin by forking the main `era-test-node` repository to your personal GitHub account.

- **Clone the repository.** After forking, clone the repository to your local machine:

```bash
git clone https://github.com/<your-github-username>/era-test-node.git
```

- **Create a new branch.** Use descriptive names for your branches to help identify the feature, bugfix, or enhancement you're addressing:

```bash
git checkout -b feature/description-of-your-feature
```

## Making Changes

- **Write your code.** Ensure your code is thoroughly tested and functions as expected. Clear, well-commented code is always appreciated.

- **Compile and test.** Before submitting a pull request, ensure your code compiles, passes lint checks, and all tests are successful. You should also write unit tests for your contributions. Use the following command for these checks:

```bash
make all
```

- **Commit your changes.** Adhere to the [Conventional Commits](https://www.conventionalcommits.org/) standard when writing commit messages.

- **Push your changes.** Push the changes to your forked repository:

```bash
git push origin feature/description-of-your-feature
```

## Submitting a Pull Request

- **Initiate a pull request (PR).** Go to the main `era-test-node` repository. Your recently pushed branch should be highlighted, showing a "Compare & pull request" button. Click on it and provide a clear, detailed description of your changes in the PR.

- **Await a review.** Our maintainers will review your PR. They might request changes or clarifications, so be ready to address any feedback.

## Code Style Guide

We follow Rust's official coding style guidelines. Before committing, ensure your code is formatted and lint checks pass:

```bash
cargo fmt --all -- --check &&
cargo clippy -Zunstable-options -- -D warnings --allow clippy::unwrap_used
```

This ensures consistent code style throughout the project and helps identify potential issues early.

## Need Assistance?

If you're unsure about something or have questions, don't hesitate to open an issue or initiate a discussion in our [zkSync Community Hub](https://github.com/zkSync-Community-Hub/zkSync-developers/discussions). We're here to assist!

## What's Next?

Once your PR is approved and merged, your contribution will be integrated into the `era-test-node` repository. Congratulations, and thank you! We value your contribution and look forward to future collaborations.

Remember, the best contributions come from enjoying the process, being respectful, and continuously learning. Thanks for being a part of our community!

---

*Last updated: July 24, 2023*
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Use this template for reporting issues
title: ""
labels: bug
assignees: ''

---

### 🐛 Bug Report for zkSync Era In-Memory Node

#### 📝 Description

Provide a clear and concise description of the bug.

#### 🔄 Reproduction Steps

1. Step 1
2. Step 2
3. ...

#### 🤔 Expected Behavior

Describe what you expected to happen.

#### 😯 Current Behavior

Describe what actually happened.

#### 🖥️ Environment

- **Rust version**: [e.g., rustc 1.52.0]
- **Operating System & Version**: [e.g., Ubuntu 20.04]
- **Other relevant environment details**:

#### 📋 Additional Context

Add any other context about the problem here. If applicable, add screenshots to help explain.

#### 📎 Log Output

```
Paste any relevant log output here.
```
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: zksync-developers Discussion
url: https://github.com/zkSync-Community-Hub/zkync-developers/discussions
about: Please provide feedback, and ask questions here.
- name: In-memory documentation page
url: https://era.zksync.io/docs/tools/testing/era-test-node.html
about: Please refer to the documentation for immediate answers.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Use this template for requesting features
title: ""
labels: feat
assignees: ''

---

### 🌟 Feature Request

#### 📝 Description

Provide a clear and concise description of the feature you'd like to see.

#### 🤔 Rationale

Explain why this feature is important and how it benefits the project.

#### 🖼️ Mockups/Examples

If applicable, provide mockups or examples of how the feature would work.

#### 📋 Additional Context

Add any other context or information about the feature request here.
50 changes: 50 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: checks

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
# ensures proper formatting and clippy lint
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt, clippy

- name: Rust Cache
uses: Swatinem/rust-cache@v1.3.0

- name: Run Linters
run: |
cargo fmt --all -- --check &&
cargo clippy -Zunstable-options -- -D warnings --allow clippy::unwrap_used
# ensures build is successful
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Rust Cache
uses: Swatinem/rust-cache@v1.3.0

- name: Build Code
run: make all
17 changes: 17 additions & 0 deletions .github/workflows/secret_scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Leaked Secrets Scan
on: [pull_request]
jobs:
TruffleHog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@0c66d30c1f4075cee1aada2e1ab46dabb1b0071a
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --debug --only-verified
34 changes: 34 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: run

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
test:
name: unit-tests
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@v1.3.0

- name: Install cargo-nextest
run: cargo +stable install cargo-nextest

- name: Run tests
run: cargo nextest run
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
# Build the system contracts
build-contracts:
cd etc/system-contracts && yarn; yarn install; yarn build; yarn preprocess; yarn build-bootloader
./scripts/refresh_contracts.sh

# Clean the system contracts
clean-contracts:
cd etc/system-contracts && yarn clean
rm -rf src/deps/contracts

# Rebuild the system contracts
rebuild-contracts:
cd etc/system-contracts && yarn build; yarn preprocess; yarn build-bootloader
./scripts/refresh_contracts.sh

# Build the Rust project
rust-build:
cargo build --release

# Lint checks for Rust code
lint:
cargo fmt --all -- --check
cargo clippy -Zunstable-options -- -D warnings --allow clippy::unwrap_used

# Run unit tests for Rust code
test:
cargo test

# Build everything
all: build-contracts rust-build
clean: clean-contracts

# Clean everything
clean: clean-contracts

.PHONY: build-contracts clean-contracts rebuild-contracts rust-build lint test all clean
Loading

0 comments on commit f5db37f

Please sign in to comment.