Skip to content

Commit

Permalink
Merge branch 'dev' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeal-eth authored Dec 23, 2024
2 parents e7882ba + 674675a commit 1c69022
Show file tree
Hide file tree
Showing 129 changed files with 6,848 additions and 2,503 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.dockerignore
.DS_Store
.env
.gitignore
coverage/
dist/
node_modules/
48 changes: 38 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
}
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"plugins": [
"@typescript-eslint",
"prettier"
],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"eslint:recommended",
"prettier",
Expand All @@ -24,11 +30,21 @@
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": ["./tsconfig.json"]
"project": [
"./tsconfig.json"
]
},
"rules": {
"prettier/prettier": ["error", { "singleQuote": true }],
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"prettier/prettier": [
"error",
{
"singleQuote": true
}
],
"no-mixed-spaces-and-tabs": [
"warn",
"smart-tabs"
],
"comma-dangle": [
"error",
{
Expand All @@ -40,14 +56,24 @@
}
],
"indent": "off",
"quotes": ["error", "single", { "avoidEscape": true }],
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"import/no-unresolved": "off", // messed up by lerna hoisting
"no-undef": "error",
"import/no-anonymous-default-export": "off",
"prefer-const": "error",
"semi": ["error", "always"],
"no-console": ["error"],

"semi": [
"error",
"always"
],
"no-console": [
"error"
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
Expand All @@ -57,7 +83,9 @@
}
},
{
"files": ["packages/{api,indexer}/**/*.ts"],
"files": [
"packages/{api,indexer}/**/*.ts"
],
"rules": {
"react-hooks/rules-of-hooks": "off"
}
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/backmerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Backmerge main to dev

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
backmerge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Important: fetch all history
ref: dev # Checkout dev branch

- name: Configure Git
run: |
git config user.name 'Cannon Bot'
git config user.email 'noreply@usecannon.com'
- name: Merge main into dev
id: merge
continue-on-error: true
run: |
git fetch origin main
git merge origin/main --no-edit
- name: Push if merge successful
if: steps.merge.outcome == 'success'
run: git push origin dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create PR on merge conflict
if: steps.merge.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
const branchName = `backmerge/main-to-dev-${{ github.sha }}`;
await exec.exec('git', ['checkout', '-b', branchName]);
await exec.exec('git', ['push', 'origin', branchName]);
const pr = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'chore(ci): backmerge main → dev',
body: 'Automatic merge from main to dev failed. This PR was created to help resolve conflicts.',
head: branchName,
base: 'dev'
});
// Request review from Core Contributors team
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.data.number,
team_reviewers: ['core-contributors']
});
// Enable auto-merge
await github.rest.pulls.updateBranch({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.data.number,
merge_method: 'merge'
});
4 changes: 4 additions & 0 deletions .github/workflows/commitlint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- edited
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and Push Docker Images

on:
workflow_dispatch:
inputs:
job_to_run:
description: 'Which job to run'
required: true
type: choice
options:
- all
- repo
- indexer
version:
description: 'Version tag (optional)'
required: false
type: string

env:
REGISTRY: ghcr.io

jobs:
build:
strategy:
matrix:
image: ${{ fromJSON(github.event.inputs.job_to_run == 'all' && '["repo", "indexer"]' || format('["%s"]', github.event.inputs.job_to_run)) }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.image }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/${{ matrix.image }}.Dockerfile
build-args: |
BUILD_REVISION=${{ github.event.inputs.version || github.sha }}
push: true
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main, alpha, dev]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main, alpha, dev]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-e2e:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,3 +45,4 @@ jobs:
env:
CANNON_E2E_RPC_URL_OPTIMISM: ${{ secrets.CANNON_E2E_RPC_URL_OPTIMISM }}
CANNON_E2E_RPC_URL_ETHEREUM: ${{ secrets.CANNON_E2E_RPC_URL_ETHEREUM }}
CANNON_ETHERSCAN_API_KEY: ${{ secrets.CANNON_ETHERSCAN_API_KEY }}
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main, alpha, dev]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/website-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main, alpha, dev]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cypress-run:
runs-on: ubuntu-22.04
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@ jspm_packages/

# environment variables
.env
.env.*
!.env.example

# macOS
.DS_Store
.idea

# local env vars
.env.local

# nx cache folder
.nx

.contentlayer

# docker-compose data
/data
54 changes: 54 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: usecannon

services:
# redis database image, used by indexer and api
redis:
image: redis/redis-stack:7.4.0-v1
restart: always
ports:
- '6379:6379'
- '8001:8001'
command: redis-stack-server --save 60 1 --loglevel warning
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5

# supersim spins up the necessary OPs chains for the registry, and makes
# sure all cross chain messaging works.
# registry:
# image: ghcr.io/usecannon/supersim:0.1.0-alpha.25
# restart: always
# environment:
# ANVIL_IP_ADDR: 0.0.0.0
# ports:
# - '0.0.0.0:8545:8545' # L1
# - '0.0.0.0:9545:9545' # L2
# command: --interop.autorelay

# Deploy the registry on L1
registry:
restart: always
image: node:22.11.0-alpine
# command: npx -y @usecannon/cli build registry --wipe --rpc-url https://registry:8545
command: |
curl -L https://foundry.paradigm.xyz | bash
PATH="/root/.foundry/bin:${PATH}"
foundryup --version nightly-fdd321bac95f0935529164a88faf99d4d5cfa321
DEBUG=cannon* npx -y @usecannon/cli run registry --anvil.host 0.0.0.0 --anvil.port 8545 --anvil.chain-id 1
ports:
- '0.0.0.0:8545:8545' # L1

repo:
build:
context: .
dockerfile: docker/repo.Dockerfile
restart: always
depends_on:
- redis
environment:
REDIS_URL: redis://redis:6379
UPSTREAM_IPFS_URL: http://localhost:9095
ports:
- '3000:3000'
Loading

0 comments on commit 1c69022

Please sign in to comment.