diff options
author | Robert Adam <dev@robert-adam.de> | 2021-04-19 08:53:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 08:53:06 +0300 |
commit | 25666f727e364ae6d5b70cbdac2eacfa4a6dbd01 (patch) | |
tree | da143a8310103b42eb2baa117dd48b0c00229232 | |
parent | 22383865bf4f16345774722dbcca9a8ef85a9bf0 (diff) | |
parent | 8ed36e8246d26a15cfd9ab5882f8271b0b3a02b6 (diff) |
Merge PR #4936: CI: Add check for source-code formatting
This is to make sure that new patches will actually follow the code
formatting rules that we set up. The used check will make the CI fail if
that was not the case.
-rwxr-xr-x | .github/workflows/check_commit_style.py | 2 | ||||
-rw-r--r-- | .github/workflows/checks.yml | 29 | ||||
-rw-r--r-- | .github/workflows/pr-checks.yml | 48 |
3 files changed, 49 insertions, 30 deletions
diff --git a/.github/workflows/check_commit_style.py b/.github/workflows/check_commit_style.py index c19713488..e0805d298 100755 --- a/.github/workflows/check_commit_style.py +++ b/.github/workflows/check_commit_style.py @@ -25,7 +25,7 @@ def main(): cmd(["git", "remote", "add", remoteName, "https://github.com/mumble-voip/mumble.git"]) # Fetch remote - cmd(["git", "fetch", remoteName]) + cmd(["git", "fetch", "--no-recurse-submodules", remoteName]) # get new commits commitHashes = [x for x in cmd(["git", "rev-list", "{}/master..HEAD".format(remoteName)]).split("\n") if x] diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 6a6dcaf9e..000000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Checks - -on: [pull_request] - -jobs: - commit-check: - runs-on: ubuntu-20.04 - - steps: - - - name: Install Python - run: sudo apt install python3 - shell: bash - - - uses: actions/checkout@v2 - with: - # Assume that there are not >200 new commits that need checking - fetch-depth: 200 - # Don't checkout submodules - submodules: 'false' - # Don't create a merge commit - ref: ${{ github.event.pull_request.head.sha }} - - - name: Check commit style - run: $GITHUB_WORKSPACE/.github/workflows/check_commit_style.py - shell: bash - - - name: Check line endings - uses: erclu/check-crlf@v1 diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 000000000..cc6151542 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,48 @@ +name: PR-Checks + +on: [pull_request] + +jobs: + pr-checks: + runs-on: ubuntu-20.04 + + steps: + + - name: Install Python + run: sudo apt install python3 + shell: bash + + - uses: actions/checkout@v2 + with: + # Assume that there are not >200 new commits that need checking + fetch-depth: 200 + # Don't checkout submodules + submodules: 'recursive' + # Don't create a merge commit + ref: ${{ github.event.pull_request.head.sha }} + + - name: Check commit style + run: $GITHUB_WORKSPACE/.github/workflows/check_commit_style.py + shell: bash + + - name: Check line endings + uses: erclu/check-crlf@v1 + with: + exclude: '3rdparty/' + + - uses: ./.github/actions/install-dependencies + with: + type: shared + os: ubuntu-20.04 + arch: 64bit + + - name: Generate compile-command DB + run: mkdir build; cd build; cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..; cd ..; ln -s build/compile_commands.json . + shell: bash + + - name: Check code formatting + uses: jidicula/clang-format-action@v3.3.0 + with: + clang-format-version: '10' + check-path: '.' + exclude-regex: '(3rdparty/*|build/*)' |