update Jenkinsfile, clean up unused stuff

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-11-19 19:21:13 +01:00
parent d803879628
commit 013727d125
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
8 changed files with 391 additions and 17017 deletions

64
Jenkinsfile vendored
View File

@ -11,73 +11,55 @@ pipeline {
}
environment {
GIT_USER = 'status-im-auto'
GIT_MAIL = 'auto@status.im'
SCP_OPTS = 'StrictHostKeyChecking=no'
DEV_HOST = 'jenkins@node-01.do-ams3.proxy.misc.statusim.net'
DEV_SITE = 'dev.thestatus.network'
GH_USER = 'status-im-auto'
GH_MAIL = 'auto@status.im'
}
stages {
stage('Git Prep') {
steps {
sh "git config user.name ${GIT_USER}"
sh "git config user.email ${GIT_MAIL}"
/* necessary to have access to the theme partials */
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'git submodule update --init --recursive'
}
sh "git config user.name ${env.GH_USER}"
sh "git config user.email ${env.GH_MAIL}"
}
}
stage('Install Deps') {
steps {
sh 'yarn install'
}
}
stage('Index') {
steps {
withCredentials([usernamePassword(
credentialsId: 'search.status.im-auth',
usernameVariable: 'HEXO_ES_USER',
passwordVariable: 'HEXO_ES_PASS'
)]) {
sh 'yarn run index'
}
sh 'yarn install --ignore-optional'
}
}
stage('Build') {
steps {
sh 'yarn run clean'
sh 'yarn run build'
}
}
stage('Robot') {
when { expression { !GIT_BRANCH.endsWith('master') } }
steps { script {
sh 'echo "Disallow: /" >> public/robots.txt'
} }
}
stage('Publish Prod') {
when { expression { GIT_BRANCH.endsWith('master') } }
steps { script {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'npm run deploy'
when { expression { env.GIT_BRANCH ==~ /.*master/ } }
steps {
withCredentials([string(
credentialsId: 'jenkins-github-token',
variable: 'GH_TOKEN',
)]) {
sh 'yarn run deploy'
}
}
} }
}
stage('Publish Devel') {
when { expression { !GIT_BRANCH.endsWith('master') } }
steps { script {
when { expression { env.GIT_BRANCH ==~ /.*develop/ } }
steps {
sshagent(credentials: ['jenkins-ssh']) {
sh '''
rsync -e 'ssh -o StrictHostKeyChecking=no' -r --delete public/. \
jenkins@node-01.do-ams3.proxy.misc.statusim.net:/var/www/dev/
'''
sh """
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete public/. \
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/
"""
}
}
} }
}
}
}

View File

@ -35,27 +35,5 @@ disqus_shortname: hexojs
twitter: ethstatus
github: status-im
graphviz:
enable: true
mermaid:
enable: true
version: "7.1.2"
options: # find more api options from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js
elasticsearch:
index: 'dev.status.im'
esHost: 'search.status.im'
esPort: 443
math:
engine: 'mathjax' # or 'katex'
mathjax:
# src: custom_mathjax_source
# config: MathJax config
katex:
# css: custom_css_source
# config: KaTeX config
marked:
breaks: false

View File

@ -38,25 +38,3 @@ deploy:
disqus_shortname: hexojs
twitter: ethstatus
github: status-im
graphviz:
enable: true
mermaid:
enable: true
version: "7.1.2"
options: # find more api options from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js
elasticsearch:
index: 'status.im'
esHost: 'search.status.im'
esPort: 443
math:
engine: 'mathjax' # or 'katex'
mathjax:
# src: custom_mathjax_source
# config: MathJax config
katex:
# css: custom_css_source
# config: KaTeX config

View File

@ -1,67 +1,14 @@
const gulp = require('gulp')
const log = require('fancy-log')
const source = require('vinyl-source-stream')
const babelify = require('babelify')
const watchify = require('watchify')
const exorcist = require('exorcist')
const browserify = require('browserify')
const browserSync = require('browser-sync').create()
const sass = require('gulp-sass')
const imagemin = require('gulp-imagemin')
const Hexo = require('hexo');
const runSequence = require('run-sequence');
const minify = require('gulp-minify');
const cleanCSS = require('gulp-clean-css');
const rename = require("gulp-rename");
var config = {
paths: {
src: {
scss: './themes/navy/source/scss/*.scss',
js: [
'./themes/navy/source/js/main.js',
],
},
dist: {
css: './public/css',
// js: './public/js'
}
}
}
// // Watchify args contains necessary cache options to achieve fast incremental bundles.
// // See watchify readme for details. Adding debug true for source-map generation.
// watchify.args.debug = true
// // Input file.
// var bundler = watchify(browserify(config.paths.src.js, watchify.args))
// // Babel transform
// bundler.transform(
// babelify.configure({
// sourceMapRelative: './themes/navy/source/js/'
// })
// )
// const bundle = () => {
// log('Compiling JS...')
// return bundler
// .bundle()
// .on('error', (err) => {
// log(err.message)
// browserSync.notify('Browserify Error!')
// this.emit('end')
// })
// .pipe(exorcist('./themes/navy/source/js/main.js.map'))
// .pipe(source('main.js'))
// .pipe(gulp.dest('./themes/navy/source/js'))
// .pipe(browserSync.stream({ once: true }))
// }
// // On updates recompile
// bundler.on('update', bundle)
// helper functions
const gitBranch = require('./scripts/git-branch');
const getEnv = () => {
return gitBranch() == 'master' ? 'prod' : 'dev'
@ -88,11 +35,7 @@ gulp.task('generate', async (cb) => {
gulp.task('compress', ['sass'], () => {
gulp.src('./themes/navy/source/js/main.js')
.pipe(minify({
ext: {
min: '.min.js'
},
}))
.pipe(minify({ext:{min:'.min.js'}}))
.pipe(gulp.dest('./public/js/'))
gulp.src('./public/css/main.css')
@ -101,51 +44,24 @@ gulp.task('compress', ['sass'], () => {
.pipe(gulp.dest('./public/css/'));
});
gulp.task('nightlies', () => {
return updateBuilds('nightlies', 'latest.json')
})
gulp.task('releases', () => {
return updateBuilds('releases', 'release.json')
})
gulp.task('genqr', () => {
genqr('nightlies', 'APK', 'public/nightly/img', 'qr-apk.png')
genqr('nightlies', 'DIAWI', 'public/nightly/img', 'qr-ios.png')
genqr('releases', 'APK', 'public/stable/img', 'qr-apk.png')
genqr('releases', 'DIAWI', 'public/stable/img', 'qr-ios.png')
})
gulp.task('bundle', () => {
return bundle()
})
gulp.task('sass', () => {
return gulp.src("./themes/navy/source/scss/main.scss")
.pipe(sass())
.on('error', log)
.pipe(gulp.dest(config.paths.dist.css))
.on('error', log.error)
.pipe(gulp.dest('./public/css'))
.pipe(browserSync.stream())
})
gulp.task('index', async () => {
await hexo('elasticsearch', {'delete': true})
})
gulp.task('watch', async () => {
gulp.watch(config.paths.src.scss, ['compress'])
gulp.watch('./themes/navy/source/scss/*.scss', ['compress'])
});
gulp.task('build', (cb) => {
runSequence('generate', 'compress', 'bundle', 'watch')
});
gulp.task('exit', (cb) => {
process.exit(0);
runSequence('generate', 'compress', 'watch')
});
gulp.task('run', (cb) => {
runSequence('generate', 'compress', 'genqr', 'bundle', 'exit')
runSequence('generate', 'compress')
});
gulp.task('default', [])

13032
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,66 +10,28 @@
"build": "gulp run",
"index": "gulp index",
"eslint": "eslint .",
"deploy": "hexo deploy",
"update-submodules": "git submodule update --init --recursive"
"deploy": "hexo deploy"
},
"dependencies": {
"cheerio": "^0.20.0",
"d3": "^5.1.0",
"d3-ease": "^1.0.2",
"d3-interpolate": "^1.1.2",
"d3-scale": "^1.0.4",
"es6-promise": "^4.2.8",
"devDependencies": {
"browser-sync": "^2.26.7",
"eslint": "^4.3.0",
"eslint-config-hexo": "^2.0.0",
"fancy-log": "^1.3.2",
"gulp": "^3.9.1",
"gulp-clean-css": "^3.10.0",
"gulp-minify": "^3.1.0",
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.1",
"hexo": "^3.9.0",
"hexo-deployer-git": "^0.3.1",
"hexo-elasticsearch": "https://github.com/status-im/hexo-elasticsearch.git#0.2.0",
"hexo-filter-mermaid-diagrams": "^1.0.5",
"hexo-generator-archive": "^0.1.4",
"hexo-generator-feed": "^1.1.0",
"hexo-generator-i18n": "0.0.7",
"hexo-generator-sitemap": "^1.1.2",
"hexo-graphviz": "^1.0.0",
"hexo-inject": "^1.0.0",
"hexo-math": "^3.0.4",
"hexo-renderer-ejs": "^0.3.1",
"hexo-renderer-jade": "^0.4.1",
"hexo-renderer-marked": "^0.2.10",
"hexo-renderer-stylus": "^0.3.1",
"hexo-server": "^0.2.0",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.13",
"lodash.assign": "^4.2.0",
"lodash.clone": "^4.0.1",
"lodash.foreach": "^4.0.0",
"lodash.isempty": "^4.0.0",
"lodash.isequal": "^4.0.0",
"lunr": "^2.1.2",
"moment": "^2.24.0",
"request": "^2.88.0",
"request-promise": "^4.2.4"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babelify": "^8.0.0",
"browser-sync": "^2.26.7",
"browserify": "^16.2.0",
"del": "^3.0.0",
"eslint": "^4.3.0",
"eslint-config-hexo": "^2.0.0",
"exorcist": "^1.0.1",
"fancy-log": "^1.3.2",
"gulp-clean-css": "^3.10.0",
"gulp-imagemin": "^4.1.0",
"gulp-minify": "^3.1.0",
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.1",
"js-yaml": "^3.13.1",
"qrcode": "^1.3.2",
"rename": "^1.0.4",
"request": "^2.88.0",
"run-sequence": "^2.2.1",
"vinyl-source-stream": "^2.0.0",
"watchify": "^3.11.0"
"run-sequence": "^2.2.1"
}
}

23
scripts/git-branch.js Normal file
View File

@ -0,0 +1,23 @@
'use strict'
const fs = require('fs')
const path = require('path')
const util = require('util')
function parseBranch(buf) {
const match = /ref: refs\/heads\/([^\n]+)/.exec(buf.toString())
return match ? match[1] : null
}
function gitHeadPath(cwd) {
const filepath = path.join(process.cwd(), '.git/HEAD')
if (!fs.existsSync(filepath)) {
throw new Error('.git/HEAD does not exist')
}
return filepath
}
const gitBranch = function() {
return parseBranch(fs.readFileSync(gitHeadPath()))
}
module.exports = gitBranch

4085
yarn.lock

File diff suppressed because it is too large Load Diff