Skip to content

Commit

Permalink
ci: enable integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
tamtamchik committed Jul 8, 2024
1 parent 281beca commit 15b0f27
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 130 deletions.
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ LOCAL_LOCATOR_ADDRESS=
LOCAL_AGENT_ADDRESS=
LOCAL_VOTING_ADDRESS=

# https://docs.lido.fi/deployed-contracts
MAINNET_RPC_URL=http://localhost:8545
MAINNET_LOCATOR_ADDRESS=
MAINNET_AGENT_ADDRESS=
MAINNET_VOTING_ADDRESS=
MAINNET_LOCATOR_ADDRESS=0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb
MAINNET_AGENT_ADDRESS=0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c
MAINNET_VOTING_ADDRESS=0x2e59A20f205bB85a89C53f1936454680651E618e
17 changes: 4 additions & 13 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Analysis
name: Code analysis

on:
push:
Expand All @@ -8,7 +8,7 @@ on:

jobs:
slither:
name: Slither Code Analysis
name: Slither
runs-on: ubuntu-latest

permissions:
Expand All @@ -17,18 +17,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"

- name: Install dependencies
run: yarn install
- name: Common Setup
uses: ./.github/workflows/setup

# REVIEW: here and below steps taken from official guide
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,11 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"

- name: Install dependencies
run: yarn install
- name: Common Setup
uses: ./.github/workflows/setup

# Remove the integration tests from the test suite, as they require a mainnet fork to run properly
- name: Cleanup test from specs
run: rm -rf test/integration/**/*.spec.ts

Expand Down
44 changes: 18 additions & 26 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,41 @@ name: Linters
on: [push]

jobs:
lint:
name: Solidity & TypeScript Linters Check
solhint:
name: Solhint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"

- name: Install dependencies
run: yarn install
- name: Common Setup
uses: ./.github/workflows/setup

- name: Run Solidity linters
run: yarn lint:sol

eslint:
name: ESLint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Common Setup
uses: ./.github/workflows/setup

- name: Run TS linters
run: yarn lint:ts

types:
name: TypeScript Errors Check
typescript:
name: TypeScript
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: corepack enable

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"

- name: Install dependencies
run: yarn install
- name: Common Setup
uses: ./.github/workflows/setup

- name: Generate typechain types
run: yarn hardhat compile
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Common Setup

on: workflow_call

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- run: corepack enable

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: |
~/.npm
~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
30 changes: 30 additions & 0 deletions .github/workflows/tests-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on: [push]

jobs:

test_hardhat_integration:
name: Hardhat Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 120

services:
hardhat-node:
image: feofanov/hardhat-node
ports:
- 8545:8545
env:
ETH_RPC_URL: https://eth.drpc.org

steps:
- uses: actions/checkout@v4

- name: Common Setup
uses: ./.github/workflows/setup

- name: Set env
run: cp .env.example .env

- name: Run Hardhat Solidity tests
run: yarn test:integration:fork
37 changes: 37 additions & 0 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on: [push]

jobs:
test_hardhat_unit:
name: Hardhat Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Common Setup
uses: ./.github/workflows/setup

- name: Run Hardhat Solidity tests
run: yarn test

test_foundry_fuzzing:
name: Foundry Fuzzing & Invariant Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Common Setup
uses: ./.github/workflows/setup

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
# Use a specific version of Foundry in case nightly is broken
# https://github.com/foundry-rs/foundry/releases
# with:
# version: nightly-54d8510c0f2b0f791f4c5ef99866c6af99b7606a

- name: Run tests
run: forge test -vvv
77 changes: 0 additions & 77 deletions .github/workflows/tests.yml

This file was deleted.

0 comments on commit 15b0f27

Please sign in to comment.