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

chore: add testing pipeline #40

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v1
with:
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Test
on:
push:

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 360 # todo: decrease after testing works
steps:
# set up environment
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

# install dependencies, start hardhat node
- run: npm ci
- name: Start Hardhat Fork
run: npx hardhat node --fork ${{ secrets.ETH_RPC }} &

# mint test tokens
- uses: actions/checkout@v4
with:
repository: curvefi/mint-test-tokens
path: mint-test-tokens
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: mint-test-tokens/requirements.txt
- name: Mint test tokens
run: |
pip install -r requirements.txt
mkdir .brownie
brownie networks add Ethereum \
mainnet-hardhat-fork \
chainid=1 \
host=http://localhost:8545 \
explorer=https://api.etherscan.io/api?apikey=${{ secrets.ETHERSCAN_API_KEY }}
brownie networks list
brownie run mainnet-mint --network mainnet-hardhat-fork -i
working-directory: mint-test-tokens

# build and run tests
- run: npm run build:tests
- run: npm run test

lint:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/test' # todo: remove after testing works
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint

build:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/test' # todo: remove after testing works
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.idea
.brownie
node_modules
dist
lib
package-lock.json
pnpm-lock.yaml
yarn.lock
test/temp.test.ts
test/rpcUrls.test.ts
cache/
13 changes: 13 additions & 0 deletions hardhat.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
networks: {
hardhat: {
chainId: 1,
hardfork: "shanghai",
// base fee of 0 allows use of 0 gas price when testing
initialBaseFeePerGas: 0,
// brownie expects calls and transactions to throw on revert
throwOnTransactionFailures: true,
throwOnCallFailures: true
},
},
};
Loading
Loading