1name: Code style
2on:
3  schedule:
4    # run daily 20:00 on master branch
5    - cron: '0 20 * * *'
6  push:
7    branches:
8      - prerelease_test
9  pull_request:
10jobs:
11  cmake_checks:
12    name: Check CMake files
13    runs-on: ubuntu-20.04
14    steps:
15      - name: Install prerequisites
16        run: pip install cmakelang
17      - name: Checkout source
18        uses: actions/checkout@v2
19      - name: Run format on CMake files
20        run: |
21          find  -name CMakeLists.txt  -exec cmake-format -i {} +
22          find src test tsl -name '*.cmake' -exec cmake-format -i {} +
23      - name: Check for diff
24        run: git diff --exit-code
25  perl_checks:
26    name: Check Perl code in tree
27    runs-on: ubuntu-20.04
28    steps:
29      - name: Install prerequisites
30        run: sudo apt install perltidy
31      - name: Checkout source
32        uses: actions/checkout@v2
33      - name: Format Perl files, if needed
34        run: find . -name '*.p[lm]' -exec perltidy --profile=scripts/perltidyrc {} +
35      - name: Check for diff
36        run: git diff --exit-code
37  misc_checks:
38    name: Check formatting, license and git hooks
39    runs-on: ubuntu-20.04
40    strategy:
41      fail-fast: false
42    steps:
43    - name: Checkout source
44      if: always()
45      uses: actions/checkout@v2
46    - name: Check license
47      if: always()
48      run: ./scripts/check_license_all.sh
49    - name: Check git commit hooks
50      if: always()
51      run: |
52        python2 ./scripts/githooks/commit_msg_tests.py
53        python3 ./scripts/githooks/commit_msg_tests.py
54    - name: Check for unreferenced test files
55      if: always()
56      run: ./scripts/check_unreferenced_files.sh
57    - name: Check code formatting
58      if: always()
59      run: |
60        sudo apt install clang-format-8
61        sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-8 100
62        sudo update-alternatives --set clang-format /usr/bin/clang-format-8
63        ./scripts/clang_format_all.sh
64        git diff --exit-code
65