Skip to content

CI

CI #86

Workflow file for this run

name: CI
on:
push:
branches:
- main
workflow_dispatch:
inputs:
workflow_to_run:
type: choice
description: Which workflow to run?
required: true
options:
- all
- hardhat-tests
- foundry-tests
pull_request:
types:
- ready_for_review
- review_requested
pull_request_review:
types: [submitted]
defaults:
run:
shell: bash
jobs:
run-linters:
if: github.ref == 'refs/heads/main' || github.event.review.state == 'approved' || github.event.action == 'ready_for_review' || github.event.action == 'review_requested'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: yarn-
- name: Install dependencies
run: |
npm config set //registry.npmjs.org/
yarn install --frozen-lockfile
- name: Run solhint
run: yarn lint:sol
- name: Run eslint
run: yarn lint:js:fix
hardhat-tests:
if: github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'hardhat-tests' || github.event.review.state == 'approved' || github.event.action == 'ready_for_review' || github.event.action == 'review_requested'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: yarn-
- name: Install dependencies
run: |
npm config set //registry.npmjs.org/
yarn install --frozen-lockfile
- name: Compile
run: yarn hardhat:compile
- run: export NODE_OPTIONS=--max_old_space_size=11264
- name: Run unit tests
run: yarn hardhat:test
env:
ENABLE_GAS_REPORT: true
CI: true
ETH_NODE_URI_FORKPOLYGON: ${{secrets.ETH_NODE_URI_FORKPOLYGON}}
ETH_NODE_URI_OPTIMISM: ${{secrets.ETH_NODE_URI_OPTIMISM}}
ETH_NODE_URI_AVALANCHE: ${{secrets.ETH_NODE_URI_AVALANCHE}}
ETH_NODE_URI_ARBITRUM: ${{secrets.ETH_NODE_URI_ARBITRUM}}
ETH_NODE_URI_MAINNET: ${{secrets.ETH_NODE_URI_MAINNET}}
foundry-tests:
if: github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'foundry-tests' || github.event.review.state == 'approved' || github.event.action == 'ready_for_review' || github.event.action == 'review_requested'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: yarn-
- run: yarn install --frozen-lockfile
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Foundry tests
run: yarn foundry:test
env:
ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}