Skip to content

Commit

Permalink
Adding CodeCov Integration to Track Code Coverage (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Whytecrowe authored Apr 17, 2023
2 parents d173b50 + 3d8a475 commit 49f629e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 34 deletions.
35 changes: 9 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,32 @@ version: 2.1

orbs:
node: circleci/[email protected]
codecov: codecov/[email protected]

defaults: &defaults
working_directory: ~/repo
docker:
- image: cimg/node:18.15.0

jobs:
test:
test and coverage:
<<: *defaults
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
- run: yarn build
- run: yarn lint
- run: yarn test # Validate Unit Tests Pass
- persist_to_workspace:
root: ~/repo
paths: .
coverage:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: Code Coverage Report
command: yarn coverage
- run:
name: Validate Code Coverage Threshold
command: yarn check-coverage #Validate code is adequately covered by unit tests
- codecov/upload
- persist_to_workspace:
root: ~/repo
paths: .
publish:
<<: *defaults
steps:
Expand All @@ -44,34 +40,21 @@ workflows:
version: 2
build:
jobs:
- test:
filters:
branches:
ignore:
- development
- coverage:
requires:
- test
- test and coverage:
filters:
branches:
ignore:
- development
development:
jobs:
- test:
- test and coverage:
filters:
&filters-development # this yaml anchor is setting these values to "filters-production"
branches:
only: development
- coverage:
requires:
- test
filters:
<<: *filters-development # this is calling the previously set yaml anchor
- publish:
context: CPT
requires:
- test
- coverage
- test and coverage
filters:
<<: *filters-development # this is calling the previously set yaml anchor
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"compile": "hardhat compile",
"lint-sol": "yarn solhint \"contracts/**/*.sol\"",
"lint-ts": "yarn eslint ./test/**/*.ts",
"lint-ts": "yarn eslint ./test/** ./src/**",
"lint": "yarn lint-sol && yarn lint-ts",
"clean": "hardhat clean",
"build": "yarn run clean && yarn run compile",
Expand All @@ -22,9 +22,6 @@
},
"author": "Zero CPT",
"license": "ISC",
"pre-commit": [
"lint"
],
"devDependencies": {
"@ethersproject/providers": "5.7.2",
"@nomicfoundation/hardhat-chai-matchers": "1.0.6",
Expand Down
8 changes: 5 additions & 3 deletions src/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as hre from 'hardhat';
import { ZNSRegistry, ZNSRegistry__factory } from '../typechain';
import * as hre from "hardhat";
import { ZNSRegistry, ZNSRegistry__factory } from "../typechain";

// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
async function main () {
const [deployer, fakeResolver] = await hre.ethers.getSigners();
const [deployer] = await hre.ethers.getSigners();

const factory = new ZNSRegistry__factory(deployer);
const registry : ZNSRegistry = await factory.deploy();
Expand All @@ -13,6 +14,7 @@ async function main () {
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch(error => {
// eslint-disable-next-line no-console
console.error(error);
process.exitCode = 1;
});
3 changes: 2 additions & 1 deletion test/ZNSDomainToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { expect } from "chai";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { ethers } from "ethers";


describe("ZNSDomainToken:", () => {
const TokenName = "ZNSDomainToken";
const TokenSymbol = "ZDT";
Expand Down Expand Up @@ -119,4 +120,4 @@ describe("ZNSDomainToken:", () => {
expect(symbol).to.equal(TokenSymbol);
});
});
});
});

0 comments on commit 49f629e

Please sign in to comment.