-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
171 lines (147 loc) · 6.23 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// // Prevent blue ocean from triggering a build on every branch when importing the repository.
// // The following approach requires extra permissions to be configured on the project
// // in order to use.
// if (currentBuild.rawBuild.getCauses().toString().contains('BranchIndexingCause')) {
// print "INFO: Build skipped due to trigger being Branch Indexing"
// currentBuild.result = 'Skipping Index Build'
// return
// }
pipeline {
agent {
docker {
image 'buildkite/puppeteer:5.2.1'
// args '-p 3010:3010'
// following doesn't work and needs serious adjustments
// need to figure out a better caching strategy
// args '-v /srv/puppeteer/.npm:/.npm'
}
}
environment {
HOME = '.'
// AWS_S3_BUCKET = credentials('jenkins-aws-s3-bucket')
// AWS_ACCESS_KEY_ID = credentials('jenkins-aws-access-key-id')
// AWS_SECRET_ACCESS_KEY = credentials('jenkins-aws-secret-access-key')
// AWS_REGION = 'us-east-1'
}
// poll every 5 minutes with a hashing factor to prevent simultaneous execution
triggers { pollSCM('H/5 * * * *') }
stages {
// the following filter assists with preventing a Jenkins Blue Ocean project import from
// building all branches simultaneously on import.
stage('1-Execute build filter') {
steps {
script{
echo ' '
echo '*******************************************************************************'
echo '* STAGE 1: Build Filter to control branch execution *'
echo '*******************************************************************************'
echo ' '
}
script{
if (BUILD_NUMBER == '1') {
echo 'Fist Build...'
error('Stop')
} else {
echo "Skip to steps on branch = ${BRANCH_NAME}"
}
}
}
}
stage('2-Install dependencies and tools') {
steps {
// sh 'npm install yarn'
// sh './node_modules/.bin/yarn'
script{
echo ' '
echo '*******************************************************************************'
echo '* STAGE 2: Install all development dependencies and tools *'
echo '*******************************************************************************'
echo ' '
}
sh 'yarn'
sh 'npx lerna bootstrap'
}
}
stage('3-Build styles and UI Components') {
steps {
script{
echo ' '
echo '*******************************************************************************'
echo '* STAGE 3: Build the styles project and REACT components project *'
echo '*******************************************************************************'
echo ' '
}
sh 'NODE_ENV=production yarn --cwd=packages/styles build'
sh 'NODE_ENV=production yarn --cwd=packages/react build'
}
}
stage('4-Perform Unit Testing') {
steps {
script{
echo ' '
echo '***********************************************************************************************'
echo '* STAGE 4: Execute traditional and accessibility unit tests against UI component code library *'
echo '***********************************************************************************************'
echo ' '
}
sh 'yarn --cwd=packages/react test'
}
}
stage('5-Axe-core integration testing and reporting') {
steps {
sh 'yarn dev &'
script{
echo ' '
echo '***********************************************************************************************************'
echo '* STAGE 5: Perform accessibility testing on Demo site using Axe-core rules and generate HTML reports *'
echo '***********************************************************************************************************'
echo ' '
}
sh 'wait-for-it.sh --timeout=30 localhost:8000 && yarn test-pa11y-axe'
sh 'yarn generate-pa11y-axe-report'
sh 'yarn print-pa11y-axe-cli-results'
}
}
stage('6-HTMLCS integration testing and reporting') {
steps {
script{
echo ' '
echo '***********************************************************************************************************'
echo '* STAGE 6: Perform accessibility testing on Demo site using HTMLCS rules and generate HTML reports *'
echo '***********************************************************************************************************'
echo ' '
}
sh 'yarn dev &'
sh 'wait-for-it.sh --timeout=30 localhost:8000 && yarn test-pa11y-htmlcs'
sh 'yarn generate-pa11y-htmlcs-report'
sh 'yarn print-pa11y-htmlcs-cli-results'
}
}
stage('7-Prepare deployment to Staging') {
steps {
script{
echo ' '
echo '***********************************************************************************************************'
echo '* STAGE 7: Build and package entire site and reports in preparation for deployment to staging *'
echo '***********************************************************************************************************'
echo ' '
}
sh 'yarn build'
}
}
stage('8-Publish the site and reports to S3') {
steps {
script{
echo ' '
echo '***********************************************************************************************************'
echo '* STAGE 8: Push current code and reporting to AWS Staging (Amazon S3 Object) *'
echo '***********************************************************************************************************'
echo ' '
}
withAWS(credentials:'aws_kci', region: "us-east-1") {
s3Upload(file:'docs/dist', bucket:'s3.kci-01', acl:'PublicRead')
}
}
}
}
}