Răsfoiți Sursa

Travis CI: Added Shellcheck test and setup parallel jobs

* Added Shellcheck as a Travis CI test allowing monitoring of code standards
* Setup new parallel jobs allowing all tests to run at the same time. Halving the testing time
Daniel Gibbs 8 ani în urmă
părinte
comite
c3ee79e10b
4 a modificat fișierele cu 47 adăugiri și 10 ștergeri
  1. 9 4
      .travis.yml
  2. 4 3
      tests/tests_jc2server.sh
  3. 30 0
      tests/tests_shellcheck.sh
  4. 4 3
      tests/tests_ts3server.sh

+ 9 - 4
.travis.yml

@@ -30,8 +30,13 @@ addons:
     - libstdc++6:i386
     - net-tools
     - iproute2
+    - shellcheck
 
-script:
-
-    - bash tests/tests_jc2server.sh
-    - bash tests/tests_ts3server.sh
+jobs:
+  include:
+    - stage: jobs
+      script: bash tests/tests_jc2server.sh
+    - # stage name not required
+      script: bash tests/tests_ts3server.sh
+    - # stage name not required
+      script: bash tests/tests_shellcheck.sh

+ 4 - 3
tests/tests_jc2server.sh

@@ -2,7 +2,7 @@
 # Project: Game Server Managers - LinuxGSM
 # Author: Daniel Gibbs
 # License: MIT License, Copyright (c) 2017 Daniel Gibbs
-# Purpose: TravisCI Tests: Just Cause 2 | Linux Game Server Management Script
+# Purpose: Travis CI Tests: Just Cause 2 | Linux Game Server Management Script
 # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
 # Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
 # Website: https://gameservermanagers.com
@@ -460,10 +460,11 @@ fn_test_result_fail(){
 }
 
 echo "================================="
-echo "TravisCI Tests"
+echo "Travis CI Tests"
 echo "Linux Game Server Manager"
 echo "by Daniel Gibbs"
-echo "https://gameservermanagers.com"
+echo "Contributors: http://goo.gl/qLmitD"
+echo "https://linuxgsm.com"
 echo "================================="
 echo ""
 echo "================================="

+ 30 - 0
tests/tests_shellcheck.sh

@@ -0,0 +1,30 @@
+#!/bin/bash
+# Project: Game Server Managers - LinuxGSM
+# Author: Daniel Gibbs
+# License: MIT License, Copyright (c) 2017 Daniel Gibbs
+# Purpose: Travis CI Tests: Shellcheck | Linux Game Server Management Script
+# Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
+# Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
+# Website: https://gameservermanagers.com
+
+echo "================================="
+echo "Travis CI Tests"
+echo "Linux Game Server Manager"
+echo "by Daniel Gibbs"
+echo "Contributors: http://goo.gl/qLmitD"
+echo "https://linuxgsm.com"
+echo "================================="
+echo ""
+echo "================================="
+echo "Bash Analysis Tests"
+echo "Using: Shellcheck"
+echo "Testing Branch: $TRAVIS_BRANCH"
+echo "================================="
+echo ""
+find . -type f -name "*.sh" -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \;
+find . -type f -name "*.cfg" -not -path "./shunit2-2.1.6/*" -exec shellcheck --shell=bash --exclude=SC2154,SC2034 {} \;
+echo ""
+echo "================================="
+echo "Bash Analysis Tests - Complete!"
+echo "Using: Shellcheck"
+echo "================================="

+ 4 - 3
tests/tests_ts3server.sh

@@ -2,7 +2,7 @@
 # Project: Game Server Managers - LinuxGSM
 # Author: Daniel Gibbs
 # License: MIT License, Copyright (c) 2017 Daniel Gibbs
-# Purpose: TravisCI Tests: Teamspeak 3 | Linux Game Server Management Script
+# Purpose: Travis CI Tests: Teamspeak 3 | Linux Game Server Management Script
 # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
 # Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
 # Website: https://gameservermanagers.com
@@ -460,10 +460,11 @@ fn_test_result_fail(){
 }
 
 echo "================================="
-echo "TravisCI Tests"
+echo "Travis CI Tests"
 echo "Linux Game Server Manager"
 echo "by Daniel Gibbs"
-echo "https://gameservermanagers.com"
+echo "Contributors: http://goo.gl/qLmitD"
+echo "https://linuxgsm.com"
 echo "================================="
 echo ""
 echo "================================="