-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (69 loc) · 2.43 KB
/
cpp-linter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: cpp-linter
on:
pull_request:
merge_group:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
cpp-linter:
runs-on: ubuntu-latest
env:
clang-version: 18
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install clang-${{ env.clang-version }}
run: |
sudo apt-get update
wget https://apt.llvm.org/llvm.sh -O ${{ runner.temp }}/llvm_install.sh
chmod +x ${{ runner.temp }}/llvm_install.sh
if sudo ${{ runner.temp }}/llvm_install.sh ${{ env.clang-version }}; then
sudo apt-get install -y clang-format-${{ env.clang-version }} clang-tidy-${{ env.clang-version }} || exit 1
else
echo "Installation from script failed."
exit 1
fi
echo "CC=clang-${{ env.clang-version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ env.clang-version }}" >> $GITHUB_ENV
- name: Read current gurobi Version
uses: zlatko-ms/varfiletoenv@v3
with:
paths: ./.github/gurobi_version.json
- name: download-gurobi-linux
env:
GUROBI_VERSION_SHORT: ${{ env.gurobiShortVersion }}
GUROBI_VERSION: ${{ env.gurobiVersion }}
GUROBI_VERSION_FOLDER: ${{ env.gurobiFolder }}
GUROBI_FILE: gurobi${{ env.gurobiVersion }}_linux64.tar.gz
run: |
wget https://packages.gurobi.com/${{ env.GUROBI_VERSION_SHORT }}/${{ env.GUROBI_FILE }}
tar -xvzf ${{ env.GUROBI_FILE }}
- name: Generate compilation database
run: |
echo $CC
echo $CXX
$CC --version
$CXX --version
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run cpp-linter
uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: ""
tidy-checks: ""
version: ${{ env.clang-version }}
ignore: "build | test/example-networks | test/example-networks-gen-po | gurobi*"
thread-comments: true
step-summary: true
database: "build"
- name: Fail if linter found errors
if: steps.linter.outputs.checks-failed > 0
run: echo "Linter found errors" && exit 1