From 4798aeba0e86c7eb839537b4c3397e6bbfb236ae Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Thu, 9 Jul 2020 21:10:20 +0200 Subject: [PATCH] adapt to drone --- .drone.yml | 15 +++++++++++++++ Jenkinsfile | 23 ----------------------- asset_drone.js | 25 +++++++++++++++++++++++++ asset_jenkins.js | 35 ----------------------------------- asset_jenkinsfile.js | 33 --------------------------------- jenkins.run.js => ci.js | 4 ---- index.js | 5 ++--- jenkins.js | 29 ----------------------------- package.json | 7 +++---- 9 files changed, 45 insertions(+), 131 deletions(-) create mode 100644 .drone.yml delete mode 100644 Jenkinsfile create mode 100644 asset_drone.js delete mode 100644 asset_jenkins.js delete mode 100644 asset_jenkinsfile.js rename jenkins.run.js => ci.js (94%) delete mode 100644 jenkins.js diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..6aa8e45 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,15 @@ +kind: pipeline +name: default + +steps: + - name: setup + image: node:lts-alpine + commands: + - apk add --no-cache curl + - yarn + - curl https://git.scode.ovh/Timo/standard/raw/branch/master/ci.js + + - name: build + image: node:lts-alpine + commands: + - node ci.js diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 7e1015c..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,23 +0,0 @@ -pipeline { - agent any - - environment { - VERSION = VersionNumber([ - versionNumberString: - '${BUILDS_ALL_TIME}', - versionPrefix: '1.1.', - worstResultForIncrement: 'SUCCESS' - ]) - } - - stages { - stage('Building') { - steps { - script { - currentBuild.displayName = env.VERSION - } - sh 'yarn ci ${VERSION}' - } - } - } -} diff --git a/asset_drone.js b/asset_drone.js new file mode 100644 index 0000000..5b5bcb5 --- /dev/null +++ b/asset_drone.js @@ -0,0 +1,25 @@ +/* + * Copyright (C) Sapphirecode - All Rights Reserved + * This file is part of standard which is released under MIT. + * See file 'LICENSE' for full license details. + * Created by Timo Hocker , May 2020 + */ + +'use strict'; + +module.exports = `kind: pipeline +name: default + +steps: + - name: setup + image: node:lts-alpine + commands: + - apk add --no-cache curl + - yarn + - curl https://git.scode.ovh/Timo/standard/raw/branch/master/ci.js + + - name: build + image: node:lts-alpine + commands: + - node ci.js +`; diff --git a/asset_jenkins.js b/asset_jenkins.js deleted file mode 100644 index 7738951..0000000 --- a/asset_jenkins.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Sapphirecode - All Rights Reserved - * This file is part of standard which is released under MIT. - * See file 'LICENSE' for full license details. - * Created by Timo Hocker , May 2020 - */ - -'use strict'; - -module.exports = `'use strict'; - -const https = require ('https'); -const fs = require ('fs'); -const { execSync: exec_sync } = require ('child_process'); - -const run_file = fs.createWriteStream ('.jenkins.run.js'); - -const [ - ,, ...args -] = process.argv; - -run_file.on ('close', () => { - exec_sync ( - \`node .jenkins.run.js \${args.join (' ')}\`, - { stdio: 'inherit' } - ); -}); - -https.get ( - 'https://git.scode.ovh/Timo/standard/raw/branch/master/jenkins.run.js', - (msg) => { - msg.pipe (run_file); - } -); -`; diff --git a/asset_jenkinsfile.js b/asset_jenkinsfile.js deleted file mode 100644 index a6ca026..0000000 --- a/asset_jenkinsfile.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) Sapphirecode - All Rights Reserved - * This file is part of standard which is released under MIT. - * See file 'LICENSE' for full license details. - * Created by Timo Hocker , May 2020 - */ - -'use strict'; - -module.exports = `pipeline { - agent any - - environment { - VERSION = VersionNumber([ - versionNumberString: - '\${BUILDS_ALL_TIME}', - versionPrefix: '1.0.', - worstResultForIncrement: 'SUCCESS' - ]) - } - - stages { - stage('Building') { - steps { - script { - currentBuild.displayName = env.VERSION - } - sh 'yarn ci \${VERSION}' - } - } - } -} -`; diff --git a/jenkins.run.js b/ci.js similarity index 94% rename from jenkins.run.js rename to ci.js index 8ddd15d..e47f143 100644 --- a/jenkins.run.js +++ b/ci.js @@ -13,10 +13,6 @@ const fs = require ('fs'); const child_process = require ('child_process'); const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8')); -[ - ,, pkg.version -] = process.argv; -fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2)); child_process.execSync ('yarn lint', { stdio: 'inherit' }); child_process.execSync ('yarn test', { stdio: 'inherit' }); diff --git a/index.js b/index.js index cf2965b..d9cb331 100644 --- a/index.js +++ b/index.js @@ -7,10 +7,9 @@ 'use strict'; -const jenkins = require ('./asset_jenkins'); -const jenkinsfile = require ('./asset_jenkinsfile'); +const drone = require ('./asset_drone'); -const files = { jenkins, jenkinsfile }; +const files = { drone }; const scripts = { lint: 'eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs', diff --git a/jenkins.js b/jenkins.js deleted file mode 100644 index f95d506..0000000 --- a/jenkins.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) Sapphirecode - All Rights Reserved - * This file is part of standard which is released under MIT. - * See file 'LICENSE' for full license details. - * Created by Timo Hocker , May 2020 - */ - -'use strict'; - -const https = require ('https'); -const fs = require ('fs'); -const { execSync: exec_sync } = require ('child_process'); - -const run_file = fs.createWriteStream ('.jenkins.run.js'); - -const [ - ,, ...args -] = process.argv; - -run_file.on ('close', () => { - exec_sync (`node .jenkins.run.js ${args.join (' ')}`, { stdio: 'inherit' }); -}); - -https.get ( - 'https://git.scode.ovh/Timo/standard/raw/branch/master/jenkins.run.js', - (msg) => { - msg.pipe (run_file); - } -); diff --git a/package.json b/package.json index 46fe784..9d04706 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sapphirecode/standard", - "version": "1.0.0", + "version": "1.1.10", "main": "index.js", "author": "Timo Hocker ", "description": "standard files and scripts for sapphirecode modules", @@ -19,12 +19,11 @@ "scripts": { "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue,.mjs", "test": "echo \"no test\"", - "compile": "tsc --allowJs --declaration --emitDeclarationOnly index.js", - "ci": "yarn && node jenkins.js" + "compile": "tsc --allowJs --declaration --emitDeclarationOnly index.js" }, "files": [ "LICENSE", "*.js", "*.d.ts" ] -} \ No newline at end of file +}