Skip to content

Automatic fix for the clang-tidy check bugprone-macro-parantheses (#57) #7

Automatic fix for the clang-tidy check bugprone-macro-parantheses (#57)

Automatic fix for the clang-tidy check bugprone-macro-parantheses (#57) #7

Workflow file for this run

name: TIOGA-CI
on:
push:
branches:
- exawind
pull_request:
branches:
- exawind
concurrency:
group: ${{github.ref}}-${{github.head_ref}}-ci
cancel-in-progress: true
jobs:
Formatting:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Check formatting
uses: DoozyX/[email protected]
with:
source: './driver ./src'
exclude: '.'
extensions: 'h,H,cpp,C'
clangFormatVersion: 17
CPU:
needs: Formatting
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
include:
- os: macos-latest
install_deps: brew install mpich ccache
comp: llvm
procs: $(sysctl -n hw.ncpu)
ccache_cache: /Users/runner/Library/Caches/ccache
ccache_size: 50M
- os: ubuntu-latest
install_deps: sudo apt-get install -y mpich libmpich-dev
comp: gnu
procs: $(nproc)
ccache_cache: ~/.cache/ccache
ccache_size: 50M
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: true
- name: Dependencies
run: ${{matrix.install_deps}}
- name: Setup
run: |
echo "NPROCS=${{matrix.procs}}" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=1" >> $GITHUB_ENV
echo "CCACHE_LOGFILE=${{github.workspace}}/ccache.log.txt" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=${{matrix.ccache_size}}" >> $GITHUB_ENV
- name: Install Ccache
run: |
if [ "${RUNNER_OS}" != "macOS" ]; then
wget https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8-linux-x86_64.tar.xz
tar xvf ccache-4.8-linux-x86_64.tar.xz
sudo cp -f ccache-4.8-linux-x86_64/ccache /usr/local/bin/
fi
- name: Set Up Ccache
uses: actions/cache@v4
with:
path: ${{matrix.ccache_cache}}
key: ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.build_type}}-git-${{github.sha}}
restore-keys: |
ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.build_type}}-git-
- name: Configure
run: |
cmake -B ${{runner.workspace}}/build-ci-${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${{matrix.build_type}} \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}
- name: Build
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
ccache -z
set -eu -o pipefail
cmake --build ${{runner.workspace}}/build-ci-${{matrix.build_type}} --parallel ${{env.NPROCS}} 2>&1 | \
tee -a ${{runner.workspace}}/build-ci-${{matrix.build_type}}/build-output.txt
- name: Ccache Report
run: |
ccache -s
ls ${{matrix.ccache_cache}}
du -hs ${{matrix.ccache_cache}}
- name: Report
working-directory: ${{runner.workspace}}/build-ci-${{matrix.build_type}}
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
egrep "warning:|error:" build-output.txt | egrep -v "submods" \
| egrep -v "ld: warning:" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > build-output-warnings.txt
cat build-output-warnings.txt
exit $(tail -n 1 build-output-warnings.txt | awk '{print $2}')
Lint-clang-tidy:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: true
- name: Setup
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=1" >> $GITHUB_ENV
echo "CCACHE_LOGFILE=${{github.workspace}}/ccache.log.txt" >> $GITHUB_ENV
echo "CCACHE_EXTRAFILES=${{github.workspace}}/.clang-tidy" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=50M" >> $GITHUB_ENV
echo "CTCACHE_DIR=~/.cache/ctcache" >> $GITHUB_ENV
echo "CLANG_TIDY_VERSION=17" >> $GITHUB_ENV
- name: Install clang-tidy
run: |
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
fi
source /etc/os-release # set UBUNTU_CODENAME
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME} main"
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-${CLANG_TIDY_VERSION} main"
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang-tidy-${CLANG_TIDY_VERSION} libomp-${CLANG_TIDY_VERSION}-dev
- name: Install Ccache
run: |
wget https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8-linux-x86_64.tar.xz
sudo curl https://raw.githubusercontent.com/matus-chochlik/ctcache/7fd516e91c17779cbc6fc18bd119313d9532dd90/clang-tidy-cache -Lo /usr/bin/clang-tidy-cache
tar xvf ccache-4.8-linux-x86_64.tar.xz
sudo cp -f ccache-4.8-linux-x86_64/ccache /usr/local/bin/
sudo chmod +x /usr/bin/clang-tidy-cache
mkdir -p ~/.cache/ctcache
- name: Set Up Ccache
uses: actions/cache@v4
with:
path: ~/.cache
key: ccache-${{github.workflow}}-${{github.job}}-git-${{github.sha}}
restore-keys: |
ccache-${{github.workflow}}-${{github.job}}-git-
- name: Dependencies
run: sudo apt-get install -y mpich libmpich-dev
- name: Configure
run: |
export MPICH_CXX=$(which clang++)
cmake \
-B ${{runner.workspace}}/build-clang-tidy \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_CXX_COMPILER:STRING=mpicxx \
-DTIOGA_ENABLE_CLANG_TIDY:BOOL=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
-DCLANG_TIDY_EXEC_NAME:STRING=clang-tidy-${CLANG_TIDY_VERSION} \
${{github.workspace}}
- name: Check
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
cmake --build . --parallel ${{env.NPROCS}} 2>&1 | tee -a clang-tidy-full-report.txt
cat clang-tidy-full-report.txt | grep "warning:" | grep -v "submods" | sort | uniq | \
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > clang-tidy-ci-report.txt
- name: Ccache Report
run: |
ls ~/.cache || true
ls ~/.cache/ccache || true
du -hs ~/.cache/ccache || true
ls ~/.cache/ctcache || true
du -hs ~/.cache/ctcache || true
ccache -s || true
- name: Full report
working-directory: ${{runner.workspace}}/build-clang-tidy
run: cat clang-tidy-full-report.txt
- name: Short report
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
cat clang-tidy-ci-report.txt
exit $(tail -n 1 clang-tidy-ci-report.txt | awk '{print $2}')
Lint-codeql:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
queries: +security-and-quality
config-file: ./.github/codeql/codeql-config.yml
- name: Dependencies
run: sudo apt-get install -y mpich libmpich-dev
- name: Configure
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
export MPICH_CXX=$(which clang++)
export MPICH_CC=$(which clang)
cmake \
-B ${{runner.workspace}}/build-ci-codeql \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-codeql \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER:STRING=mpicxx \
-DCMAKE_C_COMPILER:STRING=mpicc \
${{github.workspace}}
- name: Build
run: |
cmake --build ${{runner.workspace}}/build-ci-codeql --parallel ${{env.NPROCS}}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"
upload: False
output: sarif-results
- name: Filter CodeQL sarif
uses: advanced-security/filter-sarif@v1
with:
patterns: |
-**/submods/**
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif
- name: Upload CodeQL sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: sarif-results/cpp.sarif
Lint-codespell:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: false
- name: Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Dependencies
run: |
# Install Python packages
python -m pip install --upgrade pip
pip install codespell
- name: Run codespell
run: codespell
Save-PR-Number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1