diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..d43d665c --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,15 @@ +--- +Checks: >- + -*, + abseil-*, + portability-*, + misc-*, + -misc-no-recursion, + -misc-non-private-member-variables-in-classes, + -misc-redundant-expression, + +# All enabled checks shall be reported as error. +WarningsAsErrors: "*" + +# Check all headers of the project. +HeaderFilterRegex: '.*' diff --git a/.editorconfig b/.editorconfig index 62426ba9..7233a12a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,7 +15,7 @@ max_line_length = 80 [*.{html,man,so}] max_line_length = 400 -[*.{yaml,yml}] +[*.{yaml,yml,clang-tidy}] indent_size = 2 tab_width = 2 diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml new file mode 100644 index 00000000..88fd8acf --- /dev/null +++ b/.github/workflows/ci-linux.yml @@ -0,0 +1,54 @@ +--- +name: CI-Linux +on: [push, pull_request] + +jobs: + build: + name: Build and Test + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04] + compiler: + - gcc-9 + - gcc-10 + - gcc-11 + - clang-12 + - clang-13 + - clang-14 + + steps: + - name: Install prerequisites + run: >- + sudo apt-get install -y + libgcrypt20-dev + ${{ matrix.compiler }} + cmake + ninja-build + doxygen + graphviz + + - uses: actions/checkout@v3 + + - name: Configure + run: | + export CXX=$(echo ${{ matrix.compiler }} | sed -E 's/^(g|clang)(cc)?/\1++/') + cmake -G Ninja -S . -B build + + - name: Build + working-directory: build + run: ninja srecord-executables + + - name: Smoke test + working-directory: build + run: ninja srecord-executables-version + + - name: Build test prerequisites + working-directory: build + run: ninja prepare-test + + - name: Test + working-directory: build + run: ctest --output-on-failure --output-junit ctest.junit.xml diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml new file mode 100644 index 00000000..9038aafa --- /dev/null +++ b/.github/workflows/ci-macos.yml @@ -0,0 +1,38 @@ +--- +name: CI-MacOS +on: [push, pull_request] + +jobs: + build: + name: Build and Test + runs-on: macos-latest + + steps: + - name: Install prerequisites + run: >- + brew install + libgcrypt + ninja + doxygen + graphviz + + - uses: actions/checkout@v3 + + - name: Configure + run: cmake -G Ninja -S . -B build + + - name: Build + working-directory: build + run: ninja srecord-executables + + - name: Smoke test + working-directory: build + run: ninja srecord-executables-version + + - name: Build test prerequisites + working-directory: build + run: ninja prepare-test + + - name: Test + working-directory: build + run: ctest --output-on-failure --output-junit ctest.junit.xml diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 00000000..ce2b7b24 --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,59 @@ +--- +name: CI-Windows +on: [push, pull_request] + +jobs: + build: + name: MSYS2 Build and Test + runs-on: windows-latest + + defaults: + run: + shell: msys2 {0} + + strategy: + fail-fast: false + matrix: + include: + - sys: mingw64 + env: x86_64 + - sys: mingw32 + env: i686 + - sys: ucrt64 + env: ucrt-x86_64 + + steps: + - name: Install prerequisites + uses: msys2/setup-msys2@v2 + with: + # cSpell:ignore msystem + msystem: ${{ matrix.sys }} + install: >- + mingw-w64-${{ matrix.env }}-libgcrypt + mingw-w64-${{ matrix.env }}-gcc + mingw-w64-${{ matrix.env }}-cmake + mingw-w64-${{ matrix.env }}-ninja + mingw-w64-${{ matrix.env }}-doxygen + mingw-w64-${{ matrix.env }}-graphviz + diffutils + + - uses: actions/checkout@v3 + + - name: Configure + run: cmake -G Ninja -S . -B build + + - name: Build + working-directory: build + run: ninja srecord-executables + + - name: Smoke test + working-directory: build + run: ninja srecord-executables-version + + - name: Build test prerequisites + working-directory: build + run: ninja prepare-test + + - name: Test + working-directory: build + run: ctest --output-on-failure --output-junit ctest.junit.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b0f49659..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: CI -on: [push, pull_request] - -# Write permissions needed for Test report -# (may be fixed by https://github.com/dorny/test-reporter/pull/174) -permissions: - statuses: write - checks: write - -jobs: - build: - name: Build and Test - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04] - compiler: - - gcc-9 - - gcc-10 - - gcc-11 - - clang-12 - - clang-13 - - clang-14 - - steps: - - uses: actions/checkout@v3 - - - name: Install prerequisites - run: | - sudo apt install -y cmake ninja-build - sudo apt install -y doxygen graphviz - - - name: Install compiler (Linux) - if: ${{ startsWith(matrix.os,'ubuntu-') }} - run: | - sudo apt install -y ${{ matrix.compiler }} - - - name: Install libgcrypt - if: ${{ startsWith(matrix.os,'ubuntu-') }} - run: sudo apt install -y libgcrypt20-dev - - - name: Configure - run: | - export SHELL=$(which sh) - export CXX=$(echo ${{ matrix.compiler }} | sed -E 's/^(g|clang)(cc)?/\1++/') - cmake -G Ninja -S . -B build - - - name: Build - working-directory: build - run: ninja srecord-executables-version - - - name: Test - working-directory: build - run: | - ninja test_arglex_ambiguous test_crc16 test_fletcher16 test_hyphen test_url_decode - ctest --output-junit ctest.junit.xml - - docs: - name: Documentation - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v3 - - - name: Install prerequisites - run: | - sudo apt install -y cmake ninja-build - sudo apt install -y doxygen graphviz - sudo apt install -y groff psutils ghostscript - - - name: Configure - run: cmake -G Ninja -S . -B build - - - name: man pages - working-directory: build - run: ninja man - - - name: Doxygen - working-directory: build - run: ninja doxygen - - - name: PDF - working-directory: build - run: ninja doco - - - name: Web Site - working-directory: build - run: ninja man-html web-site diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml new file mode 100644 index 00000000..4a282929 --- /dev/null +++ b/.github/workflows/qa.yml @@ -0,0 +1,91 @@ +--- +name: QA +on: [push, pull_request] + +jobs: + build: + name: Check source + runs-on: ubuntu-22.04 + + steps: + - name: Install prerequisites + run: >- + sudo apt-get install -y + libgcrypt20-dev + clang-14 + clang-tidy-14 + cmake + ninja-build + doxygen + graphviz + + - uses: actions/checkout@v3 + + - name: Configure + env: + CXX: clang++-14 + CXXFLAGS: >- + -std=c++11 + -pedantic + -Wall + SRecord_CMake_Flags: >- + -D CMAKE_EXPORT_COMPILE_COMMANDS=ON + run: | + cmake -G Ninja -S . -B build ${SRecord_CMake_Flags} + + - name: Build + working-directory: build + run: ninja srecord-executables + + - name: Smoke test + working-directory: build + run: ninja srecord-executables-version + + - name: Build test prerequisites + working-directory: build + run: ninja prepare-test + + - name: Test + working-directory: build + run: ctest --output-on-failure --output-junit ctest.junit.xml + + - name: clang-tidy + if: always() + run: run-clang-tidy-14 -p build + + docs: + name: Documentation + runs-on: ubuntu-22.04 + + steps: + - name: Install prerequisites + run: >- + sudo apt-get install -y + cmake + ninja-build + doxygen + graphviz + groff + psutils + ghostscript + + - uses: actions/checkout@v3 + + - name: Configure + run: cmake -G Ninja -S . -B build + + - name: man pages + working-directory: build + run: ninja man + + - name: PDF + working-directory: build + run: ninja doco + + - name: Doxygen + working-directory: build + run: ninja doxygen + + - name: Web Site + working-directory: build + run: ninja man-html web-site diff --git a/cspell.config.yaml b/cspell.config.yaml index 6beb0474..b95f1684 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -116,6 +116,7 @@ words: - compl - CSLEN - csum + - CXXFLAGS - DABEDE - datarec - dbyte diff --git a/doc/dictionaries/names.txt b/doc/dictionaries/names.txt index b19944af..64b66bf5 100644 --- a/doc/dictionaries/names.txt +++ b/doc/dictionaries/names.txt @@ -29,6 +29,7 @@ dg1yfe DJGPP Doxygen dpkg +diffutils Dragonball Elektor Elektuur @@ -133,6 +134,7 @@ Torsten Tridge troff TRSDOS +ucrt Uncia uudecode Verilog diff --git a/doc/etc/BUILDING.man b/doc/etc/BUILDING.man index 1a8d556c..53c0def2 100644 --- a/doc/etc/BUILDING.man +++ b/doc/etc/BUILDING.man @@ -112,7 +112,7 @@ will install updates flagged in the updated database.: \f[I]\&...lots of output...\fP \f[B]% \fPpacman -Syu \f[I]\&...lots of output...\fP -\f[B]% \fPpacman -S mingw-w64-x86_64-gcc groff \\ +\f[B]% \fPpacman -S mingw-w64-x86_64-gcc diffutils groff \\ \f[B] \fP mingw-w64-x86_64-libgcrypt mingw-w64-x86_64-cmake \\ \f[B] \fP mingw-w64-x86_64-graphviz mingw-w64-x86_64-ninja \\ \f[B] \fP mingw-w64-x86_64-doxygen mingw-w64-i686-ghostscript \\ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d3b5f7f3..d7e8715b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,6 +37,16 @@ file(GLOB_RECURSE TEST_URL_DECODE_SRC "url_decode/*.cc") add_executable(test_url_decode ${TEST_URL_DECODE_SRC}) target_link_libraries(test_url_decode lib_srecord) +add_custom_target(prepare-test + DEPENDS + srecord-executables + test_arglex_ambiguous + test_crc16 + test_fletcher16 + test_hyphen + test_url_decode +) + # Tests enable_testing() file(GLOB_RECURSE SRECORD_TESTS "*/*.sh")