Skip to content

Commit

Permalink
Merge pull request #62 from zkemail/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
Bisht13 authored Oct 1, 2024
2 parents ce2fc6d + de9e2b7 commit 3278b77
Show file tree
Hide file tree
Showing 58 changed files with 4,902 additions and 12,026 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ packages/contracts/test/build_integration/*.json
packages/contracts/test/build_integration/*.zkey
packages/contracts/test/build_integration/*.wasm
packages/contracts/test/build_integration/*.txt
packages/contracts/test/EmailAccountRecoveryZkSync

# NFT Relayer
packages/nft_relayer/sendgrid.env
Expand Down
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Description
<!-- Please include a summary of the change and which issue is fixed. Also, list any dependencies that are required for this change. -->

<!-- Fixes # (issue) -->

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?
<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration -->

- [ ] Test A
- [ ] Test B

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
64 changes: 64 additions & 0 deletions .github/workflows/build-fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Format

on: [push]

jobs:
build-and-format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- run: rustup show

- name: Install rustfmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- uses: Swatinem/rust-cache@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-0079a1146b79a4aeda58b0258215bedb1f92700b

- name: Build contracts
working-directory: packages/contracts
run: yarn build

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Build and check for warnings
env:
RUSTFLAGS: "-D warnings"
run: cargo build --release

- name: Check formatting
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy -- -D warnings
51 changes: 51 additions & 0 deletions .github/workflows/build-img.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and Push Docker Image

on:
push:
branches:
- refactor

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Full.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
55 changes: 0 additions & 55 deletions .github/workflows/build-test-fmt.yml

This file was deleted.

34 changes: 32 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: unit-tests
name: Unit Tests

on: [push]

Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install yarn
run: npm install -g yarn

Expand All @@ -62,3 +62,33 @@ jobs:
- name: Run tests
working-directory: packages/contracts
run: yarn test

relayer:
name: relayer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install yarn
run: npm install -g yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/[email protected]
with:
version: nightly-0079a1146b79a4aeda58b0258215bedb1f92700b

- name: Build contracts
working-directory: packages/contracts
run: yarn build

- name: Run tests
working-directory: packages/relayer
run: cargo test
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ sql_database.db
.sqlx
.ic.pem

# ABIs
packages/relayer/src/abis/*
!packages/realyer/src/abis/mod.rs

# Prover
packages/prover/build/*
packages/prover/params/*.zkey
Expand All @@ -80,6 +84,9 @@ book
# Vs code settings
.vscode

# Editor settings
.idea

# For zksync
zkout
.cache
8 changes: 6 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[workspace]
members = ["packages/relayer"]
exclude = ["node_modules/*"]
exclude = ["node_modules/*", "packages/relayer/src/abis"]
resolver = "2"
Loading

0 comments on commit 3278b77

Please sign in to comment.