aboutsummaryrefslogtreecommitdiff
path: root/shippable.yml
blob: 7b25879402aaab86e939a95f32be9ea055e332fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
language: java


jdk:
  - oraclejdk8

env:
  matrix:
    - PROFILE="-Ppitest-checkstyle-xpath,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checkstyle-filters,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-javadoc,no-validations"
    - PROFILE="-Ppitest-checks-imports,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-metrics,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-regexp,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-sizes,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-whitespace,no-validations"; POST_ACTION=check_survived
    - PROFILE="-Ppitest-checks-misc,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-blocks,no-validations"; POST_ACTION=check_survived_blocks
    - PROFILE="-Ppitest-checks-coding,no-validations"; POST_ACTION=check_survived_coding
    - PROFILE="-Ppitest-checks-design,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-annotation,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-header,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-modifier,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-naming,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checks-indentation,no-validations"
    - PROFILE="-Ppitest-checkstyle-tree-walker,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checkstyle-common,no-validations"; POST_ACTION=check_survived
    - PROFILE="-Ppitest-checkstyle-main,no-validations"; POST_ACTION=check_survived_uncovered
    - PROFILE="-Ppitest-checkstyle-api,no-validations"; POST_ACTION=check_survived
    - PROFILE="-Ppitest-checkstyle-utils,no-validations"; POST_ACTION=check_survived
    - PROFILE="-Ppitest-checkstyle-gui,no-validations"

branches:
  only:
    - master

build:
  cache: true
  cache_dir_list:
    - /root/.m2

  ci:
    # we skip PRs and commits that are not for Issues, as pitest is too time consuming
    - |
      set -e
      SKIP_FILES="appveyor.yml|circle.yml|distelli-manifest.yml|.travis.yml|wercker.yml|wercker.sh|fast-forward-merge.sh|LICENSE|LICENSE.apache20|README.md|release.sh|RIGHTS.antlr|intellij-idea-inspections.xml|org.eclipse.jdt.core.prefs"
      SKIP_CI=$(if [[ $(git diff --name-only HEAD HEAD~1 | grep -vE "$SKIP_FILES" | cat | wc -c) > 0 ]]; then echo false; else echo true; fi;)
      echo "SKIP_CI="$SKIP_CI
      echo "POST_ACTION="$POST_ACTION
      if [[ $SKIP_CI == 'false' ]];
      then
        mvn -e $PROFILE clean verify org.pitest:pitest-maven:mutationCoverage;

        if [[ $POST_ACTION == 'check_survived_uncovered' \
                && ( $(grep -RE "class='survived'" target/ | cat | wc -l) > 0 \
                    || $(grep -RE "class='uncovered'" target/ | cat | wc -l) > 0) ]]; then
           echo "Survived items:"$(grep -RE "class='survived'" target/ | cat)
           echo "Uncovered items:"$(grep -RE "class='uncovered'" target/ | cat)
           echo "Survived/Uncovered items found in reports, build will be failed"
           exit 1
        fi
        if [[ $POST_ACTION == 'check_survived' && $(grep -RE "class='survived'" target/ | cat | wc -l) > 0 ]]; then
           echo "Survived items:"$(grep -RE "class='survived'" target/ | cat)
           echo "Survived items found in reports, build will be failed"
           exit 1
        fi
        if [[ $POST_ACTION == 'check_survived_blocks' && $(grep -RE "class='survived'" --exclude="LeftCurlyCheck.*" target/ | cat | wc -l) > 0 ]]; then
           echo "Survived items:"$(grep -RE "class='survived'" --exclude="LeftCurlyCheck.*" target/ | cat)
           echo "Survived items found in reports, build will be failed"
           exit 1
        fi
        if [[ $POST_ACTION == 'check_survived_coding'
              && $(grep -RE "class='survived'"  --exclude="EqualsAvoidNullCheck.*" \
              --exclude="FallThroughCheck.*" --exclude="HiddenFieldCheck.*" --exclude="IllegalInstantiationCheck.*" \
              --exclude="IllegalTypeCheck.*" \
              --exclude="MultipleVariableDeclarationsCheck.*" \
              --exclude="RequireThisCheck.*" \
              --exclude="UnnecessaryParenthesesCheck.*" --exclude="VariableDeclarationUsageDistanceCheck.*"   target/ | cat | wc -l) > 0 ]]; then
           echo "Survived items:"$(grep -RE "class='survived'"  --exclude="EqualsAvoidNullCheck.*" \
              --exclude="FallThroughCheck.*" --exclude="HiddenFieldCheck.*" --exclude="IllegalInstantiationCheck.*" \
              --exclude="IllegalTypeCheck.*" \
              --exclude="MultipleVariableDeclarationsCheck.*" \
              --exclude="RequireThisCheck.*" \
              --exclude="UnnecessaryParenthesesCheck.*" --exclude="VariableDeclarationUsageDistanceCheck.*"  target/ | cat)
           echo "Survived items found in reports, build will be failed"
           exit 1
        fi
      else
        echo "Build is skipped, changed files:"
        git diff --name-only HEAD HEAD~1
      fi