This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
Loosen testing tolerances for macOS #251
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This handles formatting for C/C++ source code, python code, and cmake code | |
name: formatting | |
on: | |
push: | |
branches: [ master, develop, omnitrace ] | |
pull_request: | |
branches: [ master, develop ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
python-formatting: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install black | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: black format | |
run: | | |
black --diff --check . | |
cxx-formatting: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-format-9 | |
- name: clang-format | |
run: | | |
set +e | |
FILES=$(find source examples -type f | grep -v 'tpls/cereal/cereal/external' | egrep '\.h$|\.hpp$|\.c$|\.cpp$|\.cpp\.in$|\.cu$') | |
clang-format-9 -i ${FILES} | |
if [ $(git diff | wc -l) -gt 0 ]; then | |
echo -e "\nError! Source code not formatted. Run clang-format-9...\n" | |
echo -e "\nFiles:\n" | |
git diff --name-only | |
echo -e "\nFull diff:\n" | |
git diff | |
exit 1 | |
fi | |
cmake-formatting: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install cmake-format pyyaml | |
- name: cmake format | |
run: | | |
cmake-format -i $(find . -type f | egrep -v 'Modules/FindPython/|cmake-format' | egrep 'CMakeLists.txt|\.cmake') | |
if [ $(git diff | wc -l) -gt 0 ]; then | |
echo -e "\nError! Source code not formatted. Run cmake-format...\n" | |
echo -e "\nFiles:\n" | |
git diff --name-only | |
echo -e "\nFull diff:\n" | |
git diff | |
exit 1 | |
fi |