diff --git a/.kokoro/continuous/node6/common.cfg b/.kokoro/continuous/node6/common.cfg deleted file mode 100644 index 1fb877888..000000000 --- a/.kokoro/continuous/node6/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "release-please/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:6-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/release-please/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node6/test.cfg b/.kokoro/continuous/node6/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/.kokoro/lint.sh b/.kokoro/lint.sh index 7c2ea2a28..bcb750836 100755 --- a/.kokoro/lint.sh +++ b/.kokoro/lint.sh @@ -23,9 +23,11 @@ cd $(dirname $0)/.. npm install # Install and link samples -cd samples/ -npm link ../ -npm install -cd .. +if [ -f samples/package.json ]; then + cd samples/ + npm link ../ + npm install + cd .. +fi npm run lint diff --git a/.kokoro/presubmit/node6/common.cfg b/.kokoro/presubmit/node6/common.cfg deleted file mode 100644 index 1fb877888..000000000 --- a/.kokoro/presubmit/node6/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "release-please/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:6-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/release-please/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node6/test.cfg b/.kokoro/presubmit/node6/test.cfg deleted file mode 100644 index e69de29bb..000000000 diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 5a81ec01f..f83f712a8 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -31,12 +31,14 @@ if [ -f .kokoro/pre-samples-test.sh ]; then set -x fi -npm install +if [ -f samples/package.json ]; then + npm install -# Install and link samples -cd samples/ -npm link ../ -npm install -cd .. + # Install and link samples + cd samples/ + npm link ../ + npm install + cd .. -npm run samples-test + npm run samples-test +fi diff --git a/.kokoro/test.sh b/.kokoro/test.sh index 4d6c3f831..f7e9fe781 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -22,6 +22,14 @@ cd $(dirname $0)/.. npm install npm test -./node_modules/nyc/bin/nyc.js report -bash $KOKORO_GFILE_DIR/codecov.sh +COVERAGE_NODE=10 +if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then + NYC_BIN=./node_modules/nyc/bin/nyc.js + if [ -f "$NYC_BIN" ]; then + $NYC_BIN report + fi + bash $KOKORO_GFILE_DIR/codecov.sh +else + echo "coverage is only reported for Node $COVERAGE_NODE" +fi diff --git a/package-lock.json b/package-lock.json index 5d848c340..5dd1f3997 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,9 +43,9 @@ } }, "@bcoe/v8-coverage": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.1.0.tgz", - "integrity": "sha512-UdVB1rSL7H8TS8674fH02p5lRbhfIqQ18YKLxLKEnHFztHUH6bhMqjebMxgSTmWVrs5raS5JSLJIKKHFT4WfPg==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.1.tgz", + "integrity": "sha512-KioOCsSvSvXx6xUNLiJz+P+VMb7NRcePjoefOr74Y5P6lEKsiOn35eZyZzgpK4XCNJdXTDR7+zykj0lwxRvZ2g==", "dev": true }, "@octokit/endpoint": { @@ -278,22 +278,22 @@ "dev": true }, "c8": { - "version": "4.0.0-candidate.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-4.0.0-candidate.0.tgz", - "integrity": "sha512-DIvacDQ16fjiKCvt/xqm7Lr+0/Bi6PE8p4icE3osE/XbT/2KQMVjr+a0xDEsTY7WLZjZ39Kmth+t0XO9e6D1xA==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/c8/-/c8-4.1.4.tgz", + "integrity": "sha512-wY8duXV+6vxQ0PmqASEhyneBSWUINro5qSqeecsGyj66eLGe43HtMyZOlRf69/jd5xhB9GMoUtO9pDcMkLfOXA==", "dev": true, "requires": { - "@bcoe/v8-coverage": "^0.1.0", + "@bcoe/v8-coverage": "^0.2.1", "find-up": "^3.0.0", "foreground-child": "^1.5.6", "furi": "^1.3.0", "istanbul-lib-coverage": "^2.0.1", "istanbul-lib-report": "^2.0.1", "istanbul-reports": "^2.0.0", + "mkdirp": "^0.5.1", "rimraf": "^2.6.2", "test-exclude": "^5.0.0", - "uuid": "^3.3.2", - "v8-to-istanbul": "^3.0.0", + "v8-to-istanbul": "^3.1.1", "yargs": "^13.1.0", "yargs-parser": "^10.1.0" }, @@ -1481,20 +1481,20 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, "istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-LXTBICkMARVgo579kWDm8SqfB6nvSDKNqIOBEjmJRnL04JvoMHCYGWaMddQnseJYtkEuEvO/sIcOxPLk9gERug==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", "dev": true }, "istanbul-lib-report": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.7.tgz", - "integrity": "sha512-wLH6beJBFbRBLiTlMOBxmb85cnVM1Vyl36N48e4e/aTKSM3WbOx7zbVIH1SQ537fhhsPbX0/C5JB4qsmyRXXyA==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", "dev": true, "requires": { - "istanbul-lib-coverage": "^2.0.4", + "istanbul-lib-coverage": "^2.0.5", "make-dir": "^2.1.0", - "supports-color": "^6.0.0" + "supports-color": "^6.1.0" }, "dependencies": { "make-dir": { @@ -1525,12 +1525,12 @@ } }, "istanbul-reports": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.3.tgz", - "integrity": "sha512-T6EbPuc8Cb620LWAYyZ4D8SSn06dY9i1+IgUX2lTH8gbwflMc9Obd33zHTyNX653ybjpamAHS9toKS3E6cGhTw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.4.tgz", + "integrity": "sha512-QCHGyZEK0bfi9GR215QSm+NJwFKEShbtc7tfbUdLAEzn3kKhLDDZqvljn8rPZM9v8CEOhzL1nlYoO4r1ryl67w==", "dev": true, "requires": { - "handlebars": "^4.1.0" + "handlebars": "^4.1.2" } }, "js-yaml": { @@ -2804,9 +2804,9 @@ } }, "test-exclude": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.2.tgz", - "integrity": "sha512-N2pvaLpT8guUpb5Fe1GJlmvmzH3x+DAKmmyEQmFP792QcLYoGE1syxztSvPD1V8yPe6VrcCt6YGQVjSRjCASsA==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", "dev": true, "requires": { "glob": "^7.1.3", @@ -2997,16 +2997,10 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true - }, "v8-to-istanbul": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-3.0.0.tgz", - "integrity": "sha512-+RQCRyyizDF4Fu7rkHB8TSBvWtf2543fCh1jWg5plgBZ4tn+EwTDdN7p3zC+Go6hhaiTVl0jMxPj67bSzOdHwg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-3.1.2.tgz", + "integrity": "sha512-2ae2rql4/nCb+E9sRoXmoiDyJAeFhPZ6t5ZQpb/Kls/vff3dD0wjWEUadkunLT0AkflMxQAB1deiiysL7DeN/w==", "dev": true, "requires": { "convert-source-map": "^1.6.0" diff --git a/package.json b/package.json index 396082ffa..04a5a5193 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "bin": "./build/src/bin/release-please.js", "scripts": { "test": "cross-env ENVIRONMENT=test c8 --reporter=html --reporter=text mocha --recursive --timeout=5000 build/test", + "docs-test": "echo add docs tests", "system-test": "cross-env ENVIRONMENT=test mocha --timeout=20000 build/system-test", + "presystem-test": "npm run compile", "test:all": "cross-env ENVIRONMENT=test c8 --reporter=html --reporter=text mocha --recursive --timeout=20000 build/system-test build/test", "test:snap": "SNAPSHOT_UPDATE=1 npm test", "clean": "gts clean", @@ -36,7 +38,7 @@ "@types/mocha": "^5.2.6", "@types/node": "^11.13.6", "@types/semver": "^6.0.0", - "c8": "^4.0.0-candidate.0", + "c8": "^4.1.4", "chai": "^4.2.0", "cross-env": "^5.2.0", "gts": "^0.9.0", diff --git a/synth.metadata b/synth.metadata index 60ff0b7a9..d93d46e3c 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2019-05-01T11:24:51.301043Z", + "updateTime": "2019-05-03T20:45:16.861987Z", "sources": [ { "template": { diff --git a/system-test/github.ts b/system-test/github.ts index abb598fd8..61b924575 100644 --- a/system-test/github.ts +++ b/system-test/github.ts @@ -70,11 +70,7 @@ describe('GitHub', () => { return res; }); }); - latestTag.should.eql({ - name: 'v0.5.0', - version: '0.5.0', - sha: 'c16bcdee9fbac799c8ffb28d7447487a7f94b929' - }); + latestTag.sha.should.match(/[a-z0-9]{40}/); }); }); @@ -96,10 +92,7 @@ describe('GitHub', () => { return res; }); }); - commitsSinceSha[0].should.include( - 'chore(deps): update dependency @types/nock to v10'); - commitsSinceSha[commitsSinceSha.length - 1].should.include( - 'define regexp only once in circleci config'); + commitsSinceSha.length.should.be.gt(2); }); }); @@ -121,67 +114,5 @@ describe('GitHub', () => { }); }); }); - - describe('user has write permissions', () => { - it('creates branch with updated content, if file in updates array exists', - async () => { - const version = '7.0.0'; - const branch = `release-${version}`; - const gh = new GitHub({ - token: process.env.GH_TOKEN, - owner: 'bcoe', - repo: 'examples-conventional-commits' - }); - const cl = new FakeFileUpdater({ - path: 'CHANGELOG.md', - version, - changelogEntry: 'fixed all the things', - packageName: '@google-cloud/foo' - }); - const ref = await nockBack('open-pr-update-file.json') - .then(async (nbr: NockBackResponse) => { - await gh.openPR({ - branch, - sha: '42f90e2646c49a79bb2c98b658021d468ad5e814', - version, - updates: [cl] - }); - const ref = await gh.refByBranchName(branch); - nbr.nockDone(); - return ref; - }); - ref.should.equal('refs/heads/release-7.0.0'); - }); - - it('creates branch with updated content, if file in updates does not exist', - async () => { - const version = '8.0.0'; - const branch = `release-${version}`; - const gh = new GitHub({ - token: process.env.GH_TOKEN, - owner: 'bcoe', - repo: 'examples-conventional-commits' - }); - const cl = new FakeFileUpdater({ - path: 'CHANGELOG-FOO.md', - version, - changelogEntry: 'fixed all the things', - packageName: '@google-cloud/foo' - }); - const ref = await nockBack('open-pr-create-file.json') - .then(async (nbr: NockBackResponse) => { - await gh.openPR({ - branch, - sha: '42f90e2646c49a79bb2c98b658021d468ad5e814', - version, - updates: [cl] - }); - const ref = await gh.refByBranchName(branch); - nbr.nockDone(); - return ref; - }); - ref.should.equal('refs/heads/release-8.0.0'); - }); - }); }); }); diff --git a/test/updaters/changelog.ts b/test/updaters/changelog.ts index 9229b0956..30128ecde 100644 --- a/test/updaters/changelog.ts +++ b/test/updaters/changelog.ts @@ -28,7 +28,8 @@ describe('ChangelogUpdater', () => { it('inserts content at appropriate location if CHANGELOG exists', async () => { const oldContent = - readFileSync(resolve(fixturesPath, './CHANGELOG.md'), 'utf8'); + readFileSync(resolve(fixturesPath, './CHANGELOG.md'), 'utf8') + .replace(/\r\n/g, '\n'); const changelog = new Changelog({ path: 'CHANGELOG.md', changelogEntry: '## 2.0.0\n\n* added a new foo to bar.',