1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-11 03:39:59 +00:00

Check formatting in CI

This commit is contained in:
cadmic 2024-01-28 19:05:46 -08:00
parent 795f7e5251
commit 7ecf07b093
2 changed files with 32 additions and 0 deletions

9
Jenkinsfile vendored
View file

@ -4,6 +4,12 @@ pipeline {
}
stages {
stage('Check formatting') {
steps {
echo 'Checking formatting...'
sh 'bash -c "tools/check_format.sh 2>&1 >(tee tools/check_format.txt)"'
}
}
stage('Setup') {
steps {
sh 'cp /usr/local/etc/roms/baserom_oot.z64 baseroms/gc-eu-mq-dbg/baserom.z64'
@ -56,6 +62,9 @@ pipeline {
}
}
post {
failure {
sh 'cat tools/check_format.txt'
}
always {
echo "Finished, deleting directory."
deleteDir()

23
tools/check_format.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
STATUSOLD=`git status --porcelain`
./format.py -j
if [ $? -ne 0 ]
then
echo "Formatter failed. Exiting."
exit -1
fi
STATUSNEW=`git status --porcelain`
if [ "${STATUSOLD}" != "${STATUSNEW}" ];
then
echo ""
echo "Misformatted files found. Run ./format.py and verify codegen is not impacted."
echo ""
diff --unified=0 --label "Old git status" <(echo "${STATUSOLD}") --label "New git status" <(echo "${STATUSNEW}")
echo ""
echo "Exiting."
exit 1
fi
exit 0