Skip to content

Commit

Permalink
Add CodeCov reporting back after a 3 year hiatus (#1788)
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed May 15, 2024
1 parent b98ef1e commit 2c0d6e2
Show file tree
Hide file tree
Showing 21 changed files with 108 additions and 118 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
matrix:
node-version: [18.x, 20.x]
package:
- packages/cli-hooks
- packages/logger
- packages/oauth
- packages/rtm-api
- packages/socket-mode
- packages/types
- packages/web-api
- packages/webhook
- cli-hooks
- logger
- oauth
- rtm-api
- socket-mode
- types
- web-api
- webhook
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -32,15 +32,28 @@ jobs:
- name: Get Development Dependencies
run: npm i
- name: Build and Run Tests in Each Package
working-directory: ${{ matrix.package }}
working-directory: packages/${{ matrix.package }}
run: |
npm install || npm list
# depending on which package we are testing, also npm link up other dependent packages
case "$PWD" in
*/webhook) pushd ../types && npm i && popd && npm link ../types;;
*/web-api) pushd ../types && npm i && popd && npm link ../types && pushd ../logger && npm i && popd && npm link ../logger;;
*/oauth) pushd ../logger && npm i && popd && npm link ../logger && pushd ../web-api && npm i && popd && npm link ../web-api;;
# TODO: add socket-mode here once new major version released
*/socket-mode) pushd ../logger && npm i && popd && npm link ../logger && pushd ../web-api && npm i && popd && npm link ../web-api;;
*) ;; # default
esac
npm test
- name: Check for coverage report existence
id: check_coverage
uses: andstor/file-existence-action@v3
with:
files: packages/${{ matrix.package }}/coverage/lcov.info
- name: Upload code coverage
if: matrix.node-version == '20.x' && steps.check_coverage.outputs.files_exists == 'true'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: packages/${{ matrix.package }}/coverage
flags: ${{ matrix.package }}
verbose: true
28 changes: 28 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
comment:
layout: "condensed_header, diff, flags"

flags:
cli-hooks:
paths:
- packages/cli-hooks/**
carryforward: true
logger:
paths:
- packages/logger/**
carryforward: true
oauth:
paths:
- packages/oauth/**
carryforward: true
socket-mode:
paths:
- packages/socket-mode/**
carryforward: true
web-api:
paths:
- packages/web-api/**
carryforward: true
webhook:
paths:
- packages/webhook/**
carryforward: true
15 changes: 0 additions & 15 deletions lerna.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/cli-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"eslint-plugin-node": "^11.1.0",
"mocha": "^10.2.0",
"shx": "^0.3.4",
"sinon": "^17.0.1"
"sinon": "^17.0.1",
"typescript": "5.4.5"
}
}
7 changes: 7 additions & 0 deletions packages/logger/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["src/*.ts"],
"exclude": ["**/*.spec.js"],
"reporter": ["lcov", "text"],
"all": false,
"cache": true
}
1 change: 0 additions & 1 deletion packages/logger/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
/dist

# coverage
/.nyc_output
/coverage
14 changes: 0 additions & 14 deletions packages/logger/.nycrc.json

This file was deleted.

8 changes: 4 additions & 4 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"build:clean": "shx rm -rf ./dist ./coverage",
"lint": "eslint --ext .ts src",
"mocha": "mocha --config .mocharc.json src/*.spec.js",
"test:unit": "npm run build && npm run mocha",
"test": "npm run lint && npm run test:unit",
"coverage": "npm run build && nyc --reporter=text-summary npm run mocha",
"test": "npm run lint && npm run coverage",
"coverage": "npm run build && c8 npm run mocha",
"ref-docs:model": "api-extractor run"
},
"dependencies": {
Expand All @@ -45,6 +45,7 @@
"@types/mocha": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.0",
"c8": "^9.1.0",
"chai": "^4.3.8",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand All @@ -54,7 +55,6 @@
"eslint-plugin-jsdoc": "^46.5.0",
"eslint-plugin-node": "^11.1.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"shx": "^0.3.2",
"sinon": "^15.2.0",
"source-map-support": "^0.5.21",
Expand Down
7 changes: 7 additions & 0 deletions packages/oauth/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["src/*.ts"],
"exclude": ["**/*.spec.js", "**/*.spec.ts"],
"reporter": ["lcov", "text"],
"all": false,
"cache": true
}
4 changes: 1 addition & 3 deletions packages/oauth/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ package-lock.json
/dist

# coverage
/.nyc_output
/coverage
*.lcov
tmp/
tmp/
14 changes: 0 additions & 14 deletions packages/oauth/.nycrc.json

This file was deleted.

9 changes: 5 additions & 4 deletions packages/oauth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"build:clean": "shx rm -rf ./dist ./coverage",
"lint": "eslint --fix --ext .ts src",
"test": "npm run build && npm run lint && npm run test:mocha",
"test:mocha": "nyc --reporter=text-summary mocha --config .mocharc.json src/*.spec.js src/**/*.spec.js src/*.spec.ts src/**/*.spec.ts",
"test": "npm run lint && npm run coverage",
"coverage": "npm run build && c8 npm run test:mocha",
"test:mocha": "mocha --config .mocharc.json src/*.spec.js src/**/*.spec.js src/*.spec.ts src/**/*.spec.ts",
"ref-docs:model": "api-extractor run",
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build"
},
Expand All @@ -52,6 +53,7 @@
"@types/sinon": "^17",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"c8": "^9.1.0",
"chai": "^4",
"eslint": "^8",
"eslint-config-airbnb-base": "^15",
Expand All @@ -61,7 +63,6 @@
"eslint-plugin-jsdoc": "^48",
"eslint-plugin-node": "^11",
"mocha": "^10",
"nyc": "^15",
"rewiremock": "^3",
"shx": "^0.3.2",
"sinon": "^17",
Expand Down
7 changes: 7 additions & 0 deletions packages/socket-mode/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["src/*.ts"],
"exclude": ["**/*.spec.ts"],
"reporter": ["lcov", "text"],
"all": false,
"cache": true
}
14 changes: 0 additions & 14 deletions packages/socket-mode/.nycrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions packages/socket-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"build:clean": "shx rm -rf ./dist ./coverage",
"lint": "eslint --ext .ts src",
"test:unit": "mocha --config .mocharc.json src/**/*.spec.ts",
"test:coverage": "nyc --reporter=text npm run test:unit",
"test:coverage": "c8 npm run test:unit",
"test:integration": "mocha --config .mocharc.json test/integration.spec.js",
"test": "npm run lint && npm run build && npm run test:coverage && npm run test:integration",
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm test"
Expand All @@ -61,6 +61,7 @@
"@types/sinon": "^17",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"c8": "^9.1.0",
"chai": "^4",
"eslint": "^8",
"eslint-config-airbnb-base": "^15",
Expand All @@ -71,7 +72,6 @@
"eslint-plugin-node": "^11",
"mocha": "^10",
"nodemon": "^3.1.0",
"nyc": "^15",
"shx": "^0.3.2",
"sinon": "^17",
"source-map-support": "^0.5.21",
Expand Down
7 changes: 7 additions & 0 deletions packages/web-api/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["src/*.ts"],
"exclude": ["**/*.spec.js"],
"reporter": ["lcov", "text"],
"all": false,
"cache": true
}
14 changes: 0 additions & 14 deletions packages/web-api/.nycrc.json

This file was deleted.

8 changes: 4 additions & 4 deletions packages/web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"build:clean": "shx rm -rf ./dist ./coverage",
"lint": "eslint --ext .ts src",
"mocha": "mocha --config .mocharc.json src/*.spec.js",
"test": "npm run lint && npm run test:unit && npm run test:types && npm run test:integration",
"test": "npm run lint && npm run test:types && npm run test:integration && npm run test:unit",
"test:integration": "npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs",
"test:unit": "npm run build && nyc --reporter=text-summary npm run mocha",
"test:unit": "npm run build && c8 npm run mocha",
"test:types": "tsd",
"ref-docs:model": "api-extractor run",
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build"
Expand Down Expand Up @@ -68,6 +68,7 @@
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"busboy": "^1",
"c8": "^9.1.0",
"chai": "^4",
"eslint": "^8",
"eslint-config-airbnb-base": "^15",
Expand All @@ -78,7 +79,6 @@
"eslint-plugin-node": "^11",
"mocha": "^10",
"nock": "^13",
"nyc": "^15",
"shx": "^0.3.2",
"sinon": "^17",
"source-map-support": "^0.5.21",
Expand Down
7 changes: 7 additions & 0 deletions packages/webhook/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["src/*.ts"],
"exclude": ["**/*.spec.js"],
"reporter": ["lcov", "text"],
"all": false,
"cache": true
}
14 changes: 0 additions & 14 deletions packages/webhook/.nycrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions packages/webhook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"scripts": {
"prepare": "npm run build",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"build:clean": "shx rm -rf ./dist ./coverage",
"lint": "eslint --ext .ts src",
"mocha": "mocha --config .mocharc.json src/*.spec.js",
"test": "npm run lint && npm run test:unit",
"test:unit": "npm run build && nyc --reporter=text-summary npm run mocha",
"test:unit": "npm run build && c8 npm run mocha",
"ref-docs:model": "api-extractor run"
},
"dependencies": {
Expand All @@ -50,6 +50,7 @@
"@types/mocha": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.0",
"c8": "^9.1.0",
"chai": "^4.3.8",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand All @@ -60,7 +61,6 @@
"eslint-plugin-node": "^11.1.0",
"mocha": "^10.2.0",
"nock": "^13.3.3",
"nyc": "^15.1.0",
"shx": "^0.3.2",
"sinon": "^17.0.0",
"source-map-support": "^0.5.21",
Expand Down

0 comments on commit 2c0d6e2

Please sign in to comment.