Commit 9c85afad authored by José Henrique's avatar José Henrique
Browse files

Implement thumbnails generator

parent 5a48f365
......@@ -33,7 +33,7 @@ function approvePR() {
curl -s -X POST -d "{\"commit_id\": \"${COMMIT_HASH}\", \"event\": \"APPROVE\"}" -H "Authorization: token $GH_PERSONAL_TOKEN" "https://api.github.com/repos/PixelExperience/official_devices/pulls/$GIT_PR_NUMBER/reviews" > /dev/null
}
function CheckCommit() {
function checkCommit() {
if [[ "$COMMIT_MESSAGE" =~ "[PIXEL-CI]" ]]; then
if [[ -n "$GIT_PR_NUMBER" ]]; then
commentPR "Please remove \"[PIXEL-CI]\" from your commit message."
......@@ -45,7 +45,7 @@ function CheckCommit() {
fi
}
function Validator() {
function validator() {
python3 validator.py
RESULT=$?
if [ -n "$GIT_PR_NUMBER" ]; then
......@@ -61,14 +61,22 @@ function Validator() {
elif [ "$RESULT" -ne 0 ]; then
sendTG "Someone has merged a failing file. Please check console to find possible error.\n\n${ADMINS}"
else
pushToGit
pushToGit "[PIXEL-CI]: Lint files"
fi
}
function updateThumbs() {
if [ -z "$GIT_PR_NUMBER" ]; then
echo -e "Updating thumbnails..."
python3 update_thumbs.py
pushToGit "[PIXEL-CI]: Update thumbnails"
fi
}
function pushToGit() {
if [ -z "$GIT_PR_NUMBER" ] && [ -n "$(${GIT_CMD} status -s)" ]; then
${GIT_CMD} add --all
${GIT_CMD} commit -m "[PIXEL-CI]: Lint files"
${GIT_CMD} commit -m "$1"
${GIT_CMD} remote set-url origin "https://pixelexperiencebot:${GH_PERSONAL_TOKEN}@github.com/PixelExperience/official_devices.git"
${GIT_CMD} push origin master
RESULT=$?
......@@ -85,5 +93,6 @@ function pushToGit() {
fi
}
CheckCommit
Validator
checkCommit
validator
updateThumbs
import os
import glob
from PIL import Image
if __name__ == "__main__":
sizes = [300, 120]
for size in sizes:
dest = "images/.thumbs/" + str(size)
if not os.path.exists(dest):
os.makedirs(dest)
for image in glob.glob("images/*.png"):
im = Image.open(image)
im.thumbnail((size, size))
image_name = os.path.basename(image)
im.save(dest + "/" + image_name)
\ No newline at end of file
......@@ -232,8 +232,6 @@ def format_json():
def main():
print('Running Integrity tests for all the JSON\'s.')
test_devices = test_integrity_devices()
test_team = test_integrity_team()
if len(SUGGESTIONS) > 0:
print('Integrity test for one or more JSON\'s failed. Cannot proceed with JSON formatter.\n\n')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment