]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
no bug - skip tests if the only thing changed is the version
authorDylan William Hardison <dylan@hardison.net>
Wed, 28 Mar 2018 15:39:33 +0000 (11:39 -0400)
committerDylan William Hardison <dylan@hardison.net>
Wed, 28 Mar 2018 16:01:48 +0000 (12:01 -0400)
.circleci/config.yml

index 5de22d58702da6f867e32fbd6de854ff40166131..e30304b63e2eb0219784eb3f4969990318fd56e6 100644 (file)
@@ -61,6 +61,7 @@ defaults:
     run:
       name: default qa setup
       command: |
+        [[ -f build_info/only_version_changed.txt ]] && exit 0
         mv /opt/bmo/local /app/local
         perl -MSys::Hostname -i -pE 's/bmo.test/hostname() . ":$ENV{PORT}"/ges' $BZ_QA_CONF_FILE
         perl checksetup.pl --no-database --default-localconfig
@@ -93,6 +94,22 @@ jobs:
               echo "tag $tag does not exist"
               echo yes > build_info/publish.txt
             fi
+      - run:
+          name: check if only version changed
+          command: |
+            if git diff 'HEAD~..HEAD' --name-only | grep -qv '^Bugzilla.pm'; then
+              echo "more files than just Bugzilla.pm changed."
+              exit 0
+            fi
+            if git diff 'HEAD~..HEAD' |grep '^[+-][^+-]' | grep -qv '^[+-]our $VERSION'; then
+              echo "Something other than the version number changed."
+              exit 0
+            fi
+            if [[ "$CIRCLE_BRANCH" == "master" ]]; then
+              echo "Can't cut corners on the master branch"
+              exit 0
+            fi
+            echo yes > build_info/only_version_changed.txt
       - persist_to_workspace:
           root: /app/build_info
           paths: ["*.txt"]
@@ -145,13 +162,19 @@ jobs:
         environment: *bmo_env
     steps:
       - checkout
+      - attach_workspace:
+          at: /app/build_info
       - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
           mv /opt/bmo/local /app/local
           mkdir artifacts
-      - run: perl Makefile.PL
+      - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
+          perl Makefile.PL
       - run:
           name: run sanity tests
           command: |
+            [[ -f build_info/only_version_changed.txt ]] && exit 0
             /app/scripts/entrypoint.pl prove -qf $(circleci tests glob 't/*.t' | circleci tests split) | tee artifacts/$CIRCLE_JOB.txt
       - store_artifacts:
           path: /app/artifacts
@@ -162,12 +185,15 @@ jobs:
     docker: *docker_oldtests
     steps:
       - checkout
+      - attach_workspace:
+          at: /app/build_info
       - *default_qa_setup
       - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
           /app/scripts/entrypoint.pl load_test_data
-      - run:
-          command: |
-            /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt
+      - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
+          /app/scripts/entrypoint.pl test_webservices | tee artifacts/$CIRCLE_JOB.txt
       - store_artifacts:
           path: /app/artifacts
 
@@ -177,12 +203,15 @@ jobs:
     docker: *docker_oldtests
     steps:
       - checkout
+      - attach_workspace:
+          at: /app/build_info
       - *default_qa_setup
       - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
           /app/scripts/entrypoint.pl load_test_data --legacy
-      - run:
-          command: |
-            /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt
+      - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
+          /app/scripts/entrypoint.pl test_selenium | tee artifacts/$CIRCLE_JOB.txt
       - store_artifacts:
           path: /app/artifacts
 
@@ -203,12 +232,17 @@ jobs:
       - image: selenium/standalone-firefox:2.53.1
     steps:
       - checkout
+      - attach_workspace:
+          at: /app/build_info
       - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
           mv /opt/bmo/local /app/local
           perl checksetup.pl --no-database
           /app/scripts/entrypoint.pl load_test_data
           mkdir artifacts
-      - run: /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t
+      - run: |
+          [[ -f build_info/only_version_changed.txt ]] && exit 0
+          /app/scripts/entrypoint.pl test_bmo -q -f t/bmo/*.t
 
 workflows:
   version: 2