forked from jenkins-infra/stories
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
82 lines (76 loc) · 1.82 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
pipeline {
environment {
NODE_ENV = "development"
HOME = "/tmp"
TZ = "UTC"
NETLIFY = "true"
}
agent {
label 'docker&&linux'
}
options {
timeout(time: 60, unit: 'MINUTES')
ansiColor('xterm')
disableConcurrentBuilds(abortPrevious: true)
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '5', numToKeepStr: '5')
}
stages {
stage('Check for typos') {
steps {
sh '''
curl -qsL https://github.com/crate-ci/typos/releases/download/v1.5.0/typos-v1.5.0-x86_64-unknown-linux-musl.tar.gz | tar xvzf - ./typos
curl -qsL https://github.com/halkeye/typos-json-to-checkstyle/releases/download/v0.1.1/typos-checkstyle-v0.1.1-x86_64 > typos-checkstyle && chmod 0755 typos-checkstyle
./typos --format json | ./typos-checkstyle - > checkstyle.xml || true
'''
}
post {
always {
recordIssues(tools: [checkStyle(id: 'typos', name: 'Typos', pattern: 'checkstyle.xml')])
}
}
}
stage('Install Dependencies') {
agent {
docker {
image 'node:16.13.1'
reuseNode true
}
}
steps {
sh 'npm install'
}
}
stage('Build Production') {
agent {
docker {
image 'node:16.13.1'
reuseNode true
}
}
environment {
NODE_ENV = "production"
}
steps {
sh 'npm run build'
}
}
stage('Lint and Test') {
agent {
docker {
image 'node:16.13.1'
reuseNode true
}
}
steps {
sh '''
npx eslint --format checkstyle > eslint.json
'''
}
post {
always {
recordIssues(tools: [esLint(pattern: 'eslint.json')])
}
}
}
}
}