@@ -2,84 +2,53 @@ name: Build
22
33on :
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
1110env :
12- # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
1311 BUILD_TYPE : Release
1412
1513jobs :
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
0 commit comments