Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edited build stage #26

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a21dad3
added jenkinsfile
albanngwa Oct 25, 2024
026d435
added build stage
albanngwa Oct 26, 2024
acffd2b
Update Jenkinsfile
albanngwa Oct 26, 2024
640fbff
added test stage
albanngwa Oct 26, 2024
725bb09
edited test syntax
albanngwa Oct 26, 2024
b899c3b
added agent to test stage
albanngwa Oct 26, 2024
ca82833
added junit
albanngwa Oct 26, 2024
5e6a169
added e2e stage
albanngwa Oct 26, 2024
82bd327
added commands
albanngwa Oct 26, 2024
d73c29d
commented out build stage
albanngwa Oct 26, 2024
111f14d
added
albanngwa Oct 26, 2024
834cc01
added parallel stage
albanngwa Oct 26, 2024
8dde660
added j unit
albanngwa Oct 27, 2024
ebb5289
added e2e stage
albanngwa Oct 27, 2024
f19da5e
added correct dir
albanngwa Oct 27, 2024
fbfc1b5
added html
albanngwa Oct 27, 2024
973e85e
added html script
albanngwa Oct 27, 2024
7cc28ad
parrallel stage
albanngwa Oct 27, 2024
1ae61fb
added deploy stage
albanngwa Oct 27, 2024
7a5972a
added env variables
albanngwa Oct 27, 2024
94f525c
edited env
albanngwa Oct 27, 2024
ba82436
added credentials
albanngwa Oct 27, 2024
8222c94
add
albanngwa Oct 27, 2024
fe188a5
added a small change
albanngwa Oct 28, 2024
eeca826
ad
albanngwa Oct 28, 2024
3ae8f21
added a staging stafe
albanngwa Oct 28, 2024
f0c1df2
added files
albanngwa Oct 28, 2024
0866336
edited
albanngwa Oct 28, 2024
bd04438
imolemented site id
albanngwa Oct 30, 2024
04625bb
added a token credential
albanngwa Oct 30, 2024
4efcd89
corrected error
albanngwa Oct 30, 2024
1037696
Corrected wrong spelling
albanngwa Oct 30, 2024
290b4c0
and again
albanngwa Oct 30, 2024
5ab68f0
should work now
albanngwa Oct 30, 2024
79fbefa
added post deployment tests
albanngwa Oct 30, 2024
22c68db
w
albanngwa Oct 30, 2024
e9cb745
added a staging environment
albanngwa Oct 30, 2024
229417d
added
albanngwa Oct 30, 2024
d6375f2
added site url
albanngwa Oct 30, 2024
c7f6194
d
albanngwa Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM mcr.microsoft.com/playwright:v1.39.0-jammy
RUN npm install -g netlify-cli node-jq
139 changes: 139 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
pipeline {
agent any

environment {
NETLIFY_SITE_ID = '05de4f57-37e6-4e25-84e9-9bb725f0d052'
NETLIFY_AUTH_TOKEN = credentials('netlify-token')
}
stages {

stage('Build') {
agent {
docker {
image 'node:18-alpine'
reuseNode true
}
}
steps {
sh '''
ls -la
node --version
npm --version
npm ci
npm run build
ls -la
'''
}
}

stage('Tests') {
parallel {
stage('Unit tests') {
agent {
docker {
image 'node:18-alpine'
reuseNode true
}
}

steps {
sh '''
#test -f build/index.html
npm test
'''
}
post {
always {
junit 'jest-results/junit.xml'
}
}
}

stage('E2E') {
agent {
docker {
image 'mcr.microsoft.com/playwright:v1.39.0-jammy'
reuseNode true
}
}

steps {
sh '''
npm install serve
node_modules/.bin/serve -s build &
sleep 10
npx playwright test --reporter=html
'''
}

post {
always {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'playwright-report', reportFiles: 'index.html', reportName: 'Playwright Local', reportTitles: '', useWrapperFileDirectly: true])
}
}
}
}
}

stage('Deploy staging') {
agent {
docker {
image 'node:18-alpine'
reuseNode true
}
}
steps {
sh '''
npm install netlify-cli
node_modules/.bin/netlify --version
echo "Deploying to staging. Site ID: $NETLIFY_SITE_ID"
node_modules/.bin/netlify status
node_modules/.bin/netlify deploy --dir=build
'''
}
}

stage('Deploy prod') {
agent {
docker {
image 'node:18-alpine'
reuseNode true
}
}
steps {
sh '''
npm install netlify-cli
node_modules/.bin/netlify --version
echo "Deploying to production. Site ID: $NETLIFY_SITE_ID"
node_modules/.bin/netlify status
node_modules/.bin/netlify deploy --dir=build --prod
'''
}
}

stage('Prod E2E') {
agent {
docker {
image 'mcr.microsoft.com/playwright:v1.39.0-jammy'
reuseNode true
}
}

environment {
CI_ENVIRONMENT_URL = 'https://app.netlify.com/sites/lambent-duckanoo-ebcb72/overview'
}

steps {
sh '''
npx playwright test --reporter=html
'''
}

post {
always {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'playwright-report', reportFiles: 'index.html', reportName: 'Playwright E2E', reportTitles: '', useWrapperFileDirectly: true])
}
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"jest-junit": {
"suiteName": "jest tests",
"outputDirectory": "test-results",
"outputDirectory": "jest-results",
"outputName": "junit.xml",
"uniqueOutputName": "false",
"classNameTemplate": "{classname}-{title}",
Expand Down