diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-01-10 16:04:06 -0800 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-01-24 08:35:31 -0800 |
commit | 7ffde741b70ddb14fc92b42379c143c02224b504 (patch) | |
tree | 02d65bdc2ac8d37ba8f37d7e99fd1437dd525290 | |
parent | ecfb77c637b4b572114a61fe4f6887edd34b474b (diff) | |
download | qtlocation-mapboxgl-7ffde741b70ddb14fc92b42379c143c02224b504.tar.gz |
[build] Add build that verifies the submodule pin is up-to-date
-rw-r--r-- | circle.yml | 26 | ||||
-rw-r--r-- | scripts/nitpick/index.js | 28 | ||||
-rwxr-xr-x | scripts/nitpick/submodule-pin.js | 13 |
3 files changed, 67 insertions, 0 deletions
diff --git a/circle.yml b/circle.yml index f963e3e6d4..46ff9f7c6e 100644 --- a/circle.yml +++ b/circle.yml @@ -4,6 +4,7 @@ workflows: version: 2 default: jobs: + - nitpick - clang-tidy: filters: branches: @@ -217,6 +218,31 @@ step-library: destination: render-tests jobs: + nitpick: + docker: + - image: mbgl/7d2403f42e:base + working_directory: /src + environment: + LIBSYSCONFCPUS: 4 + JOBS: 4 + BUILDTYPE: Debug + steps: + - checkout + - *generate-cache-key + - *restore-cache + - run: + name: Initialize submodule + command: git submodule update --init mapbox-gl-js + - run: + name: npm install + command: npm install --ignore-scripts + - *save-cache + - run: + name: Verify submodule pin + command: scripts/nitpick/submodule-pin.js + when: always + + # ------------------------------------------------------------------------------ clang-tidy: docker: diff --git a/scripts/nitpick/index.js b/scripts/nitpick/index.js new file mode 100644 index 0000000000..31316e7521 --- /dev/null +++ b/scripts/nitpick/index.js @@ -0,0 +1,28 @@ +var failed = false; + +process.on('exit', function() { + if (failed) { + process.exitCode = 1; + } +}); + +module.exports = function(status, str, desc) { + if (status) { + console.warn(`\x1b[1m\x1b[32m✔︎ ${str}\x1b[0m`); + } else { + console.warn(`\x1b[1m\x1b[31m✘ ${str}\x1b[0m`); + failed = true; + } + + if (desc) { + console.warn(`${desc.split('\n').map((line) => '| ' + line).join('\n')}\n`); + } +}; + +module.exports.ok = function(str, desc) { + module.exports(true, str, desc); +}; + +module.exports.fail = function(str, desc) { + module.exports(false, str, desc); +}; diff --git a/scripts/nitpick/submodule-pin.js b/scripts/nitpick/submodule-pin.js new file mode 100755 index 0000000000..7ca129e096 --- /dev/null +++ b/scripts/nitpick/submodule-pin.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node +const nitpick = require('.'); +const child_process = require('child_process'); + +// Make sure that the mapbox-gl-js submodule pin is up to date +const head = child_process.execSync('git -C mapbox-gl-js rev-parse HEAD').toString().trim(); +const revs = child_process.execSync(`git -C mapbox-gl-js branch -a --contains ${head}`).toString().split('\n'); + +if (revs.indexOf(' remotes/origin/master') >= 0) { + nitpick.ok(`mapbox-gl-js submodule pin is merged to master`); +} else { + nitpick.fail(`mapbox-gl-js submodule is pinned to ${head}, which isn't merged to master`); +} |