Skip to content

Commit

Permalink
Reorganize ci jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Ansuel Smith <[email protected]>
  • Loading branch information
Ansuel committed Nov 14, 2020
1 parent 9b33c2f commit c99ffb6
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 93 deletions.
68 changes: 46 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,61 @@ jobs:
- run:
name: Check built type from last git log
command: bash ./scripts/0-detect-build-type.sh
- run:
name: Copy file to be modified (css,js,po)
command: bash ./scripts/0-copy-file-to-parse.sh
- persist_to_workspace:
root: ~/gui_build
paths:
paths:
- decompressed
- data
- scripts
- inizialize_gui.sh
minify_css_js:
working_directory: ~/gui_build
working_directory: ~/gui_build/data
docker:
- image: mysocialobservations/docker-tdewolff-minify
- image: thekevjames/minify
steps:
- attach_workspace:
at: ~/gui_build
- run:
name: Minify css and javascript
command: bash ./scripts/1-compress_css_javascript.sh
command: ~/gui_build/scripts/1-compress_css_javascript.sh
- persist_to_workspace:
root: ~/gui_build
paths:
- decompressed
update_file:
working_directory: ~/gui_build
- data/css_files
- data/js_files
update_po:
working_directory: ~/gui_build/data/po_files
docker:
- image: ansuel/gui-autobuild-image:4
steps:
- attach_workspace:
at: ~/gui_build
- run:
name: Update po
command: python3 ~/gui_build/scripts/update_po.py
- persist_to_workspace:
root: ~/gui_build
paths:
- data/po_files
minify_lua:
working_directory: ~/gui_build/data
docker:
- image: ansuel/gui-autobuild-image:4
steps:
- attach_workspace:
at: ~/gui_build
- run:
name: Minify css and javascript
command: bash ./scripts/1-compress_css_javascript.sh
- run:
name: Update po
command: python3 ./scripts/update_po.py
- run:
name: Minify lua files
command: bash ./scripts/1-compress_lua_scripts.sh
command: bash ~/gui_build/scripts/1-compress_lua_scripts.sh
- persist_to_workspace:
root: ~/gui_build
paths:
- decompressed
- data/lua_files
- data/lp_files
- data/map_files
increment_version:
working_directory: ~/gui_build
docker:
Expand All @@ -66,15 +80,17 @@ jobs:
- persist_to_workspace:
root: ~/gui_build
paths:
- decompressed
- data
- data/version
init_and_update:
working_directory: ~/gui_build
docker:
- image: ansuel/gui-autobuild-image:4
steps:
- attach_workspace:
at: ~/gui_build
- run:
name: Apply modified files
command: ./scripts/2-apply-new-file.sh
- run:
name: Set new version in rootdevice
command: bash ./scripts/2-set_new_version.sh
Expand All @@ -101,6 +117,9 @@ jobs:
- checkout
- attach_workspace:
at: ~/gui_build
- run:
name: Apply modified files
command: ./scripts/2-apply-new-file.sh
- run:
name: Committing updated po to master
command: bash ./scripts/6-commit_po.sh
Expand All @@ -120,22 +139,27 @@ workflows:
build_and_deploy:
jobs:
- prepare
- minify_css_js:
- minify_lua:
requires:
- prepare
- update_file:
- minify_css_js:
requires:
- prepare
- increment_version:
requires:
- update_file
- prepare
- update_po:
requires:
- prepare
- commit_po_changes:
requires:
- update_file
- update_po
- init_and_update:
requires:
- prepare
- minify_lua
- minify_css_js
- increment_version
- update_po
- publish_github_release:
requires:
- init_and_update
10 changes: 10 additions & 0 deletions scripts/0-copy-file-to-parse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/sh

for type in css js lua lp map po; do
mkdir data/"$type"_files
echo Creating dir '$type'_files for files to be processed
for file in `find . -name "*.$type" -type f`; do
echo Copying $file
cp -a --parents "$file" data/"$type"_files
done
done
Empty file modified scripts/1-check_file_ending.sh
100644 → 100755
Empty file.
12 changes: 6 additions & 6 deletions scripts/1-compress_css_javascript.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
TYPE="$(cat $HOME/gui_build/data/type)"
# if [ $TYPE == "DEV" ]; then
# exit 0
# fi
TYPE="$(cat type)"
if [ $TYPE == "DEV" ]; then
exit 0
fi

minify --recursive --verbose --match=\.*.js$ --type=js --output decompressed/ decompressed/
minify --recursive --verbose --match=\.*.js$ --type=js --output js_files/ js_files/

minify --recursive --verbose --match=\.*.css$ --type=css --output decompressed/ decompressed/
minify --recursive --verbose --match=\.*.css$ --type=css --output css_files/ css_files/

echo "Finished"
8 changes: 4 additions & 4 deletions scripts/1-compress_lua_scripts.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TYPE="$(cat $HOME/gui_build/data/type)"
TYPE="$(cat type)"
if [ $TYPE == "DEV" ]; then
exit 0
fi
Expand All @@ -25,15 +25,15 @@ minify_lua() {
echo "File $1 minified for $compressed byte"
}

for file in `find . -name "*.lua" -type f`; do
for file in `find lua_files -name "*.lua" -type f`; do
minify_lua "$file" &
done

for file in `find . -name "*.lp" -type f`; do
for file in `find lp_files -name "*.lp" -type f`; do
minify_lua "$file" &
done

for file in `find . -name "*.map" -type f`; do
for file in `find map_files -name "*.map" -type f`; do
minify_lua "$file" &
done

Expand Down
2 changes: 1 addition & 1 deletion scripts/1-increment_autobuild_ver.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

last_log="$(cat $HOME/gui_build/data/last_log)"
last_log="$(cat last_log)"

if [ "$(echo "$last_log" | grep -o "\[[0-9]\+\.[0-9]\+\.[0-9]\+\]" | tr -d [ | tr -d ])" ]; then
ver="$(echo "$last_log" | grep -o "\[[0-9]\+\.[0-9]\+\.[0-9]\+\]" | tr -d [ | tr -d ])"
Expand Down
6 changes: 6 additions & 0 deletions scripts/2-apply-new-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/sh

for type in css js lua lp map po; do
cp -a data/"$type"_files/* .
echo Applying files in "$type"_files
done
Empty file modified scripts/2-set_new_version.sh
100644 → 100755
Empty file.
Empty file modified scripts/7-push-release.sh
100644 → 100755
Empty file.
Loading

0 comments on commit c99ffb6

Please sign in to comment.