Skip to content

Commit

Permalink
write cache for node 4/6
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin committed Jan 9, 2018
1 parent 6566105 commit d9b6ed9
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 43 deletions.
14 changes: 12 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
# Constant values.

node_modules_cache_key: &node_modules_cache_key node-modules-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package-lock.json" }}
node_modules_cache_key: &node_modules_cache_key node-modules-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
test_fixtures_cache_key: &test_fixtures_cache_key test-fixtures-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "test/fixtures/plugin-fixtures.json" }}
test_env: &test_env
GCLOUD_PROJECT: 0
GCLOUD_TRACE_NEW_CONTEXT: 1

# Unit test workflow.

Expand All @@ -15,7 +18,7 @@ unit_tests: &unit_tests
- restore_cache:
key: *node_modules_cache_key
- run:
name: Install modules and dependencies (also compiles source)
name: Install modules and dependencies
command: npm install
- save_cache:
key: *node_modules_cache_key
Expand All @@ -24,6 +27,9 @@ unit_tests: &unit_tests
- run:
name: Check code style and linting
command: npm run check
- run:
name: Compile code
command: npm run compile
- restore_cache:
key: *test_fixtures_cache_key
- run:
Expand Down Expand Up @@ -80,6 +86,7 @@ jobs:
node4:
docker:
- image: node:4
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
Expand All @@ -88,6 +95,7 @@ jobs:
node6:
docker:
- image: node:6
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
Expand All @@ -96,6 +104,7 @@ jobs:
node8:
docker:
- image: node:8
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
Expand All @@ -104,6 +113,7 @@ jobs:
node9:
docker:
- image: node:9
environment: *test_env
- *mongo_service
- *redis_service
- *postgres_service
Expand Down
12 changes: 8 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ environment:
- nodejs_version: "6"
- nodejs_version: "8"

cache:
- node_modules -> package-lock.json, package.json
- build\test\plugins\fixtures -> test\fixtures\plugin-fixtures.json

services:
- mongodb
- mysql
Expand All @@ -19,8 +23,6 @@ install:
- nuget install redis-64 -excludeversion
- redis-64\tools\redis-server.exe --service-install
- redis-64\tools\redis-server.exe --service-start
# install modules
- npm install
- SET GCLOUD_PROJECT=0
- SET GCLOUD_TRACE_NEW_CONTEXT=1

Expand All @@ -34,16 +36,18 @@ before_test:

# Post-install test scripts.
test_script:
# install modules
- npm install
# check code style and linting
- npm run check
# compile the code
- npm run compile
# check that installing this module is OK
- npm run check-install
# initialize test fixtures
- npm run init-test-fixtures
# run tests
- npm run test
# check that installing this module is OK
- npm run check-install

# Don't actually build using MSBuild
build: off
206 changes: 187 additions & 19 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@types/tmp": "0.0.33",
"@types/uuid": "^3.4.3",
"changelog-maker": "^2.2.2",
"coveralls": "^3.0.0",
"codecov": "^3.0.0",
"express": "^4.15.2",
"glob": "^7.0.3",
"google-auto-auth": "^0.9.0",
Expand Down
12 changes: 4 additions & 8 deletions scripts/report-coverage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { BUILD_DIRECTORY, nodule, readFileP, forkP } from './utils';
import { BUILD_DIRECTORY, nodule, readFileP, forkP, spawnP } from './utils';
import * as path from 'path';
import * as pify from 'pify';

const coveralls: {
handleInput: (input: string, cb: (err: Error) => void) => void
} = require('coveralls');

const reportToCoverallsP = pify((input: string, cb: (err: Error) => void) => coveralls.handleInput(input, cb));

export async function reportCoverage() {
await forkP(nodule('istanbul/lib/cli'), [
'report',
Expand All @@ -16,5 +10,7 @@ export async function reportCoverage() {
cwd: BUILD_DIRECTORY
});
const lcov = await readFileP(`${BUILD_DIRECTORY}/coverage/lcov.info`, 'utf8');
await reportToCoverallsP(lcov);
await forkP(nodule('.bin/codecov'), [], {
cwd: BUILD_DIRECTORY
});
}
Loading

0 comments on commit d9b6ed9

Please sign in to comment.