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

[DNM]: chore update workflow #17

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
87 changes: 87 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# Solidity
# https://github.com/sambacha/prettier-config-solidity
[*.sol]
indent_size = 4
indent_style = space

# q
# kdb+
[*.q]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# Markdown
[*.{md,adoc,asciidoc}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = false

# Match nix files, set indent to spaces with width of two
[*.nix]
indent_style = space
indent_size = 2

# JavaScript, JSON, JSX, JavaScript Modules, TypeScript
# https://github.com/feross/standard
# https://prettier.io
[*.{cjs,js,json,jsx,mjs,ts,tsx,mts,cts}]
indent_size = 2
indent_style = space

# TOML
# https://github.com/toml-lang/toml/tree/master/examples
[*.toml]
indent_size = 2
indent_style = space

# YAML
# http://yaml.org/spec/1.2/2009-07-21/spec.html#id2576668
[*.{yaml,yml}]
indent_size = 2
indent_style = space

# Shell
# https://google.github.io/styleguide/shell.xml#Indentation
[*.{bash,sh,zsh}]
indent_size = 2
indent_style = space

# confg + cfg
[*.{conf,cfg}]
charset = UTF-8
end_of_line = LF
indent_size = 4
indent_style = tab
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

# Match diffs, avoid to trim trailing whitespace
[*.{diff,patch}]
trim_trailing_whitespace = false

# Ignore fixtures and vendored files
[{dist,artifacts,vendor,test/fixtures,tests_config,__snapshot__,}/**]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = unset
trim_trailing_spaces = unset
7 changes: 7 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
UnitTests:testAddLiquidity() (gas: 347004)
UnitTests:testCanAddRewards() (gas: 522056)
UnitTests:testCanCompoundFees() (gas: 899427)
UnitTests:testCannotCallbeforeInit() (gas: 2265365)
UnitTests:testFeesAccrue() (gas: 884410)
UnitTests:testNewUsersDontStealFees() (gas: 1145644)
UnitTests:testRemoveLiquidity() (gas: 575956)
93 changes: 89 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
name: test

on: push
on:
push:
paths:
- "**.sol"
- "**.toml"
- "**.json"
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# On-demand
workflow_dispatch: {}


env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]

name: Foundry project
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -32,3 +42,78 @@ jobs:
run: |
forge test -vvv
id: test

- name: Run Forge snapshot
run: forge snapshot
id: snapshot

- name: Run Forge coverage
run: forge coverage --report lcov
id: coverage

- name: Run Gas report
run: forge test --gas-report --isolate
id: gas-report

- name: Run Forge Snapshot Diff
run: forge snapshot --diff
id: snapshot_diff

- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
slither-args: --compile-force-framework foundry --exclude-dependencies --checklist
sarif: results.sarif
fail-on: none

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.slither.outputs.sarif }}

fork:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

name: Foundry project
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: false

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

- name: Run Forge build
run: |
forge --version
forge install
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv --rpc-url phalcon
id: test

- name: Run Forge snapshot
run: forge snapshot --rpc-url phalcon
id: snapshot

- name: Run Forge coverage
run: forge coverage --report lcov --rpc-url phalcon
id: coverage

- name: Run Gas report
run: forge test --gas-report --isolate --rpc-url phalcon
id: gas-report

- name: Run Forge Snapshot Diff
run: forge snapshot --diff --rpc-url phalcon
id: snapshot_diff
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "lib/v3-periphery"]
path = lib/v3-periphery
url = https://github.com/uniswap/v3-periphery
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/Vectorized/solady
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"trailofbits.sarif-explorer",
"usernamehw.errorlens",
"alefragnani.separators",
"nomicfoundation.hardhat-solidity",
"tintinweb.solidity-visual-auditor"
]
}
Loading