Browse Source

Linting for yaml files (#872)

* Add YAML file linting

* Add cmake-linux.yml lint and address its concerns
pull/874/head
Hamish Coleman 3 years ago
committed by GitHub
parent
commit
10b3464bd2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .circleci/config.yml
  2. 69
      .github/workflows/cmake-linux.yml
  3. 1
      .travis.yml
  4. 8
      .yamllint.yml
  5. 9
      Makefile.in

1
.circleci/config.yml

@ -1,3 +1,4 @@
---
version: 2.1 version: 2.1
orbs: orbs:

69
.github/workflows/cmake-linux.yml

@ -1,3 +1,4 @@
---
name: CMake name: CMake
on: [push] on: [push]
@ -8,9 +9,9 @@ env:
jobs: jobs:
build: build:
# The CMake configure and build commands are platform agnostic and should work equally # The CMake configure and build commands are platform agnostic and should
# well on Windows or Mac. You can convert this to a matrix build if you need # work equally well on Windows or Mac. You can convert this to a matrix
# cross-platform coverage. # build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
@ -21,32 +22,36 @@ jobs:
- os: macos-latest - os: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Create Build Environment - name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory # Some projects don't allow in-source building, so create a separate
# We'll use this as our working directory for all subsequent commands # build directory. We'll use this as our working directory for all
run: cmake -E make_directory ${{github.workspace}}/build # subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable - name: Configure CMake
# access regardless of the host operating system # Use a bash shell so we can use the same syntax for environment
shell: bash # variable access regardless of the host operating system
working-directory: ${{github.workspace}}/build shell: bash
# Note the current convention is to use the -S and -B options here to specify source working-directory: ${{github.workspace}}/build
# and build directories, but this is only available with CMake 3.13 and higher. # Note the current convention is to use the -S and -B options here to
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 # specify source and build directories, but this is only available
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE # with CMake 3.13 and higher. The CMake binaries on the Github Actions
# machines are (as of this writing) 3.12
- name: Build run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
working-directory: ${{github.workspace}}/build
shell: bash - name: Build
# Execute the build. You can specify a specific target with "--target <NAME>" working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE shell: bash
# Execute the build. You can specify a specific target
- name: Test # with "--target <NAME>"
working-directory: ${{github.workspace}}/build run: cmake --build . --config $BUILD_TYPE
shell: bash
# Execute tests defined by the CMake configuration. - name: Test
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail working-directory: ${{github.workspace}}/build
run: ctest -C $BUILD_TYPE shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more
# detail
run: ctest -C $BUILD_TYPE

1
.travis.yml

@ -1,3 +1,4 @@
---
language: c++ language: c++
dist: xenial dist: xenial

8
.yamllint.yml

@ -0,0 +1,8 @@
---
extends: default
rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 80
level: warning

9
Makefile.in

@ -140,6 +140,7 @@ BUILD_DEP:=\
libzstd-dev \ libzstd-dev \
shellcheck \ shellcheck \
uncrustify \ uncrustify \
yamllint \
SUBDIRS+=tools SUBDIRS+=tools
@ -147,7 +148,7 @@ COVERAGEDIR?=coverage
.PHONY: $(SUBDIRS) .PHONY: $(SUBDIRS)
.PHONY: steps build push all clean distclean install test cover gcov build-dep .PHONY: steps build push all clean distclean install test cover gcov build-dep
.PHONY: lint lint.python lint.ccode lint.shell .PHONY: lint lint.python lint.ccode lint.shell lint.yaml
all: $(APPS) $(DOCS) $(SUBDIRS) all: $(APPS) $(DOCS) $(SUBDIRS)
@ -184,7 +185,7 @@ win32/n2n_win32.a: win32
test: tools test: tools
scripts/test_harness.sh scripts/test_harness.sh
lint: lint.python lint.ccode lint.shell lint: lint.python lint.ccode lint.shell lint.yaml
lint.python: lint.python:
flake8 scripts/n2n-ctl scripts/n2n-httpd flake8 scripts/n2n-ctl scripts/n2n-httpd
@ -195,6 +196,10 @@ lint.ccode:
lint.shell: lint.shell:
shellcheck scripts/*.sh shellcheck scripts/*.sh
lint.yaml:
yamllint .circleci/config.yml .travis.yml .yamllint.yml \
.github/workflows/cmake-linux.yml
# To generate coverage information, run configure with # To generate coverage information, run configure with
# CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" # CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage"
# and run the desired tests. Ensure that package gcovr is installed # and run the desired tests. Ensure that package gcovr is installed

Loading…
Cancel
Save