Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing continuous integration #218

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"JuanBlanco.solidity"
]
}
},
"containerEnv": {
"PRIVATE_KEY": "${localEnv:PRIVATE_KEY}",
"PUBLIC_KEY": "${localEnv:PUBLIC_KEY}",
"RPC_URL": "${localEnv:RPC_URL}",
"OPG_URL": "${localEnv:OPG_URL}",
"OPS_URL": "${localEnv:OPS_URL}",
"ARS_URL": "${localEnv:ARS_URL}",
"HOLESKY_URL": "${localEnv:HOLESKY_URL}",
"ETHERSCAN_API_KEY": "${localEnv:ETHERSCAN_API_KEY}"
}
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
28 changes: 28 additions & 0 deletions .github/workflows/ci-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Dev Image CI
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
push: false
build-args: |
VERSION=latest
27 changes: 27 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Coverage
on: [workflow_dispatch, pull_request, push]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: npm install
run: |
npm ci --frozen-lockfile --production
- name: Run Forge coverage
run: |
forge coverage --report lcov
id: coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
25 changes: 8 additions & 17 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
name: Lint

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

permissions:
checks: write
contents: write

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2
with:
token: ${{ secrets.github_token }}

- name: Set up node
- name: Set up nodejs
uses: actions/setup-node@v1
with:
node-version: 18

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

- name: Run linters
uses: wearerequired/[email protected]
with:
github_token: ${{ secrets.github_token }}
prettier: true
prettier_extensions: 'js,json,jsx,md,ts,tsx,yaml,yml,sol'
continue_on_error: false
- name: install dependencies (npm)
run: npm ci --frozen-lockfile
- name: Prettier
run: npm run prettier:check
- name: Solhint
run: npm run lint
4 changes: 0 additions & 4 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Slither Analysis

on:
push:
branches:
- main
pull_request:

jobs:
analyze:
runs-on: ubuntu-latest
Expand All @@ -20,15 +18,13 @@ jobs:
uses: actions/checkout@v2
with:
token: ${{ secrets.github_token }}

- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
node-version: 16
sarif: results.sarif
fail-on: config

- if: failure()
uses: Ayrx/[email protected]
with:
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/tests.yaml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
name: Tests

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

permissions:
checks: write
contents: write

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2
with:
token: ${{ secrets.github_token }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Set up node
uses: actions/setup-node@v1
with:
node-version: 16

node-version: 18
- name: Install dependencies
run: npm install --frozen-lockfile

- name: Compile
run: npx hardhat compile

- name: Run unit tests
run: npx hardhat node & npx hardhat test
run: npm ci --frozen-lockfile
- name: solidity unit tests
run: forge test -v
18 changes: 14 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120
}
"semi": true,
"singleQuote": false,
"printWidth": 120,
"useTabs": false,
"bracketSpacing": true,
"plugins": [
"prettier-plugin-solidity"
],
"overrides": [
{
"files": "*.sol"
}
]
}
119 changes: 119 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "preinstall",
"type": "shell",
"command": "forge install",
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build"
}
},
{
"label": "install",
"type": "shell",
"command": "npm ci",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "preinstall",
"group": {
"kind": "build"
}
},
{
"label": "prettier",
"type": "shell",
"command": "npm run prettier:check",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "install",
"group": {
"kind": "build"
}
},
{
"label": "lint",
"type": "shell",
"command": "npm run lint",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "prettier",
"group": {
"kind": "build"
}
},
{
"label": "build",
"type": "shell",
"command": "forge build --sizes",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "lint",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "test",
"type": "shell",
"command": "forge test -vvv",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "lint",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "coverage",
"type": "shell",
"command": "forge coverage",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "lint",
"group": {
"kind": "test",
"isDefault": false
}
},
{
"label": "gas",
"type": "shell",
"command": "forge test --gas-report",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "lint",
"group": {
"kind": "test",
"isDefault": false
}
},
{
"label": "slither",
"type": "shell",
"command": "slither .",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "lint",
"group": {
"kind": "test",
"isDefault": false
}
}
]
}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ghcr.io/collectivexyz/foundry:latest

ARG PROJECT=ethx
WORKDIR /workspaces/${PROJECT}
RUN chown -R foundry:foundry .
COPY --chown=foundry:foundry . .
ENV USER=foundry
USER foundry
ENV PATH=${PATH}:~/.cargo/bin:/usr/local/go/bin

RUN python3 -m pip install slither-analyzer --break-system-packages

RUN yamlfmt -lint .github/workflows/*.yml

RUN npm ci --frozen-lockfile
RUN npm run prettier:check
# RUN slither .
# RUN npm run lint
RUN forge test -v
RUN forge geiger --check contracts/*.sol contracts/*/*.sol
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

[![Test](https://github.com/stader-labs/ethx/actions/workflows/ci-image.yml/badge.svg)](https://github.com/stader-labs/ethx/actions/workflows/ci-image.yml)

# Overview

ETHx is a multi pool architecture for node operations, designed for decentralization, scalability, and resilience. This design is integral to our ability to democratize node operations and adapt to increasing demand.
Expand Down
Loading
Loading