Skip to content

Commit 3619898

Browse files
authored
Merge pull request #9 from codingtools/feature/circleci-fix
this fixes issue #7
2 parents 52445cb + b14ab1f commit 3619898

File tree

7 files changed

+156
-105
lines changed

7 files changed

+156
-105
lines changed

.circleci/config.yml

Lines changed: 27 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,40 @@
1-
---
21
version: 2
32
jobs:
4-
node-latest: &test
3+
build_and_test:
4+
working_directory: ~/mern-starter
5+
# The primary container is an instance of the first image listed. The job's commands run in this container.
56
docker:
6-
- image: node:latest
7-
working_directory: ~/cli
7+
- image: circleci/node:latest
8+
# The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost.
89
steps:
910
- checkout
10-
- restore_cache: &restore_cache
11-
keys:
12-
- v1-npm-{{checksum ".circleci/config.yml"}}-{{ checksum "package-lock.json"}}
13-
- v1-npm-{{checksum ".circleci/config.yml"}}
1411
- run:
15-
name: Install dependencies
16-
command: .circleci/greenkeeper
17-
- run: ./bin/run --version
18-
- run: ./bin/run --help
12+
name: Update npm
13+
command: 'sudo npm install -g npm@latest'
14+
- restore_cache:
15+
key: dependency-cache-{{ checksum "package-lock.json" }}
1916
- run:
20-
name: Testing
21-
command: npm test
22-
- run:
23-
name: Submitting code coverage to codecov
24-
command: |
25-
./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov
26-
curl -s https://codecov.io/bash | bash
27-
node-8:
28-
<<: *test
29-
docker:
30-
- image: node:8
31-
release:
32-
<<: *test
33-
steps:
34-
- add_ssh_keys
35-
- checkout
36-
- restore_cache: *restore_cache
37-
- run:
38-
name: Install dependencies
39-
command: |
40-
npm install -g @oclif/semantic-release@3 semantic-release@15
41-
npm install
42-
- run:
43-
name: Cutting release
44-
command: |
45-
semantic-release -e @oclif/semantic-release
17+
name: Install npm dependencies
18+
command: npm install
4619
- save_cache:
47-
key: v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "package-lock.json"}}
20+
key: dependency-cache-{{ checksum "package-lock.json" }}
4821
paths:
49-
- ~/cli/node_modules
50-
- ~/.npm
51-
- /usr/local/lib/node_modules
22+
- node_modules
23+
- run:
24+
name: Test
25+
command: npm test
26+
- run:
27+
name: Generate code coverage
28+
command: './node_modules/.bin/nyc report --reporter=text-lcov'
29+
- store_artifacts:
30+
path: test-results.xml
31+
prefix: tests
32+
- store_artifacts:
33+
path: coverage
34+
prefix: coverage
5235

5336
workflows:
5437
version: 2
55-
"cdt":
38+
build_and_test:
5639
jobs:
57-
- node-latest
58-
- node-8
59-
- release:
60-
context: org-global
61-
filters:
62-
branches: {only: master}
63-
requires:
64-
- node-latest
65-
- node-8
40+
- build_and_test

.circleci/config_2jobs.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: 2
2+
jobs:
3+
build:
4+
working_directory: ~/mern-starter
5+
# The primary container is an instance of the first image listed. The job's commands run in this container.
6+
docker:
7+
- image: circleci/node:latest
8+
# The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost.
9+
steps:
10+
- checkout
11+
- run:
12+
name: Update npm
13+
command: 'sudo npm install -g npm@latest'
14+
- restore_cache:
15+
key: dependency-cache-{{ checksum "package-lock.json" }}
16+
- run:
17+
name: Install npm dependencies
18+
command: npm install
19+
- save_cache:
20+
key: dependency-cache-{{ checksum "package-lock.json" }}
21+
paths:
22+
- node_modules
23+
test:
24+
docker:
25+
- image: circleci/node:latest
26+
steps:
27+
- checkout
28+
# needed to add here also as both install and test are different docker instances and need to do same thing again in different instance
29+
- run:
30+
name: Update npm
31+
command: 'sudo npm install -g npm@latest'
32+
- restore_cache:
33+
key: dependency-cache-{{ checksum "package-lock.json" }}
34+
- run:
35+
name: Install npm dependencies
36+
command: npm install
37+
- save_cache:
38+
key: dependency-cache-{{ checksum "package-lock.json" }}
39+
paths:
40+
- node_modules
41+
- run:
42+
name: Test
43+
command: npm test
44+
- run:
45+
name: Generate code coverage
46+
command: './node_modules/.bin/nyc report --reporter=text-lcov'
47+
- store_artifacts:
48+
path: test-results.xml
49+
prefix: tests
50+
- store_artifacts:
51+
path: coverage
52+
prefix: coverage
53+
54+
workflows:
55+
version: 2
56+
build_and_test:
57+
jobs:
58+
- build
59+
- test:
60+
requires:
61+
- build

.circleci/config_tmp.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: 2
2+
jobs:
3+
node-latest: &test
4+
docker:
5+
- image: node:latest
6+
working_directory: ~/cli
7+
steps:
8+
- checkout
9+
- restore_cache: &restore_cache
10+
keys:
11+
- v1-npm-{{checksum ".circleci/config_tmp.yml"}}-{{ checksum "package-lock.json"}}
12+
- v1-npm-{{checksum ".circleci/config_tmp.yml"}}
13+
- run:
14+
name: Install dependencies
15+
command: .circleci/greenkeeper
16+
- run: ./bin/run --version
17+
- run: ./bin/run --help
18+
- run:
19+
name: Testing
20+
command: npm test
21+
- run:
22+
name: Submitting code coverage to codecov
23+
command: |
24+
./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov
25+
curl -s https://codecov.io/bash | bash
26+
node-8:
27+
<<: *test
28+
docker:
29+
- image: node:8
30+
release:
31+
<<: *test
32+
steps:
33+
- add_ssh_keys
34+
- checkout
35+
- restore_cache: *restore_cache
36+
- run:
37+
name: Install dependencies
38+
command: |
39+
npm install -g @oclif/semantic-release@3 semantic-release@15
40+
npm install
41+
- run:
42+
name: Cutting release
43+
command: |
44+
semantic-release -e @oclif/semantic-release
45+
- save_cache:
46+
key: v1-npm-{{checksum ".circleci/config_tmp.yml"}}-{{checksum "package-lock.json"}}
47+
paths:
48+
- ~/cli/node_modules
49+
- ~/.npm
50+
- /usr/local/lib/node_modules
51+
52+
workflows:
53+
version: 2
54+
"cdt":
55+
jobs:
56+
- node-latest
57+
- node-8
58+
- release:
59+
context: org-global
60+
filters:
61+
branches: {only: master}
62+
requires:
63+
- node-latest
64+
- node-8

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"@oclif/config": "^1.13.3",
1313
"@oclif/plugin-help": "^2.2.1",
1414
"jshashes": "^1.0.7",
15-
"tslib": "^1.10.0"
15+
"tslib": "^1.10.0",
16+
"nyc": "^13.3.0"
1617
},
1718
"devDependencies": {
1819
"@oclif/dev-cli": "^1.22.2",
@@ -24,7 +25,6 @@
2425
"chai": "^4.2.0",
2526
"globby": "^10.0.1",
2627
"mocha": "^5.2.0",
27-
"nyc": "^13.3.0",
2828
"ts-node": "^8.4.1",
2929
"tslint": "^5.20.0",
3030
"typescript": "^3.6.4"
@@ -56,7 +56,7 @@
5656
"postpack": "rm -f oclif.manifest.json",
5757
"posttest": "tslint -p test -t stylish",
5858
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
59-
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
59+
"test": "./node_modules/.bin/nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
6060
"version": "oclif-dev readme && git add README.md"
6161
},
6262
"types": "lib/index.d.ts"

src/commands/hash.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default class Hash extends Command {
3333
} else
3434
str = args.string
3535

36-
this.log(str)
3736
this.calculateHash(type, str)
3837
}
3938

@@ -61,7 +60,7 @@ export default class Hash extends Command {
6160

6261
if (hash) {
6362
let hashed: string = hash.hex(str)
64-
this.log(`[HASH]: ${hashed}`)
63+
this.log(`[${type.toUpperCase()}]: ${hashed}`)
6564
} else {
6665
this.log('[ERROR]: invalid hash type')
6766
}

src/commands/hello.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

test/commands/hello.test.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)