77  yarn : true 
88  directories :
99    - node_modules 
10+     - examples/full/node_modules 
11+     - examples/full-airbnb/node_modules 
12+     - examples/minimal/node_modules 
1013
1114node_js :
1215- " 8" 
1316
1417env :
15-   - VUE_TEMPLATE_TEST=minimal 
16-   - VUE_TEMPLATE_TEST=full 
17-   - VUE_TEMPLATE_TEST=full-airbnb 
18+   - VUE_TEMPLATES="minimal full full-airbnb" 
1819
1920before_install :
2021  - git remote set-branches --add origin master 
2122  - git fetch 
2223  #  Yarn
23-   - curl -o- -L https://yarnpkg.com/install.sh | bash 
24-   - export PATH="$HOME/.yarn/bin:$PATH" 
25-   - yarn global add vue-cli 
24+   - npm i -g yarn vue-cli 
2625  #  Utils
2726  - | 
28-     # Stolen from https://github.com/symfony/symfony/blob/master/.travis.yml, thanks guys  
27+     # Setup Symfony bash utils  
2928    stty cols 120 
3029
3130    nanoseconds() { 
@@ -43,7 +42,7 @@ before_install:
4342
4443    # tfold is a helper to create folded reports 
4544    tfold () { 
46-         local title=$1  
45+         local title="\\e[1;33m[$VUE_TEMPLATE]\\e[0m $1"  
4746        local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g') 
4847        shift 
4948        local id=$(printf %08x $(( RANDOM * RANDOM ))) 
@@ -62,63 +61,62 @@ before_install:
6261    } 
6362    export -f tfold 
6463
65- install :
6664| 
65+     # Setup jsdoc-vuejs bash utils 
6766    classical_workflow () { 
6867      set -e 
68+       export VUE_TEMPLATE=$1 
6969
7070      cd tests 
71-       vue init .. extension-${VUE_TEMPLATE_TEST} 
72- 
73-       cd extension-${VUE_TEMPLATE_TEST} 
71+       tfold "Creating extension..." vue init .. extension-${VUE_TEMPLATE} && cd extension-${VUE_TEMPLATE} 
7472      tfold "Installing extension dependencies..." yarn 
7573      tfold "Building extension..." yarn build 
7674      tfold "Testing version behavior" ../test_version.sh 
77-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping options.\\e[0m"    ||  tfold "Testing options..." ../test_options.sh   || exit $?  
78-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping  axios.\\e[0m "      || tfold "Testing axios..." .. /test_axios.sh       || exit $?  
79-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping vue-router.\\e[0m" ||  tfold "Testing vue-router..." ../test_router.sh || exit $?  
80-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping  vuex.\\e[0m "       || tfold "Testing vuex..." .. /test_store.sh        || exit $?  
81-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping linting.\\e[0m"    ||  tfold "Linting..." yarn lint --fix               || exit $?  
82-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping prettying.\\e[0m"  ||  tfold "Prettying..." yarn prettier:write         || exit $?  
75+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then  tfold "Testing options..."     ../test_options.sh; fi  
76+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then tfold "Testing  axios... "      .. /test_axios.sh; fi  
77+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then  tfold "Testing vue-router..." ../test_router.sh; fi  
78+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then tfold "Testing  vuex... "       .. /test_store.sh; fi  
79+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then  tfold "Linting..."             yarn lint --fix; fi  
80+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then  tfold "Prettying..."           yarn prettier:write; fi  
8381    } 
82+     export -f classical_workflow 
8483
85- | 
8684    dependabot_workflow () { 
8785      set -e 
86+       export VUE_TEMPLATE=$1 
8887
8988      MODIFIED_FILES=$(git --no-pager diff --name-only origin/master) 
9089
91-       SKIP_MINIMAL_BUILD=$([[ ! "${MODIFIED_FILES}" = *"examples/minimal/"* && "${VUE_TEMPLATE_TEST}" = minimal ]] && echo 'true' || echo 'false') 
92-       SKIP_FULL_BUILD=$([[ ! "${MODIFIED_FILES}" = *"examples/full-airbnb/"* && "${VUE_TEMPLATE_TEST}" = full-airbnb ]] && echo 'true' || echo 'false') 
93-       SKIP_FULL_AIRBNB_BUILD=$([[ ! "${MODIFIED_FILES}" = *"examples/full/"* && "${VUE_TEMPLATE_TEST}" = full ]] && echo 'true' || echo 'false') 
94- 
95-       echo -e "\\e[1;34mSkip minimal build? \\e[1;33m${SKIP_MINIMAL_BUILD}.\\e[0m" 
96-       echo -e "\\e[1;34mSkip full build? \\e[1;33m${SKIP_FULL_BUILD}.\\e[0m" 
97-       echo -e "\\e[1;34mSkip full-airbnb build? \\e[1;33m${SKIP_FULL_AIRBNB_BUILD}.\\e[0m" 
90+       SKIP_MINIMAL_BUILD=[[ ! "${MODIFIED_FILES}" = *"examples/minimal/"* && $VUE_TEMPLATE = minimal ]] 
91+       SKIP_FULL_BUILD=[[ ! "${MODIFIED_FILES}" = *"examples/full-airbnb/"* && $VUE_TEMPLATE = full-airbnb ]] 
92+       SKIP_FULL_AIRBNB_BUILD=[[ ! "${MODIFIED_FILES}" = *"examples/full/"* && $VUE_TEMPLATE = full ]] 
9893
99-       if [[ $SKIP_MINIMAL_BUILD = 'true'  || $SKIP_FULL_BUILD = 'true'  || $SKIP_FULL_AIRBNB_BUILD = 'true'  ]]; then 
94+       if [[ $SKIP_MINIMAL_BUILD || $SKIP_FULL_BUILD || $SKIP_FULL_AIRBNB_BUILD ]]; then 
10095        echo -e "\\e[1;34mThen skip building.\\e[0m" 
10196        exit 0 
10297      fi 
10398
104-       cd examples/${VUE_TEMPLATE_TEST } 
99+       cd examples/${VUE_TEMPLATE } 
105100      tfold "Installing extension dependencies..." yarn 
106-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping linting.\\e[0m"   ||  tfold "Linting..." yarn lint --fix       || exit $?  
107-       [[ !  "${VUE_TEMPLATE_TEST }" =~ ^full ]] && echo -e "\\e[1;34mSkipping prettying.\\e[0m" ||  tfold "Prettying..." yarn prettier:write || exit $?  
101+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then  tfold "Linting..."    yarn lint --fix; fi  
102+       if  [[ "${VUE_TEMPLATE }" =~ ^full ]]; then  tfold "Prettying..." yarn prettier:write; fi  
108103      tfold "Building extension..." yarn build 
109104    } 
105+     export -f dependabot_workflow 
110106
111- | 
112107    run_tests () { 
108+       export VUE_TEMPLATE=$1 
109+ 
113110      if [[ "${TRAVIS_BRANCH}" =~ ^dependabot ]]; then 
114111        echo -e "\\e[1;34mDependabot PR detected.\\e[0m" 
115-         dependabot_workflow 
112+         dependabot_workflow $VUE_TEMPLATE  
116113        exit $? 
117114      else 
118-         classical_workflow 
115+         classical_workflow $VUE_TEMPLATE  
119116        exit $? 
120117      fi 
121118    } 
119+     export -f run_tests 
122120
123121script :
124-   - (run_tests)  
122+   - for VUE_TEMPLATE in $VUE_TEMPLATES; do  (run_tests $VUE_TEMPLATE); done; 
0 commit comments