Skip to content

Commit 3876fb2

Browse files
authored
Merge pull request #83 from nandiheath/master
Merge to master
2 parents 91fe268 + 1795eef commit 3876fb2

26 files changed

+5787
-398
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- stage: deploy
3838
script:
3939
- echo "VUE_APP_GA_TRACKING_ID=$GA_TRACKING_ID" >> .env
40+
# if this is build from tag, just update the tag name, otherise use the previous tag name
41+
- if [[ -z "$TRAVIS_TAG"]]; then echo "VUE_APP_REV_NAME=$(git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`)" >> .env
42+
- if [[ ! -z "$TRAVIS_TAG"]]; then echo "VUE_APP_REV_NAME=$TRAVIS_TAG" >> .env
4043
- npm run build
4144
- if [[ ! -z "$DOMAIN" ]]; then echo $DOMAIN >> dist/CNAME; fi
4245

accuracy_test/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ The main test program written in node.js.
1010
# Simply install the required packages
1111
npm install
1212
13+
# Transpile the javascript from ./../web to dist to run with nodejs
14+
npm run build
15+
1316
# And run the program
1417
node main.js
1518

accuracy_test/main.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const csv = require('fast-csv');
88
const fs = require('fs');
99
const { spawn } = require('child_process');
1010
const async = require('async');
11-
11+
const moment = require('moment');
1212

1313

1414
// default logger
@@ -114,13 +114,18 @@ async function runTest(program, file, address) {
114114
}
115115

116116

117-
async function main({ mode = 3, limit = Infinity, outputFile = './result.json' }) {
117+
async function main({ mode = 3, limit = Infinity, outputFile = './result.json', tag}) {
118118
return new Promise(async (resolve, reject) => {
119119
const allTestData = await readTestCases('./data/testcases_ogcio_searchable.csv');
120120
const result = {
121121
total: 0
122122
}
123123

124+
125+
result.date = moment().format('YYYY-MM-DD hh:mm:ss');
126+
if (typeof(tag) === 'string' && tag.length > 0) {
127+
result.tag = tag;
128+
}
124129
if (mode & 2) {
125130
result.py_success = 0;
126131
result.py_failed = [];
@@ -166,7 +171,8 @@ async function main({ mode = 3, limit = Infinity, outputFile = './result.json' }
166171
if (mode & 1) {
167172
result.js_success_rate = `${result.js_success / result.total}`;
168173
}
169-
fs.writeFileSync(outputFile, JSON.stringify(result, null, 4));
174+
175+
fs.appendFileSync(outputFile, JSON.stringify(result) + '\n');
170176
log(result);
171177
resolve();
172178
})
@@ -196,14 +202,17 @@ program
196202
program
197203
.description('Run the test cases')
198204
.option('-o, --output [file]', 'Output the test result to the file')
199-
.option('-c, --ci [file]', 'Running in CI mode, will append the percentage to the file')
200205
.option('-l, --limit [n]', 'Limit the number of test cases to run')
201206
.option('-p, --python', 'Running only the python test')
202207
.option('-j, --js', 'Running only the javascript test')
208+
.option('-t, --tag [tag]', 'Save the tag with the result')
203209
.parse(process.argv);
204210

205211

206212
const outputFile = program.output || './results.json';
213+
const ciOutputFile = program.ci || null;
214+
const tag = program.tag;
215+
207216
// bitwise flag: | python | node |
208217
const mode = !program.python | !program.js << 1;
209218
const limit = program.limit || Infinity;
@@ -214,7 +223,7 @@ if (mode === 0) {
214223
end();
215224
}
216225

217-
main({ mode, limit, outputFile })
226+
main({ mode, limit, outputFile, ciOutputFile, tag })
218227
.then((end) => {
219228
log('Done');
220229
})

0 commit comments

Comments
 (0)