Skip to content

Commit

Permalink
refactor github action to run without extra docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Oct 27, 2022
1 parent 97bff0b commit 9cf34ff
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
43 changes: 34 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,52 @@ on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
env:
FORK_MAINNET: ${{ secrets.FORK_MAINNET }}
QUICK_NODE_KEY: ${{ secrets.QUICK_NODE_KEY }}
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v2

- name: Clear
run: docker container prune -f && docker image prune -f
- uses: actions/setup-node@v2
with:
node-version: 16
cache: "yarn"

- name: Install deps
run: yarn

- name: Install solidity
run: yarn global add [email protected]

- name: "Create env file"
run: |
touch .env
echo FORK_MAINNET=${{ secrets.FORK_MAINNET }} >> .env
echo QUICK_NODE_KEY=${{ secrets.QUICK_NODE_KEY }} >> .env
- name: Build docker
run: docker build -t isolated:${GITHUB_SHA::7} .

- name: Run hardhat compile and tests coverage
run: docker run --name ${GITHUB_SHA::7} isolated:${GITHUB_SHA::7} bash -c "yarn hardhat:compile && yarn hardhat:coverage && yarn hardhat:coverage-validator"
run: |
source .env
yarn hardhat:compile && yarn hardhat:coverage
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: coverage/**/cobertura-coverage.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '50 80'

- name: Clear
run: docker rm ${GITHUB_SHA::7}
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
1 change: 1 addition & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ module.exports = {
onTestsComplete: moveCoverageBack,
skipFiles: ['test', 'oracle'].concat(
process.env['SKIP_UNITROLLER'] ? ['Unitroller.sol'] : []),
istanbulReporter: ['html', 'lcov', 'text', 'json', 'cobertura']
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "yarn remove ethers && yarn remove ethereum-waffle && rebuild=true ./script/test && yarn add [email protected] && yarn add [email protected]",
"hardhat:test": "hardhat test",
"hardhat:compile": "hardhat compile",
"hardhat:coverage": "hardhat coverage ",
"hardhat:coverage": "hardhat coverage",
"lint:sol": "solhint --max-warnings 0 \"contracts/**/*.sol\"",
"lint:sol:fix": "prettier --write \"contracts/**/*.sol\"",
"build": "rm -rf dist && tsc --declaration && hardhat compile && cp -r ./{package.json,yarn.lock,artifacts,networks,contracts,deployments} dist/",
Expand Down

0 comments on commit 9cf34ff

Please sign in to comment.