Skip to content

Commit 10b3464

Browse files
Linting for yaml files (ntop#872)
* Add YAML file linting * Add cmake-linux.yml lint and address its concerns
1 parent e727304 commit 10b3464

File tree

5 files changed

+56
-36
lines changed

5 files changed

+56
-36
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
version: 2.1
23

34
orbs:
@@ -36,4 +37,4 @@ workflows:
3637
run-all:
3738
jobs:
3839
- linux-gcc
39-
- windows-msvc
40+
- windows-msvc

.github/workflows/cmake-linux.yml

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: CMake
23

34
on: [push]
@@ -8,9 +9,9 @@ env:
89

910
jobs:
1011
build:
11-
# The CMake configure and build commands are platform agnostic and should work equally
12-
# well on Windows or Mac. You can convert this to a matrix build if you need
13-
# cross-platform coverage.
12+
# The CMake configure and build commands are platform agnostic and should
13+
# work equally well on Windows or Mac. You can convert this to a matrix
14+
# build if you need cross-platform coverage.
1415
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
1516
runs-on: ${{ matrix.os }}
1617
strategy:
@@ -21,32 +22,36 @@ jobs:
2122
- os: macos-latest
2223

2324
steps:
24-
- uses: actions/checkout@v2
25-
26-
- name: Create Build Environment
27-
# Some projects don't allow in-source building, so create a separate build directory
28-
# We'll use this as our working directory for all subsequent commands
29-
run: cmake -E make_directory ${{github.workspace}}/build
30-
31-
- name: Configure CMake
32-
# Use a bash shell so we can use the same syntax for environment variable
33-
# access regardless of the host operating system
34-
shell: bash
35-
working-directory: ${{github.workspace}}/build
36-
# Note the current convention is to use the -S and -B options here to specify source
37-
# and build directories, but this is only available with CMake 3.13 and higher.
38-
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
39-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
40-
41-
- name: Build
42-
working-directory: ${{github.workspace}}/build
43-
shell: bash
44-
# Execute the build. You can specify a specific target with "--target <NAME>"
45-
run: cmake --build . --config $BUILD_TYPE
46-
47-
- name: Test
48-
working-directory: ${{github.workspace}}/build
49-
shell: bash
50-
# Execute tests defined by the CMake configuration.
51-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
52-
run: ctest -C $BUILD_TYPE
25+
- uses: actions/checkout@v2
26+
27+
- name: Create Build Environment
28+
# Some projects don't allow in-source building, so create a separate
29+
# build directory. We'll use this as our working directory for all
30+
# subsequent commands
31+
run: cmake -E make_directory ${{github.workspace}}/build
32+
33+
- name: Configure CMake
34+
# Use a bash shell so we can use the same syntax for environment
35+
# variable access regardless of the host operating system
36+
shell: bash
37+
working-directory: ${{github.workspace}}/build
38+
# Note the current convention is to use the -S and -B options here to
39+
# specify source and build directories, but this is only available
40+
# with CMake 3.13 and higher. The CMake binaries on the Github Actions
41+
# machines are (as of this writing) 3.12
42+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
43+
44+
- name: Build
45+
working-directory: ${{github.workspace}}/build
46+
shell: bash
47+
# Execute the build. You can specify a specific target
48+
# with "--target <NAME>"
49+
run: cmake --build . --config $BUILD_TYPE
50+
51+
- name: Test
52+
working-directory: ${{github.workspace}}/build
53+
shell: bash
54+
# Execute tests defined by the CMake configuration.
55+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more
56+
# detail
57+
run: ctest -C $BUILD_TYPE

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
---
12
language: c++
23
dist: xenial
34

45
compiler:
56
- clang
67
- gcc
78

8-
install:
9+
install:
910
- sudo apt-get update || true
1011
- sudo apt-get install build-essential
1112

.yamllint.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
# 80 chars should be enough, but don't fail if a line is longer
6+
line-length:
7+
max: 80
8+
level: warning

Makefile.in

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,15 @@ BUILD_DEP:=\
140140
libzstd-dev \
141141
shellcheck \
142142
uncrustify \
143+
yamllint \
143144

144145
SUBDIRS+=tools
145146

146147
COVERAGEDIR?=coverage
147148

148149
.PHONY: $(SUBDIRS)
149150
.PHONY: steps build push all clean distclean install test cover gcov build-dep
150-
.PHONY: lint lint.python lint.ccode lint.shell
151+
.PHONY: lint lint.python lint.ccode lint.shell lint.yaml
151152

152153
all: $(APPS) $(DOCS) $(SUBDIRS)
153154

@@ -184,7 +185,7 @@ win32/n2n_win32.a: win32
184185
test: tools
185186
scripts/test_harness.sh
186187

187-
lint: lint.python lint.ccode lint.shell
188+
lint: lint.python lint.ccode lint.shell lint.yaml
188189

189190
lint.python:
190191
flake8 scripts/n2n-ctl scripts/n2n-httpd
@@ -195,6 +196,10 @@ lint.ccode:
195196
lint.shell:
196197
shellcheck scripts/*.sh
197198

199+
lint.yaml:
200+
yamllint .circleci/config.yml .travis.yml .yamllint.yml \
201+
.github/workflows/cmake-linux.yml
202+
198203
# To generate coverage information, run configure with
199204
# CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage"
200205
# and run the desired tests. Ensure that package gcovr is installed

0 commit comments

Comments
 (0)