-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration test with image comparison #9
- Loading branch information
1 parent
135a506
commit 6d67de5
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Install pip') { | ||
steps { | ||
//sh 'wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | gpg --dearmor | sudo tee /usr/share/keyrings/jenkins-archive-keyring.gpg > /dev/null' | ||
sh 'sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5BA31D57EF5975CA' | ||
sh 'apt-get update && apt-get install -y python3-pip' | ||
} | ||
} | ||
stage('Install Requirements') { | ||
steps { | ||
sh 'pip3 install --upgrade pip' | ||
sh 'pip3 install -r requirements.txt' | ||
} | ||
} | ||
stage('version') { | ||
steps { | ||
sh 'python3 --version' | ||
} | ||
} | ||
|
||
stage('Install imagemagick') { | ||
steps { | ||
sh 'sudo apt-get install -y imagemagick' | ||
} | ||
} | ||
|
||
stage('Compare Images') { | ||
steps { | ||
sh 'ls -al ./images' | ||
script { | ||
def img1 = './images/hodographmap_ICON_Nest.png' | ||
def img2 = './images/example.png' | ||
def diffImg = './diff.png' | ||
|
||
// Compare images using ImageMagick | ||
def result = sh(script: "compare -metric AE ${img1} ${img2} ${diffImg} 2>&1", returnStatus: true) | ||
|
||
if (result != 0) { | ||
echo "Images are different. Check the diff image: ${diffImg}" | ||
//error("Image comparison failed") | ||
} else { | ||
echo "Images are identical" | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Run HodographMaps') { | ||
steps { | ||
sh 'export PYTHONPATH=$(pwd) && echo $PYTHONPATH' | ||
sh 'ls -al' | ||
sh './run_script.sh 12' | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
// Archive images and diff for review | ||
archiveArtifacts artifacts: './images/hodographmap_ICON_Nest.png, ./images/example.png, ./diff.png', allowEmptyArchive: true | ||
} | ||
} | ||
} |