|
| 1 | +name: Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + |
| 11 | +jobs: |
| 12 | + clang_format: |
| 13 | + name: Check Clang-Format |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout Repository |
| 17 | + uses: actions/checkout@v2 |
| 18 | + - name: Download Clang-Format |
| 19 | + run: | |
| 20 | + sudo apt update -qq |
| 21 | + sudo apt install clang-format -qq |
| 22 | + - name: Run Clang-Format |
| 23 | + run: scripts/clang-format.sh |
| 24 | + - name: Compare Results |
| 25 | + run: | |
| 26 | + DIFF=$(git diff) |
| 27 | + if [ ! -z "$DIFF" ]; then echo $DIFF && exit 1; fi |
| 28 | +
|
| 29 | + comment_percentage: |
| 30 | + name: Check Comment Percentage |
| 31 | + runs-on: ubuntu-latest |
| 32 | + if: github.event_name == 'pull_request' |
| 33 | + steps: |
| 34 | + - name: Checkout Current Repository |
| 35 | + uses: actions/checkout@v2 |
| 36 | + with: |
| 37 | + path: current |
| 38 | + ref: ${{ github.ref }} |
| 39 | + - name: Checkout Base Repository |
| 40 | + uses: actions/checkout@v2 |
| 41 | + with: |
| 42 | + path: base |
| 43 | + ref: ${{ github.base_ref }} |
| 44 | + - name: Download Cloc |
| 45 | + run: | |
| 46 | + sudo apt update -qq |
| 47 | + sudo apt install cloc -qq |
| 48 | + - name: Run Cloc |
| 49 | + run: | |
| 50 | + BASE="$(base/scripts/cloc.sh --percentage-only)" |
| 51 | + CURRENT="$(current/scripts/cloc.sh --percentage-only)" |
| 52 | + echo "Percentage of Comments in Base Repository: $BASE" |
| 53 | + echo "Percentage of Comments after Merge: $CURRENT" |
| 54 | + if (( $(echo "$BASE > $CURRENT" |bc -l) )) |
| 55 | + then |
| 56 | + awk -v a=$CURRENT -v b=$BASE 'BEGIN {printf "Percentage decreased! (%3.4f%)\n", (a-b)}' |
| 57 | + exit 1 |
| 58 | + else |
| 59 | + awk -v a=$CURRENT -v b=$BASE 'BEGIN {printf "Percentage increased! (%3.4f%)\n", (a-b)}' |
| 60 | + fi |
| 61 | +
|
| 62 | + shellcheck: |
| 63 | + name: Run ShellCheck |
| 64 | + runs-on: ubuntu-latest |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v2 |
| 67 | + - name: Run ShellCheck |
| 68 | + run: | |
| 69 | + find $GITHUB_WORKSPACE -type f -and \( -name "*.sh" \) | xargs shellcheck |
| 70 | +
|
| 71 | + build: |
| 72 | + name: Run Tests |
| 73 | + runs-on: ubuntu-latest |
| 74 | + if: > |
| 75 | + github.event_name == 'pull_request' || |
| 76 | + ( contains(github.ref, 'main') && !contains(github.event.head_commit.message, '[no-ci]') ) || |
| 77 | + ( contains(github.ref, 'develop') && !contains(github.event.head_commit.message, '[no-ci]') ) || |
| 78 | + contains(github.event.head_commit.message, '[run-ci]') |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v2 |
| 81 | + - name: Build Burn-My-Windows |
| 82 | + run: make |
0 commit comments