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:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: ionic-site
|
key: ionic-site-{{ .Branch }}
|
||||||
- run:
|
- run:
|
||||||
name: Prepare ionic-site repo
|
name: Prepare ionic-site repo
|
||||||
command: ./scripts/docs/prepare.sh
|
command: |
|
||||||
|
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||||
|
./scripts/docs/prepare.sh
|
||||||
|
fi
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: ionic-site
|
key: ionic-site-{{ .Branch }}
|
||||||
paths:
|
paths:
|
||||||
- ~/ionic-site/
|
- ~/ionic-site/
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
@ -27,6 +30,9 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: Run tslint
|
name: Run tslint
|
||||||
command: npm run lint
|
command: npm run lint
|
||||||
|
- run:
|
||||||
|
name: Build changed plugins
|
||||||
|
command: node scripts/ci-tests.js
|
||||||
- add_ssh_keys
|
- add_ssh_keys
|
||||||
- deploy:
|
- deploy:
|
||||||
name: Update docs
|
name: Update docs
|
||||||
|
@ -141,10 +141,17 @@ pluginsToBuild.forEach(addPluginToQueue);
|
|||||||
QUEUE.start((err) => {
|
QUEUE.start((err) => {
|
||||||
|
|
||||||
if (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) {
|
} 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');
|
console.log('Build complete with errors');
|
||||||
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
console.log('Done processing plugins!');
|
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 { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface AlipayOrder {
|
export interface AlipayOrder {
|
||||||
/**
|
/**
|
||||||
* appId assigned by Alipay
|
* appId assigned by Alipay
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
|
||||||
export interface BarcodeScannerOptions {
|
export interface BarcodeScannerOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Brightness
|
* @name Brightness
|
||||||
* @description
|
* @description
|
||||||
|
Loading…
Reference in New Issue
Block a user