From fa44961b661518d4a587e76b1134c5abe5359c4d Mon Sep 17 00:00:00 2001 From: Dimitri Apostal Date: Sun, 18 Jan 2026 21:28:26 -0500 Subject: [PATCH 1/3] Fix CI/CD workflows: update build configuration, remove obsolete CodeQL and pylint workflows --- .github/workflows/build.yml | 98 ++++++++++++++---------------------- .github/workflows/codeql.yml | 77 ---------------------------- .github/workflows/pylint.yml | 37 -------------- 3 files changed, 38 insertions(+), 174 deletions(-) delete mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/pylint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e3f0af..b82759f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,84 +2,62 @@ name: Build on: push: - branches: [ "master", "develop" ] - tags: - - '*' + branches: [master, develop] + tags: ['v*'] pull_request: - branches: [ "master", "develop" ] + branches: [master, develop] env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release jobs: build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix 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 runs-on: windows-latest - steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v4.5.0 - with: - python-version: 3.11 - cache: pip - architecture: x64 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: pip - - name: Python Depdendeicnes - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r ${{github.workspace}}/requirements.txt + - name: Install dependencies + run: pip install -r requirements.txt - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + - name: Configure CMake + run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + - name: Build + run: cmake --build build --config ${{ env.BUILD_TYPE }} - - name: Test - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} + - name: Test + run: ctest --test-dir build -C ${{ env.BUILD_TYPE }} - - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.1.2 - with: - # Artifact name - name: Display Lock - path: ${{github.workspace}}/build/src/release/Display-Lock.exe + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: Display-Lock + path: build/src/Release/Display-Lock.exe deploy: + if: startsWith(github.ref, 'refs/tags/') needs: build runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - name: get release - uses: actions/download-artifact@v4.1.7 - with: - name: Display Lock - path: ${{github.workspace}}/build/src/release - - - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - name: check releases - run: ls ${{github.workspace}}/build/src/release - - - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - name: Create release - uses: ncipollo/release-action@v1 - with: - artifacts: "${{github.workspace}}/build/src/release/Display-Lock.exe" - bodyFile: "${{github.workspace}}/CHANGELOG.md" + - uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: Display-Lock + path: release + + - name: Create release + uses: ncipollo/release-action@v1 + with: + artifacts: release/Display-Lock.exe + bodyFile: CHANGELOG.md diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 272d9b1..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,77 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master", develop ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '32 15 * * 4' - -env: - BUILD_TYPE: Release - -jobs: - analyze: - name: Analyze - runs-on: windows-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'cpp', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Use only 'java' to analyze code written in Java, Kotlin or both - # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Python Depdendeicnes - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r ${{github.workspace}}/requirements.txt - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - if: matrix.language == 'cpp' - name: Build C++ - run: | - cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml deleted file mode 100644 index 8542e95..0000000 --- a/.github/workflows/pylint.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Pylint - -on: - push: - branches: [ "master", develop ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master", "develop" ] - -jobs: - build: - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.11"] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r ${{github.workspace}}/requirements-test.txt - - - name: Analysing the code with pylint - run: pylint ${{github.workspace}}/scripts - - - name: Mypy - run: mypy ${{github.workspace}}/scripts - - - name: Flake8 - run: flake8 ${{github.workspace}}/scripts - - - name: Bandit - run: bandit ${{github.workspace}}/scripts From 6520479b0c6b5a6b0ecb10b94572baea3b0940fc Mon Sep 17 00:00:00 2001 From: Dimitri Apostal Date: Sun, 18 Jan 2026 21:32:13 -0500 Subject: [PATCH 2/3] Update conan.cmake download URL to use the latest version from master --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3631953..bf7675b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,7 @@ message(STATUS "BINARY PATH ${CMAKE_BINARY_DIR}") if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") - file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake" + file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake" TLS_VERIFY ON) endif() From 4f83b6ba670b1de6d7a8be3ae55629bd43cfae82 Mon Sep 17 00:00:00 2001 From: Dimitri Apostal Date: Sun, 18 Jan 2026 21:39:40 -0500 Subject: [PATCH 3/3] Refactor CI/CD configuration: remove Python setup and dependencies, switch to FetchContent for Google Test --- .github/workflows/build.yml | 9 --------- CLAUDE.md | 7 +++---- requirements-test.txt | 4 ---- requirements.txt | 1 - tests/CMakeLists.txt | 33 ++++++++------------------------- 5 files changed, 11 insertions(+), 43 deletions(-) delete mode 100644 requirements-test.txt delete mode 100644 requirements.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b82759f..124ea99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,15 +16,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - cache: pip - - - name: Install dependencies - run: pip install -r requirements.txt - - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 diff --git a/CLAUDE.md b/CLAUDE.md index 5d0032a..e0c7da1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,12 +17,11 @@ cmake --build build --config Release cmake -B build -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug -# Run tests (requires Conan for GTest dependency) -pip install conan==1.59.0 +# Run tests ctest --test-dir build -C Release ``` -The build requires Visual Studio 2022 (MSVC) on Windows. Conan package manager is used to fetch Google Test for unit testing. +The build requires Visual Studio 2022 (MSVC) on Windows. ## Architecture @@ -48,7 +47,7 @@ The build requires Visual Studio 2022 (MSVC) on Windows. Conan package manager i ## Testing -Tests use Google Test (fetched via Conan). Test files are in `tests/` with test resources copied to the build directory. +Tests use Google Test (fetched via CMake FetchContent). Test files are in `tests/` with test resources copied to the build directory. ```bash # Run a single test diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index e458651..0000000 --- a/requirements-test.txt +++ /dev/null @@ -1,4 +0,0 @@ -mypy -pylint -flake8 -bandit diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 74199ea..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -conan==1.59.0 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bf7675b..16a8ed1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,37 +1,20 @@ project(display-lock-unittests) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/tests) -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/tests) +include(FetchContent) -message(STATUS "BINARY PATH ${CMAKE_BINARY_DIR}") - -if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") - message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") - file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake" - "${CMAKE_BINARY_DIR}/conan.cmake" - TLS_VERIFY ON) -endif() - -include(${CMAKE_BINARY_DIR}/conan.cmake) - -conan_cmake_configure( - REQUIRES gtest/1.13.0 - GENERATORS cmake_find_package +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 ) -conan_cmake_autodetect(settings) +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -conan_cmake_install( - PATH_OR_REFERENCE . - BUILD missing - REMOTE conancenter - SETTINGS ${settings} -) +FetchContent_MakeAvailable(googletest) enable_testing() -find_package(GTest REQUIRED) - set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON)