-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
93 lines (91 loc) · 2.96 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!groovy
@Library('kanolib') _
def utils;
pipeline {
agent {
label 'ubuntu_18.04_with_docker'
}
environment {
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = 'true'
}
stages {
stage('checkout') {
steps {
checkout scm
script {
utils = load 'jenkins/utils.groovy'
}
}
}
stage('install dependencies') {
steps {
script {
docker.image('node:8-alpine').inside('-u root') {
sh "apk update && apk upgrade && apk add --no-cache bash git openssh"
sh "mkdir -p ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts"
sshagent(['read-only-github']) {
sh "yarn"
sh "yarn build"
}
}
}
}
}
stage('test') {
steps {
script {
// Use puppeteer enabled docker image
docker.image('kanocomputing/puppeteer').inside('--cap-add=SYS_ADMIN') {
// Run the Unit test
sh "yarn ci:test"
sh "yarn ci:coverage"
}
}
}
}
stage('docs') {
steps {
script {
if (env.BRANCH_NAME != "master") {
return;
}
def version = get_npm_package_version();
docker.image('node:8-alpine').inside {
sh "yarn docs"
}
docker.image('ughly/alpine-aws-cli').inside {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'kart', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
// Clean previous docs
sh "aws s3 rm s3://code-docs.kano.me/${version} --recursive"
// Upload files
sh "aws s3 cp ./www-docs/ s3://code-docs.kano.me/${version} --recursive"
}
}
}
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: 'test-results.xml'
cobertura coberturaReportFile: 'coverage/cobertura-coverage.xml'
script {
github.updatePRWithCoverageData file: 'coverage/coverage-summary.md'
}
}
regression {
script {
email.notifyCulprits()
}
}
fixed {
script {
email.notifyCulprits()
}
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '20'))
timeout(time: 60, unit: 'MINUTES')
}
}