Commit 21b17edd authored by rajivpoc's avatar rajivpoc

[added] badges on a per-package level with flags

parent 0f133753
---
'@eth-optimism/batch-submitter': patch
'@eth-optimism/core-utils': patch
'@eth-optimism/data-transport-layer': patch
'@eth-optimism/message-relayer': patch
---
Added coverage for packages
......@@ -60,45 +60,8 @@ jobs:
env:
CC_SECRET: ${{ secrets.CC_SECRET }}
# A hack that allows running a job only if a specific directory changed.
# Ref: https://github.community/t/run-job-only-if-folder-changed/118292
is-contracts-package:
name: Check files for changes to the contracts package
# This job will break on a push event, so we just skip it,
# which in turn skips the test-coverage job.
if: ${{ github.event_name != 'push' }}
outputs:
run_coverage: ${{ steps.check_files.outputs.run_coverage }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- run: git fetch origin $GITHUB_BASE_REF
- name: check modified files
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only origin/$GITHUB_BASE_REF HEAD -- .
echo "========== check paths of modified files =========="
git diff --name-only origin/$GITHUB_BASE_REF HEAD -- . > files.txt
while IFS= read -r file
do
echo $file
if [[ $file != packages/contracts/* ]]; then
echo "This modified files are not in the contracts package."
echo "::set-output name=run_coverage::false"
break
else
echo "::set-output name=run_coverage::true"
fi
done < files.txt
test-coverage:
name: Generate test coverage
needs: is-contracts-package
if: needs.is-contracts-package.outputs.run_coverage == 'true'
runs-on: ubuntu-latest
steps:
......@@ -142,6 +105,31 @@ jobs:
files: ./packages/contracts/coverage.json
fail_ci_if_error: false
verbose: true
flags: contracts
- uses: codecov/codecov-action@v1
with:
files: ./packages/core-utils/coverage.json
fail_ci_if_error: false
verbose: true
flags: core-utils
- uses: codecov/codecov-action@v1
with:
files: ./packages/batch-submitter/coverage.json
fail_ci_if_error: false
verbose: true
flags: batch-submitter
- uses: codecov/codecov-action@v1
with:
files: ./packages/data-transport-layer/coverage.json
fail_ci_if_error: false
verbose: true
flags: data-transport-layer
- uses: codecov/codecov-action@v1
with:
files: ./packages/message-relayer/coverage.json
fail_ci_if_error: false
verbose: true
flags: message-relayer
lint:
name: Linting
runs-on: ubuntu-latest
......
......@@ -3,6 +3,7 @@ node_modules
results
temp
.nyc_output
coverage.json
*.tsbuildinfo
dist
......
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR&flag=batch-submitter)](https://codecov.io/gh/ethereum-optimism/optimism)
# Batch Submitter
Contains an executable batch submitter service which watches L1 and a local L2 node and submits batches to the
......@@ -31,9 +32,9 @@ Examples:
### Submission
You may test a submission locally against a local Hardhat fork.
You may test a submission locally against a local Hardhat fork.
1. Follow the instructions [here](https://github.com/ethereum-optimism/hardhat) to run a Hardhat node.
1. Follow the instructions [here](https://github.com/ethereum-optimism/hardhat) to run a Hardhat node.
2. Change the Batch Submitter `.env` field `L1_NODE_WEB3_URL` to the local Hardhat url. Depending on which network you are using, update `ADDRESS_MANAGER_ADDRESS` according to the [Regenesis repo](https://github.com/ethereum-optimism/regenesis).
3. Also check `L2_NODE_WEB3_URL` is correctly set and has transactions to submit.
3. Run `yarn build` to build your changes.
......
......@@ -16,7 +16,8 @@
"pre-commit": "lint-staged",
"lint:fix": "yarn lint:check --fix",
"lint:check": "eslint .",
"test": "hardhat test --show-stack-traces"
"test": "hardhat test --show-stack-traces",
"test:coverage": "nyc hardhat test && nyc merge .nyc_output coverage.json"
},
"keywords": [
"optimism",
......
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR)](https://codecov.io/gh/ethereum-optimism/optimism)
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR&flag=contracts)](https://codecov.io/gh/ethereum-optimism/optimism)
# Optimistic Ethereum Smart Contracts
......
node_modules/
build/
\ No newline at end of file
build/
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR&flag=core-utils)](https://codecov.io/gh/ethereum-optimism/optimism)
# @eth-optimism/core-utils
## What is this?
......
......@@ -17,7 +17,8 @@
"lint:check": "eslint .",
"lint:fix": "yarn lint:check --fix",
"pre-commit": "lint-staged",
"test": "ts-mocha test/**/*.spec.ts"
"test": "ts-mocha test/**/*.spec.ts",
"test:coverage": "nyc ts-mocha test/**/*.spec.ts && nyc merge .nyc_output coverage.json"
},
"devDependencies": {
"@types/chai": "^4.2.17",
......@@ -26,20 +27,21 @@
"@types/prettier": "^2.2.3",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"chai": "^4.3.0",
"babel-eslint": "^10.1.0",
"chai": "^4.3.0",
"eslint": "^7.27.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ban": "^1.5.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsdoc": "^35.1.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-unicorn": "^32.0.1",
"lint-staged": "11.0.0",
"mocha": "^8.3.0",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"lint-staged": "11.0.0",
"ts-mocha": "^8.0.0",
"typescript": "^4.2.3"
},
......
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR&flag=data-transport-layer)](https://codecov.io/gh/ethereum-optimism/optimism)
# @eth-optimism/data-transport-layer
## What is this?
......
......@@ -18,6 +18,7 @@
"start": "ts-node ./src/services/run.ts",
"start:local": "ts-node ./src/services/run.ts | pino-pretty",
"test": "hardhat --config test/config/hardhat.config.ts test",
"test:coverage": "nyc hardhat --config test/config/hardhat.config.ts test && nyc merge .nyc_output coverage.json",
"build": "tsc -p tsconfig.build.json",
"pre-commit": "lint-staged"
},
......
[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/master/graph/badge.svg?token=0VTG7PG7YR&flag=message-relayer)](https://codecov.io/gh/ethereum-optimism/optimism)
# @eth-optimism/message-relayer
This package contains:
......@@ -63,7 +64,7 @@ const main = async () => {
// proof
// )
// }
}
}
main()
```
......@@ -18,7 +18,8 @@
"pre-commit": "lint-staged",
"lint:fix": "yarn lint:check --fix",
"lint:check": "eslint .",
"test": "hardhat test --show-stack-traces"
"test": "hardhat test --show-stack-traces",
"test:coverage": "nyc hardhat test && nyc merge .nyc_output coverage.json"
},
"keywords": [
"optimism",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment