2023-04-30 13:01:03 +00:00
|
|
|
name: Check for format changes
|
|
|
|
|
|
|
|
# Build on every branch push, tag push, and pull request change:
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check_format:
|
|
|
|
name: Check format
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout reposistory
|
2023-09-13 13:51:26 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-30 13:01:03 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt install clang-format-11
|
|
|
|
|
|
|
|
- name: make format
|
|
|
|
run: make -j $(nproc) format
|
|
|
|
|
|
|
|
- name: Check if there are format changes
|
|
|
|
id: format_changes
|
2023-04-30 13:14:23 +00:00
|
|
|
uses: tj-actions/verify-changed-files@v14
|
2023-04-30 13:01:03 +00:00
|
|
|
|
|
|
|
- name: format changes
|
2023-04-30 13:14:23 +00:00
|
|
|
if: steps.format_changes.outputs.files_changed == 'true'
|
2023-04-30 13:21:15 +00:00
|
|
|
run: |
|
|
|
|
echo "Changed files: ${{ steps.format_changes.outputs.changed_files }}"
|
2023-04-30 13:22:51 +00:00
|
|
|
echo "Please run \`make format\` and commit the result"
|
2023-04-30 13:21:15 +00:00
|
|
|
exit 1
|
2023-04-30 13:01:03 +00:00
|
|
|
|
|
|
|
check_tidy:
|
|
|
|
name: Check tidy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout reposistory
|
2023-09-13 13:51:26 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-30 13:08:59 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.head_ref }}
|
2023-04-30 13:01:03 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt install clang-tidy-11
|
|
|
|
|
|
|
|
- name: make tidy
|
|
|
|
run: make -j $(nproc) tidy
|
|
|
|
|
|
|
|
- name: Check if there are tidy changes
|
|
|
|
id: tidy_changes
|
2023-04-30 13:14:23 +00:00
|
|
|
uses: tj-actions/verify-changed-files@v14
|
2023-04-30 13:01:03 +00:00
|
|
|
|
|
|
|
- name: tidy changes
|
2023-04-30 13:14:23 +00:00
|
|
|
if: steps.tidy_changes.outputs.files_changed == 'true'
|
2023-04-30 13:21:15 +00:00
|
|
|
run: |
|
|
|
|
echo "Changed files: ${{ steps.tidy_changes.outputs.changed_files }}"
|
2023-04-30 13:22:51 +00:00
|
|
|
echo "Please run \`make tidy\` and commit the result"
|
2023-04-30 13:21:15 +00:00
|
|
|
exit 1
|