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

improve CI testing #182

Open
9 of 27 tasks
MCWertGaming opened this issue Aug 22, 2022 · 4 comments
Open
9 of 27 tasks

improve CI testing #182

MCWertGaming opened this issue Aug 22, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@MCWertGaming
Copy link
Collaborator

MCWertGaming commented Aug 22, 2022

We should improve the CI testing coverage by doing:

  • switch to the official cmake action by github and add testing for multiple compile targets (Release, debug)
  • DevSkim (code scanning)
  • Flawfinder
  • Microsoft code analysis
  • PSScriptAnalyzer (for the powershell scripts)
  • Superlinter
  • OSSAR (early project by microsoft)
  • Labeler (label PRs based on changed files)
  • Greetings (greets first time contributors)
  • Stale (closes issues when they become stale)
  • https://pre-commit.ci

Other things

Analysis tools

  • clang-tidy
  • cpp-check
  • shellcheck (for bash scripts if needed)
  • cpplint

Compilers

  • Linux - clang, gcc
  • Windows - MSVC, clang-cl (clang with MS-VS adapter)
  • MSYS2 - GCC, Clang
  • MinGW - GCC, clang
  • Cygwin - GCC, clang
  • MacOS - apple-clang (more if available)
@flagarde
Copy link
Collaborator

flagarde commented Aug 28, 2022

Hi,
This is the pre-commit I use for other project :

It deals with most the analysis tools you asked + some others

  1. For the ones which need CI
---
name: pre-commit

on:
  pull_request:
  push:
    paths-ignore:
    - docs/**
    branches: [main]

jobs:
  pre-commit:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Install packages
      run: sudo apt-get install clang-tidy cppcheck iwyu cmake

    - name: 🔧 Configure
      run: cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_NUMBER_JOBS=2 -DCMAKE_NUMBER_JOBS_TESTS=1

    - uses: pre-commit/action@v2.0.3
  1. .pre-commit-config.yaml
---
ci:
  skip: [cppcheck, include-what-you-use, clang-tidy]

default_install_hook_types:
- pre-commit
- pre-merge-commit
- pre-push
- prepare-commit-msg
- commit-msg
- post-commit
- post-checkout
- post-merge
- post-rewrite

fail_fast: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.3.0
  hooks:
  - id: check-added-large-files
    args: [--maxkb=200]
  - id: check-case-conflict
  - id: check-merge-conflict
  - id: check-symlinks
  - id: check-vcs-permalinks
  - id: destroyed-symlinks
  - id: detect-private-key
  - id: double-quote-string-fixer
  - id: end-of-file-fixer
  - id: fix-byte-order-marker
  - id: mixed-line-ending
    args: [--fix=lf]
  - id: trailing-whitespace
    args: [--markdown-linebreak-ext=md]
  - id: check-yaml
    args: [--allow-multiple-documents]

- repo: https://github.com/jumanjihouse/pre-commit-hooks
  rev: 3.0.0
  hooks:
  - id: check-mailmap
    name: detect if an email address needs to be added to mailmap
  - id: git-check
    name: check for conflict markers and core.whitespace errors

- repo: https://github.com/Lucas-C/pre-commit-hooks
  rev: v1.3.0
  hooks:
  - id: remove-crlf
  - id: remove-tabs
    name: tabs remover
    args: [--whitespaces-count, '2']

- repo: https://github.com/codespell-project/codespell
  rev: v2.1.0
  hooks:
  - id: codespell

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
  rev: 0.2.2
  hooks:
  - id: yamlfmt
    name: format YAML files
    args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '250']

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
  rev: 2.4.0
  hooks:
  - id: editorconfig-checker
    name: check .editorconfig rules

- repo: https://github.com/igorshubovych/markdownlint-cli
  rev: v0.32.1
  hooks:
  - id: markdownlint
    args: [--config=.markdownlint.yml, scan]

- repo: https://github.com/Kr4is/cmake-format-precommit
  rev: v0.6.14
  hooks:
  - id: cmake-format
    args: [--config=.cmake-format.yml]
  - id: cmake-lint
    args: [--config=.cmake-linter.yml]

- repo: https://github.com/Takishima/cmake-pre-commit-hooks
  rev: v1.5.3
  hooks:
  - id: clang-tidy
    args: [-Bbuild, --config=]
  - id: cppcheck
    args: [-Bbuild, --suppressions-list=.cppcheck]
  - id: include-what-you-use
    args: [-Bbuild, -p, build, --jobs, '10']
  - id: lizard
    args: [--CCN, '50', --length, '150', --arguments, '20', --warnings_only, -x, '*/*tests*/*', -x, '*/*build*/*', ./]

- repo: https://gitlab.com/daverona/pre-commit/cpp
  rev: 0.8.0
  hooks:
  - id: cpplint

- repo: https://github.com/pre-commit/mirrors-clang-format
  rev: v14.0.6
  hooks:
  - id: clang-format

Feel free to skip what is irrelevant, useless to you :)

For the config files you can adapt some from here : https://github.com/flagarde/Khaos and tune them for your needs

@flagarde
Copy link
Collaborator

flagarde commented Aug 28, 2022

For the tests with Ubuntu clang +gcc you can use
https://github.com/flagarde/Khaos/blob/main/.github/workflows/Ubuntu.yml clang3.9 clang4 are buggy on ubuntu so you can skip them or comment them.

The docker containers are done by https://github.com/flagarde/ci . It still in very beta but you can have a try. the containers are by design very limited in software you need to install them on the CI

@flagarde
Copy link
Collaborator

MacOS clang:
https://github.com/yaodaq/YAODAQ/blob/main/.github/workflows/MacOS-Clang.yml

MacOS GCC:
https://github.com/yaodaq/YAODAQ/blob/main/.github/workflows/MacOS-GCC.yml

Windows:
https://github.com/yaodaq/YAODAQ/blob/main/.github/workflows/Windows-MSVC.yml
https://github.com/yaodaq/YAODAQ/blob/main/.github/workflows/Windows-MSYS2.yml

MinGW - GCC, clang, Cygwin - GCC, clang I tried and I gave up :(

Fell free to copy and adapt. I'm would be really happy if you fin some improvments too :)

@MCWertGaming
Copy link
Collaborator Author

Really nice! Thank you. I have looked briefly over them and they all look really great. We might want to stick with the official github template though, but I'll look into that when the window class stuff is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

2 participants