Skip to content

Commit 607d7d8

Browse files
authored
Merge pull request #130 from Stateford/fix-broken-cicd
Fix CI/CD workflows: update build configuration, remove obsolete Code…
2 parents 314aa84 + 4f83b6b commit 607d7d8

7 files changed

Lines changed: 42 additions & 210 deletions

File tree

.github/workflows/build.yml

Lines changed: 31 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,53 @@ name: Build
22

33
on:
44
push:
5-
branches: [ "master", "develop" ]
6-
tags:
7-
- '*'
5+
branches: [master, develop]
6+
tags: ['v*']
87
pull_request:
9-
branches: [ "master", "develop" ]
8+
branches: [master, develop]
109

1110
env:
12-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
1311
BUILD_TYPE: Release
1412

1513
jobs:
1614
build:
17-
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
18-
# You can convert this to a matrix build if you need cross-platform coverage.
19-
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
2015
runs-on: windows-latest
21-
2216
steps:
23-
- uses: actions/checkout@v3
24-
25-
- name: Setup Python
26-
uses: actions/setup-python@v4.5.0
27-
with:
28-
python-version: 3.11
29-
cache: pip
30-
architecture: x64
17+
- uses: actions/checkout@v4
3118

32-
- name: Python Depdendeicnes
33-
run: |
34-
python3 -m pip install --upgrade pip
35-
python3 -m pip install -r ${{github.workspace}}/requirements.txt
19+
- name: Setup MSBuild
20+
uses: microsoft/setup-msbuild@v2
3621

37-
- name: Add MSBuild to PATH
38-
uses: microsoft/setup-msbuild@v1.0.2
22+
- name: Configure CMake
23+
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
3924

40-
- name: Configure CMake
41-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
42-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
43-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
25+
- name: Build
26+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
4427

45-
- name: Build
46-
# Build your program with the given configuration
47-
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
28+
- name: Test
29+
run: ctest --test-dir build -C ${{ env.BUILD_TYPE }}
4830

49-
- name: Test
50-
working-directory: ${{github.workspace}}/build
51-
# Execute tests defined by the CMake configuration.
52-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
53-
run: ctest -C ${{env.BUILD_TYPE}}
54-
55-
- name: Upload a Build Artifact
56-
uses: actions/upload-artifact@v3.1.2
57-
with:
58-
# Artifact name
59-
name: Display Lock
60-
path: ${{github.workspace}}/build/src/release/Display-Lock.exe
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: Display-Lock
35+
path: build/src/Release/Display-Lock.exe
6136

6237
deploy:
38+
if: startsWith(github.ref, 'refs/tags/')
6339
needs: build
6440
runs-on: windows-latest
65-
6641
steps:
67-
- uses: actions/checkout@v3
68-
69-
- if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
70-
name: get release
71-
uses: actions/download-artifact@v4.1.7
72-
with:
73-
name: Display Lock
74-
path: ${{github.workspace}}/build/src/release
75-
76-
- if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
77-
name: check releases
78-
run: ls ${{github.workspace}}/build/src/release
79-
80-
- if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
81-
name: Create release
82-
uses: ncipollo/release-action@v1
83-
with:
84-
artifacts: "${{github.workspace}}/build/src/release/Display-Lock.exe"
85-
bodyFile: "${{github.workspace}}/CHANGELOG.md"
42+
- uses: actions/checkout@v4
43+
44+
- name: Download artifact
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: Display-Lock
48+
path: release
49+
50+
- name: Create release
51+
uses: ncipollo/release-action@v1
52+
with:
53+
artifacts: release/Display-Lock.exe
54+
bodyFile: CHANGELOG.md

.github/workflows/codeql.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

.github/workflows/pylint.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

CLAUDE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ cmake --build build --config Release
1717
cmake -B build -DCMAKE_BUILD_TYPE=Debug
1818
cmake --build build --config Debug
1919

20-
# Run tests (requires Conan for GTest dependency)
21-
pip install conan==1.59.0
20+
# Run tests
2221
ctest --test-dir build -C Release
2322
```
2423

25-
The build requires Visual Studio 2022 (MSVC) on Windows. Conan package manager is used to fetch Google Test for unit testing.
24+
The build requires Visual Studio 2022 (MSVC) on Windows.
2625

2726
## Architecture
2827

@@ -48,7 +47,7 @@ The build requires Visual Studio 2022 (MSVC) on Windows. Conan package manager i
4847

4948
## Testing
5049

51-
Tests use Google Test (fetched via Conan). Test files are in `tests/` with test resources copied to the build directory.
50+
Tests use Google Test (fetched via CMake FetchContent). Test files are in `tests/` with test resources copied to the build directory.
5251

5352
```bash
5453
# Run a single test

requirements-test.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/CMakeLists.txt

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
project(display-lock-unittests)
22

3-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/tests)
4-
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/tests)
3+
include(FetchContent)
54

6-
message(STATUS "BINARY PATH ${CMAKE_BINARY_DIR}")
7-
8-
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
9-
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
10-
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake"
11-
"${CMAKE_BINARY_DIR}/conan.cmake"
12-
TLS_VERIFY ON)
13-
endif()
14-
15-
include(${CMAKE_BINARY_DIR}/conan.cmake)
16-
17-
conan_cmake_configure(
18-
REQUIRES gtest/1.13.0
19-
GENERATORS cmake_find_package
5+
FetchContent_Declare(
6+
googletest
7+
GIT_REPOSITORY https://github.com/google/googletest.git
8+
GIT_TAG v1.14.0
209
)
2110

22-
conan_cmake_autodetect(settings)
11+
# For Windows: Prevent overriding the parent project's compiler/linker settings
12+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
2313

24-
conan_cmake_install(
25-
PATH_OR_REFERENCE .
26-
BUILD missing
27-
REMOTE conancenter
28-
SETTINGS ${settings}
29-
)
14+
FetchContent_MakeAvailable(googletest)
3015

3116
enable_testing()
3217

33-
find_package(GTest REQUIRED)
34-
3518
set(CMAKE_CXX_STANDARD 20)
3619
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3720

0 commit comments

Comments
 (0)