summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-03-05 16:44:17 +0200
committerAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-03-13 14:02:53 +0200
commit5581de8d282136a4f04ab06f7f0a40c01e71183b (patch)
tree6353711dc0f244b32ea6a1d590aad9d0524ffa08
parent4dff30c5bb2bade5e957e43597124c6937efd297 (diff)
downloadqtlocation-mapboxgl-upstream/anderco-doc-coverage.tar.gz
[build] Upload documentation coverage metrics to S3upstream/anderco-doc-coverage
-rw-r--r--ci.template5
-rwxr-xr-xscripts/publish_doxygen_coverage.js28
2 files changed, 31 insertions, 2 deletions
diff --git a/ci.template b/ci.template
index abf123c56a..5a94771a71 100644
--- a/ci.template
+++ b/ci.template
@@ -158,7 +158,10 @@
"s3:GetObjectAcl"
],
"Effect": "Allow",
- "Resource": ["arn:aws:s3:::mapbox-loading-dock/raw/mobile.binarysize/*"]
+ "Resource": [
+ "arn:aws:s3:::mapbox-loading-dock/raw/mobile.binarysize/*",
+ "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.docs_coverage/*"
+ ]
}
]
}
diff --git a/scripts/publish_doxygen_coverage.js b/scripts/publish_doxygen_coverage.js
index e3e564a3e1..723115d36d 100755
--- a/scripts/publish_doxygen_coverage.js
+++ b/scripts/publish_doxygen_coverage.js
@@ -2,6 +2,8 @@
const jwt = require('jsonwebtoken');
const github = require('@octokit/rest')();
+const zlib = require('zlib');
+const AWS = require('aws-sdk');
const fs = require('fs');
const SIZE_CHECK_APP_ID = 14028;
@@ -46,8 +48,9 @@ github.apps.createInstallationToken({installation_id: SIZE_CHECK_APP_INSTALLATIO
github.authenticate({type: 'token', token: data.token});
const percentage = coverage.documented * 100 / coverage.total;
const title = `${percentage.toFixed(2)}%`;
+ const date = new Date().toISOString().substring(0, 19);
- return github.checks.create({
+ var promises = [github.checks.create({
owner: 'mapbox',
repo: 'mapbox-gl-native',
name: 'Doxygen coverage',
@@ -60,5 +63,28 @@ github.apps.createInstallationToken({installation_id: SIZE_CHECK_APP_INSTALLATIO
title,
summary: `There is doxygen documentation for ${percentage}% of the public symbols (${coverage.documented} out of ${coverage.total})`
}
+ })];
+
+ if (process.env['CIRCLE_BRANCH'] === 'master') {
+ promises.push(new AWS.S3({region: 'us-east-1'}).putObject({
+ Body: zlib.gzipSync(JSON.stringify({
+ 'created_at': date,
+ 'documented': coverage.documented,
+ 'total': coverage.total,
+ 'commit': process.env['CIRCLE_SHA1']
+ })),
+ Bucket: 'mapbox-loading-dock',
+ Key: `raw/mobile_staging.docs_coverage/${date.substring(0,10)}/${process.env['CIRCLE_SHA1']}.json.gz`,
+ CacheControl: 'max-age=300',
+ ContentEncoding: 'gzip',
+ ContentType: 'application/json'
+ }).promise());
+ }
+
+ return Promise.all(promises).then(data => {
+ return console.log('Succesfully uploaded doxygen coverage metrics');
+ }).catch(err => {
+ console.log('Error uploading doxygen coverage metrics: ' + err.message);
+ return err;
});
});