Skip to content

Commit

Permalink
Send coverage reports to Codacy (#5444)
Browse files Browse the repository at this point in the history
* Send coverage reports to Codacy

* Action secrets may not be read from forks :(

* Let's see if this fixes the path & key passing

* Ok one more try for the Actions env

* Run tests and coverage separately

* Try increasing the admintools test runtime for Node 10

* Run tests only once
  • Loading branch information
sulkaharo authored Jan 12, 2020
1 parent 937aa47 commit 64663d2
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ jobs:
sudo apt-get install -y --allow-downgrades mongodb-org=3.6.14 mongodb-org-server=3.6.14 mongodb-org-shell=3.6.14 mongodb-org-mongos=3.6.14 mongodb-org-tools=3.6.14
- name: Start MongoDB
run: sudo systemctl start mongod
- name: Run tests
- name: Run Tests
run: npm run-script test-ci
- name: Send Coverage
run: npm run-script coverage
3 changes: 2 additions & 1 deletion ci.test.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ HOSTNAME=localhost
INSECURE_USE_HTTP=true
PORT=1337
NODE_ENV=production
CI=true
CI=true
CODACY_PROJECT_TOKEN=cff7ab3377d6434a9355fd051dbb4595
105 changes: 105 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"scripts": {
"start": "node server.js",
"test": "env-cmd ./my.test.env mocha --exit tests/*.test.js",
"test-ci": "env-cmd ./ci.test.env mocha --exit tests/*.test.js",
"test-ci": "env-cmd ./ci.test.env nyc --reporter=lcov --reporter=text-summary mocha --exit tests/*.test.js",
"env": "env",
"postinstall": "webpack --mode production --config webpack.config.js && npm run-script update-buster",
"bundle": "webpack --mode production --config webpack.config.js && npm run-script update-buster",
"bundle-dev": "webpack --mode development --config webpack.config.js && npm run-script update-buster",
"bundle-analyzer": "webpack --mode development --config webpack.config.js --profile --json > stats.json && webpack-bundle-analyzer stats.json",
"update-buster": "node bin/generateCacheBuster.js >tmp/cacheBusterToken",
"coverage": "env-cmd ./test.env nyc mocha --exit tests/*.test.js",
"coverage": "cat ./coverage/lcov.info | env-cmd ./ci.test.env codacy-coverage",
"dev": "env-cmd ./my.env nodemon server.js 0.0.0.0",
"prod": "env-cmd ./my.prod.env node server.js 0.0.0.0"
},
Expand Down Expand Up @@ -123,6 +123,7 @@
"devDependencies": {
"babel-eslint": "^10.0.3",
"benv": "^3.3.0",
"codacy-coverage": "^3.4.0",
"csv-parse": "^4.8.3",
"env-cmd": "^8.0.2",
"eslint": "^6.2.1",
Expand Down
2 changes: 1 addition & 1 deletion tests/admintools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var someData = {

describe('admintools', function ( ) {
var self = this;
this.timeout(30000); // TODO: see why this test takes longer on Travis to complete
this.timeout(45000); // TODO: see why this test takes longer on CI to complete
before(function (done) {
benv.setup(function() {

Expand Down

0 comments on commit 64663d2

Please sign in to comment.