dsce with a makefile #30
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
name: Check code style | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
LLVM_VERSION: 16 | |
jobs: | |
format: | |
name: Check code style | |
runs-on: ubuntu-latest | |
steps: | |
# We do not want to check submodules | |
- uses: actions/checkout@v3 | |
- name: Set permissions | |
run: sudo chmod -R a+rwx /var/cache/apt/archives /etc/apt/trusted.gpg.d /etc/apt/sources.list.d /var/lib/apt/lists | |
- name: Get codename | |
run: | | |
source /etc/os-release | |
echo "UBUNTU_CODENAME=${UBUNTU_CODENAME}" >> $GITHUB_ENV | |
- name: Restore cache | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
key: ${{ env.UBUNTU_CODENAME }}-apt-${{ env.LLVM_VERSION }} | |
path: | | |
/var/cache/apt/archives/**.deb | |
!/var/cache/apt/archives/partial | |
!/var/cache/apt/archives/lock | |
/etc/apt/trusted.gpg.d/apt.llvm.org.asc | |
/etc/apt/sources.list.d/llvm.list | |
/var/lib/apt/lists/* | |
!/var/lib/apt/lists/partial | |
!/var/lib/apt/lists/lock | |
- name: Add LLVM repo | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then | |
# download GPG key once | |
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 | |
echo "deb http://apt.llvm.org/${{ env.UBUNTU_CODENAME }}/ llvm-toolchain-${{ env.UBUNTU_CODENAME }}-${{ env.LLVM_VERSION}} main" | sudo tee /etc/apt/sources.list.d/llvm.list | |
- uses: cpp-linter/cpp-linter-action@v2 | |
id: linter | |
with: | |
style: file | |
extensions: 'c,h,m,C,H,cpp,mm,hpp,cc,hh,c++,h++,cxx,hxx' | |
tidy-checks: '-*' | |
version: ${{ env.LLVM_VERSION }} | |
files-changed-only: ${{ github.event_name == 'pull_request' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check for lint failure | |
if: steps.linter.outputs.checks-failed > 0 && false | |
run: | | |
echo "::error::Code style check failed." | |
exit 1 | |