-
Notifications
You must be signed in to change notification settings - Fork 706
130 lines (116 loc) · 3.72 KB
/
ci_linting.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
name: Linters
on:
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
branches: [main]
jobs:
cppcheck:
# ubuntu-latest introduced a newer gcc version that cannot compile cppcheck 2.3
# TODO: upgrade to latest cppcheck and revert to ubuntu-latest
# see https://github.com/aws/s2n-tls/issues/3656
runs-on: ubuntu-20.04
env:
CPPCHECK_INSTALL_DIR: test-deps/cppcheck
steps:
- uses: actions/checkout@v3
- name: Setup
run: source ./codebuild/bin/s2n_setup_env.sh
- name: Cache
id: cache
uses: actions/[email protected]
continue-on-error: true
with:
path: ${{ env.CPPCHECK_INSTALL_DIR }}
key: cppcheck-2.3-${{ env.CPPCHECK_INSTALL_DIR }}
- name: Install
if: steps.cache.outputs.cache-hit != 'true'
run: ./codebuild/bin/install_cppcheck.sh "$CPPCHECK_INSTALL_DIR"
- name: Check
run: ./codebuild/bin/run_cppcheck.sh "$CPPCHECK_INSTALL_DIR"
headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
run: source ./codebuild/bin/s2n_setup_env.sh
- name: Check
run: ./codebuild/bin/header_mistake_scanner.sh
simple-mistakes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
run: source ./codebuild/bin/s2n_setup_env.sh
- name: Check
run: ./codebuild/bin/grep_simple_mistakes.sh
comments:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
run: source ./codebuild/bin/s2n_setup_env.sh
- name: Install
run: sudo apt update && sudo apt install -y kwstyle
- name: Check
run: |
./codebuild/bin/run_kwstyle.sh
./codebuild/bin/cpp_style_comment_linter.sh
pepeight:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Run autopep8
id: autopep8
uses: peter-evans/autopep8@v2
with:
args: --diff --exit-code .
- name: Check exit code
if: steps.autopep8.outputs.exit-code != 0
run: |
echo "Run 'autopep8 --in-place .' to fix"
exit 1
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clang-format check
uses: harrisonkaiser/clang-format-action@verbose
with:
clang-format-version: '15'
include-regex: '^(\.\/)?(api|bin|crypto|stuffer|error|tls|utils|tests\/unit|tests\/testlib|docs\/examples).*\.(c|h)$'
nixflake:
# The nix develop changes contain broken nixpkg dependenecies; the allow/impure flags workaround this.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nixbuild/nix-quick-install-action@v21
with:
nix_conf: experimental-features = nix-command flakes
- name: nix flake check
run: NIXPKGS_ALLOW_BROKEN=1 NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix flake check --impure
nixfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nixbuild/nix-quick-install-action@v21
with:
nix_conf: experimental-features = nix-command flakes
- name: nix fmt
run: nix fmt $(find . -name \*nix -type f -not -path "./.git/*")
- name: Changed files
id: dirty
run: |
echo "Checking nix files with: nix fmt ..."
git diff --exit-code
continue-on-error: true
- name: Failure case
if: steps.dirty.outcome != 'success'
run: |
echo "Please fix formatting with nix fmt (file)"
exit 1
- name: Success
run: echo "All nix files passed format check"