Debian Codegraph @

crt/s2n/.github/workflows/ci_linting.yml

raw symbols SCIP
1 ---
2 name: Linters
3 on:
4 push:
5 branches: [main]
6 pull_request:
7 branches: [main]
8 merge_group:
9 types: [checks_requested]
10 branches: [main]
11 permissions:
12 contents: read
13
14 jobs:
15 cppcheck:
16 runs-on: ubuntu-latest
17 env:
18 CPPCHECK_INSTALL_DIR: test-deps/cppcheck
19 steps:
20 - uses: actions/checkout@v7
21
22 - name: Setup
23 run: source ./codebuild/bin/s2n_setup_env.sh
24
25 - name: Cache
26 id: cache
27 uses: actions/cache@v5
28 continue-on-error: true
29 with:
30 path: ${{ env.CPPCHECK_INSTALL_DIR }}
31 key: cppcheck-2.3-${{ env.CPPCHECK_INSTALL_DIR }}
32
33 - name: Install
34 if: steps.cache.outputs.cache-hit != 'true'
35 run: ./codebuild/bin/install_cppcheck.sh "$CPPCHECK_INSTALL_DIR"
36
37 - name: Check
38 run: ./codebuild/bin/run_cppcheck.sh "$CPPCHECK_INSTALL_DIR"
39
40 headers:
41 runs-on: ubuntu-latest
42 steps:
43 - uses: actions/checkout@v7
44
45 - name: Setup
46 run: source ./codebuild/bin/s2n_setup_env.sh
47
48 - name: Check
49 run: ./codebuild/bin/header_mistake_scanner.sh
50
51 simple-mistakes:
52 runs-on: ubuntu-latest
53 steps:
54 - uses: actions/checkout@v7
55
56 - name: Setup
57 run: source ./codebuild/bin/s2n_setup_env.sh
58
59 - name: Check
60 run: ./codebuild/bin/grep_simple_mistakes.sh
61
62 comments:
63 runs-on: ubuntu-latest
64 steps:
65 - uses: actions/checkout@v7
66
67 - name: Setup
68 run: source ./codebuild/bin/s2n_setup_env.sh
69
70 - name: Install
71 run: sudo apt update && sudo apt install -y kwstyle
72
73 - name: Check
74 run: |
75 ./codebuild/bin/run_kwstyle.sh
76 ./codebuild/bin/cpp_style_comment_linter.sh
77
78 ruff:
79 runs-on: ubuntu-latest
80 steps:
81 - name: checkout
82 uses: actions/checkout@v7
83
84 - name: Set up uv
85 uses: astral-sh/setup-uv@v7
86
87 - name: Run Ruff formatting check
88 working-directory: tests/integrationv2
89 id: ruff_format
90 run: uv run ruff format --diff .
91 continue-on-error: true
92
93 - name: Check format exit code
94 if: steps.ruff_format.outcome == 'failure'
95 run: |
96 echo "Run 'uv run ruff format .' to fix formatting issues"
97 exit 1
98
99 - name: Run Ruff lint check
100 working-directory: tests/integrationv2
101 id: ruff_lint
102 run: uv run ruff check .
103 continue-on-error: true
104
105 - name: Check lint exit code
106 if: steps.ruff_lint.outcome == 'failure'
107 run: |
108 echo "Linting issues detected. Run 'uv run ruff check .' locally to see errors and fix them."
109 exit 1
110
111 clang-format:
112 runs-on: ubuntu-latest
113 steps:
114 - uses: actions/checkout@v7
115 - name: clang-format check
116 uses: jidicula/[email protected]
117 with:
118 clang-format-version: '18'
119 include-regex: '^(\.\/)?(api|bin|crypto|stuffer|error|tls|utils|tests\/unit|tests\/testlib|docs\/examples).*\.(c|h)$'
120 nixflake:
121 # The nix develop changes contain broken nixpkg dependenecies; the allow/impure flags workaround this.
122 runs-on: ubuntu-latest
123 steps:
124 - uses: actions/checkout@v7
125 - uses: nixbuild/nix-quick-install-action@v35
126 with:
127 nix_conf: experimental-features = nix-command flakes
128 - name: nix flake check
129 run: NIXPKGS_ALLOW_BROKEN=1 NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix flake check --impure
130 nixfmt:
131 runs-on: ubuntu-latest
132 steps:
133 - uses: actions/checkout@v7
134 - uses: nixbuild/nix-quick-install-action@v35
135 with:
136 nix_conf: experimental-features = nix-command flakes
137 - name: nix fmt
138 run: nix fmt $(find . -name \*nix -type f -not -path "./.git/*")
139 - name: Changed files
140 id: dirty
141 run: |
142 echo "Checking nix files with: nix fmt ..."
143 git diff --exit-code
144 continue-on-error: true
145 - name: Failure case
146 if: steps.dirty.outcome != 'success'
147 run: |
148 echo "Please fix formatting with nix fmt (file)"
149 exit 1
150 - name: Success
151 run: echo "All nix files passed format check"