Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit: integrate with cndp #373

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .cndpstyle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Style configuration for CNDP documentation files.
#
# For details on how to configure, see [markdownlint docs][1].
#
# For explanation of the rules themselves, see [markdownlint's RULES.md][2]
#
# [1]: https://github.com/markdownlint/markdownlint/blob/master/docs/creating_styles.md
# [2]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md

all
rule "ul-indent", indent: 4

rule "ul-style", style: :dash
rule "no-duplicate-header", allow_different_nesting: true
rule "line-length", :line_length => 165
rule 'MD010', :indent => 3
# exclude_rule 'MD010' # Hard tabs
19 changes: 0 additions & 19 deletions .githooks/pre-commit

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/cache-build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Docker Image Build with cache

on:
on: # yamllint disable-line rule:truthy
push:
branches:
- main
pull_request:
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -50,9 +50,9 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache && \
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: clang-format

on:
on: # yamllint disable-line rule:truthy
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.15
with:
source: '.'
exclude: './examples/vpp-plugin'
extensions: 'c,h,cc,cpp'
clangFormatVersion: 15.0.2
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.17
with:
source: '.'
exclude: 'examples/vpp-plugin'
extensions: 'h,cpp,c,cc'
clangFormatVersion: 17
12 changes: 6 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Docker Image Build

on:
on: # yamllint disable-line rule:truthy
pull_request:
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -13,8 +13,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check out repository code
uses: actions/checkout@v4

- name: Build Docker Image
run: make oci-image
- name: Build Docker Image
run: make oci-image
38 changes: 18 additions & 20 deletions .github/workflows/rust-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Rust

on:
on: # yamllint disable-line rule:truthy
push:
branches: [ "main" ]
branches: [main]
pull_request:
branches: [ "main" ]
branches: [main]

env:
CARGO_TERM_COLOR: always
Expand All @@ -17,24 +17,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check out repository code
uses: actions/checkout@v4

- name: Install packages
run: |
sudo apt-get update && sudo apt-get install -y\
build-essential libbsd-dev libelf-dev libjson-c-dev\
libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\
pkg-config wget libbpf-dev llvm-dev libclang-dev clang
- name: Install packages
run: |
sudo apt-get update && sudo apt-get install -y\
build-essential libbsd-dev libelf-dev libjson-c-dev\
libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\
pkg-config wget libbpf-dev llvm-dev libclang-dev clang

- name: Build and Install CNDP
run: make; sudo CNE_DEST_DIR=/ make install

- name: update rust
run: rustup update stable

- name: Build and Install CNDP
run: make; sudo CNE_DEST_DIR=/ make install

- name: update rust
run: rustup update stable

- name: Build
working-directory: lang/rs
run: CLANG_PATH=/usr/bin/clang-15 cargo build
- name: Build
working-directory: lang/rs
run: CLANG_PATH=/usr/bin/clang-15 cargo build
62 changes: 31 additions & 31 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Smoke Test

on:
on: # yamllint disable-line rule:truthy
pull_request:
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -13,32 +13,32 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Install packages
run: |
sudo apt-get update && sudo apt-get install -y\
build-essential libbsd-dev libelf-dev libjson-c-dev\
libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\
pkg-config wget

- name: Install libbpf
run: |
wget -q -O - https://github.com/libbpf/libbpf/archive/refs/tags/v0.5.0.tar.gz \
| tar -xzC "${GITHUB_WORKSPACE}" \
&& sudo make -j -C "${GITHUB_WORKSPACE}"/libbpf-0.5.0/src install \
&& sudo rm -rf "${GITHUB_WORKSPACE}"/libbpf-0.5.0

- name: Build
run: make

- name: Short test
run: meson test -C builddir --suite short

- name: Upload testlog
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: testlog.txt
path: ${{ github.workspace }}/builddir/meson-logs/testlog.txt
- name: Check out repository code
uses: actions/checkout@v4

- name: Install packages
run: |
sudo apt-get update && sudo apt-get install -y\
build-essential libbsd-dev libelf-dev libjson-c-dev\
libnl-3-dev libnl-cli-3-dev libnuma-dev libpcap-dev meson\
pkg-config wget

- name: Install libbpf
run: |
wget -q -O - https://github.com/libbpf/libbpf/archive/refs/tags/v0.5.0.tar.gz \
| tar -xzC "${GITHUB_WORKSPACE}" \
&& sudo make -j -C "${GITHUB_WORKSPACE}"/libbpf-0.5.0/src install \
&& sudo rm -rf "${GITHUB_WORKSPACE}"/libbpf-0.5.0

- name: Build
run: make

- name: Short test
run: meson test -C builddir --suite short

- name: Upload testlog
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: testlog.txt
path: ${{ github.workspace }}/builddir/meson-logs/testlog.txt
6 changes: 3 additions & 3 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# https://github.com/github/super-linter
name: Lint Code Base

on:
on: # yamllint disable-line rule:truthy
push:
branches: [ "main" ]
branches: [main]
pull_request:
branches: [ "main" ]
branches: [main]
jobs:
run-lint:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
style ".cndpstyle.rb"
ignore_front_matter true
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
types_or: [c++, c]
args: [-i, --style=file]
- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
hooks:
- id: golangci-lint
- repo: https://github.com/markdownlint/markdownlint.git
rev: v0.13.0
hooks:
- id: markdownlint_docker
name: Markdownlint Docker
description: Run markdown lint on your Markdown files using the project docker image
language: docker_image
files: \.(md|mdown|markdown)$
entry: markdownlint/markdownlint -c .mdlrc
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [--toml, cndp-codespell.precommit-toml]
additional_dependencies:
- tomli
exclude: ^doc/api/doxy-api-index.md
10 changes: 10 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
extends: default
rules:
line-length: disable
document-start: disable
comments:
min-spaces-from-content: 1
ignore:
- builddir/*
- .clang-format
Loading
Loading