mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 00:12:53 +08:00
chore(): test plugin changes when PR is submitted (#1554)
* ci tests * update * update * update * update * update * update * update * update * update * update * update * update * update * update
This commit is contained in:
parent
5203d026d4
commit
e2acde5332
12
circle.yml
12
circle.yml
@ -7,12 +7,15 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: ionic-site
|
||||
key: ionic-site-{{ .Branch }}
|
||||
- run:
|
||||
name: Prepare ionic-site repo
|
||||
command: ./scripts/docs/prepare.sh
|
||||
command: |
|
||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||
./scripts/docs/prepare.sh
|
||||
fi
|
||||
- save_cache:
|
||||
key: ionic-site
|
||||
key: ionic-site-{{ .Branch }}
|
||||
paths:
|
||||
- ~/ionic-site/
|
||||
- restore_cache:
|
||||
@ -27,6 +30,9 @@ jobs:
|
||||
- run:
|
||||
name: Run tslint
|
||||
command: npm run lint
|
||||
- run:
|
||||
name: Build changed plugins
|
||||
command: node scripts/ci-tests.js
|
||||
- add_ssh_keys
|
||||
- deploy:
|
||||
name: Update docs
|
||||
|
@ -141,10 +141,17 @@ pluginsToBuild.forEach(addPluginToQueue);
|
||||
QUEUE.start((err) => {
|
||||
|
||||
if (err) {
|
||||
console.log('Error building plugins. ', err);
|
||||
console.log('Error building plugins.');
|
||||
console.log(err);
|
||||
process.stderr.write(err);
|
||||
process.exit(1);
|
||||
} else if (errors.length) {
|
||||
errors.forEach(e => console.log(e.message) && console.log('\n'));
|
||||
errors.forEach(e => {
|
||||
console.log(e.message) && console.log('\n');
|
||||
process.stderr.write(err);
|
||||
});
|
||||
console.log('Build complete with errors');
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('Done processing plugins!');
|
||||
}
|
||||
|
65
scripts/ci-tests.js
Normal file
65
scripts/ci-tests.js
Normal file
@ -0,0 +1,65 @@
|
||||
const exec = require('child-process-promise').exec;
|
||||
let diff;
|
||||
exec(`git branch | grep \\* | cut -d ' ' -f2`)
|
||||
.then(output => {
|
||||
if (output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
|
||||
const branch = output.stdout.trim();
|
||||
|
||||
if (branch !== 'master') {
|
||||
|
||||
console.log('Merging master branch in ...');
|
||||
// not on master branch
|
||||
// let's test the changes that were made
|
||||
return exec(`git merge origin master`);
|
||||
}
|
||||
})
|
||||
.then((output) => {
|
||||
if (output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
console.log('Checking for differences ...');
|
||||
return exec(`git diff --name-status origin master`)
|
||||
})
|
||||
.then((output) => {
|
||||
if (output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
|
||||
diff = output.stdout;
|
||||
diff = diff.replace(/A\s+/g, '');
|
||||
diff = diff.match(/src\/@ionic-native\/plugins\/([a-zA-Z0-9\-]+)\/index\.ts/g);
|
||||
|
||||
if (!diff) process.exit();
|
||||
|
||||
console.log(`${ diff.length } plugins were modified. We will now build them to verify they still work.`);
|
||||
|
||||
return exec('npm run build:core --silent');
|
||||
})
|
||||
.then((output) => {
|
||||
|
||||
if (output.stderr) {
|
||||
return Promise.reject(output.stderr);
|
||||
}
|
||||
|
||||
console.log('Built core library successfully ...');
|
||||
console.log('Building plugins ...');
|
||||
|
||||
diff = diff.map(text => text.replace('src/@ionic-native/plugins/', '').replace('/index.ts', ''));
|
||||
|
||||
return exec(`npm run build:modules ${diff.join(' ')} --silent`);
|
||||
})
|
||||
.then((output) => {
|
||||
if (output.stderr) {
|
||||
console.log(output.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(output.stdout);
|
||||
process.exit();
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e.message || e);
|
||||
process.exit(1);
|
||||
});
|
@ -1,6 +1,8 @@
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
|
||||
export interface AlipayOrder {
|
||||
/**
|
||||
* appId assigned by Alipay
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
export interface BarcodeScannerOptions {
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name Brightness
|
||||
* @description
|
||||
|
Loading…
Reference in New Issue
Block a user