Skip to content

Commit

Permalink
ci: set up github ci
Browse files Browse the repository at this point in the history
* wip: setting up ci
* chore: update npm commands and solhint files
* lint: fix solhint issues
* fix: imports
* chore: update markdownlint
* chore: empty readme file
* chore: rm irrelevant test
* gas: add snapshot
* chore: upgrade prettier version and rm eslint config dependency
* gas: replace snapshot with clean one
  • Loading branch information
xenide authored Jun 6, 2024
1 parent 97a47ab commit 4589983
Show file tree
Hide file tree
Showing 20 changed files with 3,248 additions and 135 deletions.
75 changes: 75 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
FlagsLibTest:testGetDecimalDifference() (gas: 3974)
FlagsLibTest:testIsCompositeRoute() (gas: 4341)
FlagsLibTest:testPackSimplePrice(int8,uint256) (runs: 256, μ: 7794, ~: 7555)
QueryProcessorTest:testFindNearestSample_CanFindExactValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 67643035, ~: 75383254)
QueryProcessorTest:testFindNearestSample_CanFindIntermediateValue(uint32,uint256,uint256,uint256) (runs: 256, μ: 72673686, ~: 80564855)
QueryProcessorTest:testFindNearestSample_NotInitialized() (gas: 8937393461068805977)
QueryProcessorTest:testFindNearestSample_OneSample(uint256) (runs: 256, μ: 80316, ~: 80360)
QueryProcessorTest:testGetInstantValue() (gas: 124248)
QueryProcessorTest:testGetInstantValue_NotInitialized(uint256) (runs: 256, μ: 19397, ~: 19397)
QueryProcessorTest:testGetInstantValue_NotInitialized_BeyondBufferSize(uint8,uint16) (runs: 256, μ: 68389660, ~: 68389600)
QueryProcessorTest:testGetPastAccumulator_BufferEmpty(uint8) (runs: 256, μ: 27027, ~: 27087)
QueryProcessorTest:testGetPastAccumulator_ExactMatch(uint32,uint256,uint256,uint16) (runs: 256, μ: 71794443, ~: 81233735)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_LatestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 70068127, ~: 79224986)
QueryProcessorTest:testGetPastAccumulator_ExactMatch_OldestAccumulator(uint32,uint256,uint256) (runs: 256, μ: 70098130, ~: 79256586)
QueryProcessorTest:testGetPastAccumulator_ExtrapolatesBeyondLatest(uint32,uint256,uint256,uint256) (runs: 256, μ: 72646619, ~: 80536404)
QueryProcessorTest:testGetPastAccumulator_InterpolatesBetweenPastAccumulators(uint32,uint256,uint256,uint256) (runs: 256, μ: 72681141, ~: 80570863)
QueryProcessorTest:testGetPastAccumulator_InvalidAgo(uint32,uint256,uint256,uint256) (runs: 256, μ: 72638228, ~: 80528115)
QueryProcessorTest:testGetPastAccumulator_QueryTooOld(uint32,uint256,uint256,uint256) (runs: 256, μ: 72649511, ~: 80537999)
QueryProcessorTest:testGetTimeWeightedAverage(uint32,uint256,uint256,uint256,uint256) (runs: 256, μ: 107655745, ~: 114208383)
QueryProcessorTest:testGetTimeWeightedAverage_BadSecs() (gas: 10995)
ReservoirPriceOracleTest:testClearRoute() (gas: 52090)
ReservoirPriceOracleTest:testClearRoute_AllWordsCleared() (gas: 155074)
ReservoirPriceOracleTest:testDesignatePair() (gas: 29047)
ReservoirPriceOracleTest:testDesignatePair_IncorrectPair() (gas: 21089)
ReservoirPriceOracleTest:testDesignatePair_NotOwner() (gas: 17487)
ReservoirPriceOracleTest:testDesignatePair_TokenOrderReversed() (gas: 30619)
ReservoirPriceOracleTest:testGasBountyAvailable(uint256) (runs: 256, μ: 9927, ~: 9925)
ReservoirPriceOracleTest:testGasBountyAvailable_Zero() (gas: 8961)
ReservoirPriceOracleTest:testGetLargestSafeQueryWindow() (gas: 8390)
ReservoirPriceOracleTest:testGetLatest(uint32) (runs: 256, μ: 92769, ~: 92726)
ReservoirPriceOracleTest:testGetLatest_Inverted() (gas: 96846)
ReservoirPriceOracleTest:testGetPastAccumulators() (gas: 196354)
ReservoirPriceOracleTest:testGetPastAccumulators_Inverted() (gas: 156772)
ReservoirPriceOracleTest:testGetQuote(uint256,uint256) (runs: 256, μ: 35749, ~: 35862)
ReservoirPriceOracleTest:testGetQuote_AmountInTooLarge() (gas: 13002)
ReservoirPriceOracleTest:testGetQuote_ComplicatedDecimals() (gas: 10352998)
ReservoirPriceOracleTest:testGetQuote_Inverse(uint256,uint256) (runs: 256, μ: 37911, ~: 38085)
ReservoirPriceOracleTest:testGetQuote_MultipleHops() (gas: 114368)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_Inverse() (gas: 114626)
ReservoirPriceOracleTest:testGetQuote_MultipleHops_PriceZero() (gas: 127226)
ReservoirPriceOracleTest:testGetQuote_NoPath() (gas: 11697)
ReservoirPriceOracleTest:testGetQuote_PriceZero() (gas: 16470)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_1HopRoute(uint256,uint256,address,address,uint8,uint8) (runs: 256, μ: 5327808, ~: 5327931)
ReservoirPriceOracleTest:testGetQuote_RandomizeAllParam_2HopRoute(uint256,uint256,uint256,address,address,address,uint8,uint8,uint8) (runs: 256, μ: 10493751, ~: 10493869)
ReservoirPriceOracleTest:testGetQuote_SameBaseQuote(uint256,address) (runs: 256, μ: 8987, ~: 8987)
ReservoirPriceOracleTest:testGetQuote_ZeroIn() (gas: 39282)
ReservoirPriceOracleTest:testGetQuotes(uint256,uint256) (runs: 256, μ: 33308, ~: 33421)
ReservoirPriceOracleTest:testGetTimeWeightedAverage() (gas: 141982)
ReservoirPriceOracleTest:testGetTimeWeightedAverage_Inverted() (gas: 121063)
ReservoirPriceOracleTest:testSetRoute() (gas: 58782)
ReservoirPriceOracleTest:testSetRoute_InvalidRoute() (gas: 17960)
ReservoirPriceOracleTest:testSetRoute_InvalidRouteLength() (gas: 17567)
ReservoirPriceOracleTest:testSetRoute_MultipleHops() (gas: 196025)
ReservoirPriceOracleTest:testSetRoute_NotSorted() (gas: 12073)
ReservoirPriceOracleTest:testSetRoute_OverwriteExisting() (gas: 162468)
ReservoirPriceOracleTest:testSetRoute_SameToken() (gas: 12026)
ReservoirPriceOracleTest:testUndesignatePair() (gas: 30263)
ReservoirPriceOracleTest:testUndesignatePair_NotOwner() (gas: 15354)
ReservoirPriceOracleTest:testUpdatePriceDeviationThreshold(uint256) (runs: 256, μ: 21397, ~: 21080)
ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold() (gas: 214272)
ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold_InsufficientReward(uint256) (runs: 256, μ: 203473, ~: 203684)
ReservoirPriceOracleTest:testUpdatePrice_BeyondThreshold_ZeroRecipient() (gas: 195975)
ReservoirPriceOracleTest:testUpdatePrice_FirstUpdate() (gas: 203451)
ReservoirPriceOracleTest:testUpdatePrice_IntermediateRoutes() (gas: 15868694)
ReservoirPriceOracleTest:testUpdatePrice_PriceOutOfRange() (gas: 5353128)
ReservoirPriceOracleTest:testUpdatePrice_WithinThreshold() (gas: 204527)
ReservoirPriceOracleTest:testUpdateRewardGasAmount() (gas: 19039)
ReservoirPriceOracleTest:testUpdateRewardGasAmount_NotOwner() (gas: 10984)
ReservoirPriceOracleTest:testUpdateTwapPeriod(uint256) (runs: 256, μ: 21663, ~: 21773)
ReservoirPriceOracleTest:testUpdateTwapPeriod_InvalidTwapPeriod(uint256) (runs: 256, μ: 17830, ~: 18120)
ReservoirPriceOracleTest:testWritePriceCache(uint256) (runs: 256, μ: 29932, ~: 29733)
SamplesTest:testAccumulator() (gas: 3959)
SamplesTest:testAccumulator_BadVariableRequest() (gas: 3523)
SamplesTest:testInstant() (gas: 3909)
SamplesTest:testInstant_BadVariableRequest() (gas: 3566)
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: ci

on: push

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

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run lint:check

test-unit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- run: npm run test:unit

test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- run: npm run test:integration

check-gas:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- run: forge snapshot --check
env:
FOUNDRY_PROFILE: default

coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- run: ./script/coverage_patch_deployer.sh && forge coverage --report lcov
env:
FOUNDRY_PROFILE: coverage
- run: sudo apt install -y lcov
- run: lcov -r lcov.info "src/libraries/*" -o lcov.info
- run: lcov -r lcov.info "test/*" -o lcov.info
- run: |
! lcov --summary lcov.info | grep -q 0.0%
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./lcov.info
34 changes: 0 additions & 34 deletions .github/workflows/test.yml

This file was deleted.

14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compiler files
cache/
out/
/cache
/out

# Ignores development broadcast logs
!/broadcast
Expand All @@ -12,3 +12,13 @@ docs/

# Dotenv file
.env

# slither
/slither-report.md

# typechain
/typings

# node
/node_modules

4 changes: 4 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default: true

MD024:
siblings_only: true
8 changes: 8 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# .gitignore
/out
/ref
/node_modules

# unique
/lib
/reference
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.17.0
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/broadcast
/cache
/out
/node_modules
/lib
/reference
66 changes: 0 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +0,0 @@
## Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
Loading

0 comments on commit 4589983

Please sign in to comment.