Skip to content

Commit d738cb6

Browse files
authored
update workflow (#180)
* update workflow * disable shell * add linux * unix * god * again * update version * you know it * don't know * try * cmake version * update * shit * fix win
1 parent 04a1306 commit d738cb6

File tree

10 files changed

+61
-31
lines changed

10 files changed

+61
-31
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ on:
99
pull_request:
1010
branches: [ master ]
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
1220
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1321
jobs:
1422
Windows:
@@ -24,13 +32,12 @@ jobs:
2432
steps:
2533
- name: "Set Build Type"
2634
id: build_type
35+
shell: pwsh
2736
run: |
2837
if ("${{ github.ref }}".StartsWith("refs/tags/")) {
29-
echo "BUILD_TYPE::Release";
30-
echo "::set-output name=BUILD_TYPE::Release";
38+
echo "BUILD_TYPE=Release" >> $env:GITHUB_OUTPUT
3139
} else {
32-
echo "BUILD_TYPE::Debug";
33-
echo "::set-output name=BUILD_TYPE::Debug";
40+
echo "BUILD_TYPE=Debug" >> $env:GITHUB_OUTPUT
3441
}
3542
3643
if ("${{ matrix.arch }}" -eq "x64") {
@@ -50,7 +57,7 @@ jobs:
5057
# uses: ammaraskar/msvc-problem-matcher@master
5158

5259
# Install latest CMake
53-
- uses: lukka/get-cmake@latest
60+
- uses: lukka/get-cmake@v3.31.6
5461

5562
# Restore from cache the previously built ports
5663
- name: Restore artifacts, or setup vcpkg
@@ -66,6 +73,7 @@ jobs:
6673
6774
- name: 'Run CMake'
6875
uses: lukka/run-cmake@v10
76+
continue-on-error: false
6977
with:
7078
configurePreset: 'windows-msvc-vs17'
7179
buildPreset: ${{ startsWith(github.ref, 'refs/tags/') && 'windows-msvc-vs17-release' || 'windows-msvc-vs17' }}
@@ -108,23 +116,21 @@ jobs:
108116
working-directory: "${{ github.workspace }}/../../_temp/windows/"
109117
- name: Release
110118
if: startsWith(github.ref, 'refs/tags/')
111-
uses: softprops/action-gh-release@v1
119+
uses: softprops/action-gh-release@v2
112120
with:
113121
draft: true
114-
files: "D:/a/_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
115-
# files: "${{ github.workspace }}/../../_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
122+
files: "${{ github.workspace }}/../../_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
116123
env:
117124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
BUILD_TYPE: ${{ github.ref_type == 'tag' && 'Release' || 'Debug' }}
118126

119127
Linux:
120128
runs-on: ${{ matrix.os }}
121129
strategy:
122130
fail-fast: true
123131
matrix:
124-
include:
125-
- os: ubuntu-20.04
126-
- os: ubuntu-22.04-arm
127-
- os: ubuntu-latest
132+
os: [ubuntu-20.04, ubuntu-22.04-arm, ubuntu-latest]
133+
timeout-minutes: 60
128134
steps:
129135
- name: "Release Build Type"
130136
if: startsWith(github.ref, 'refs/tags/')
@@ -167,7 +173,7 @@ jobs:
167173
168174
- name: 'Run CMake'
169175
uses: lukka/run-cmake@v10
170-
if: startsWith(github.ref, 'refs/tags/') != true
176+
continue-on-error: false
171177
with:
172178
configurePreset: 'ninja-vcpkg-coverage'
173179
buildPreset: 'ninja-vcpkg-coverage'
@@ -243,7 +249,7 @@ jobs:
243249
working-directory: "${{ github.workspace }}/build"
244250
- name: Release without changelog
245251
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os != 'ubuntu-latest' }}
246-
uses: softprops/action-gh-release@v1
252+
uses: softprops/action-gh-release@v2
247253
with:
248254
draft: true
249255
files: ${{ github.workspace }}/build/libsimple-linux-${{ matrix.os }}.zip
@@ -259,6 +265,13 @@ jobs:
259265
env:
260266
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
261267

268+
- name: Build Summary
269+
if: always()
270+
run: |
271+
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
272+
echo "- Build Type: ${{ env.BUILD_TYPE }}" >> $GITHUB_STEP_SUMMARY
273+
echo "- OS: ${{ runner.os }}" >> $GITHUB_STEP_SUMMARY
274+
262275
MacOS:
263276
runs-on: macos-latest
264277
needs: Linux
@@ -348,4 +361,5 @@ jobs:
348361
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
349362

350363
- name: build-iOS
364+
if: success()
351365
run: ./build-ios.sh

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ if(BUILD_SQLITE3)
3434
set(SQLITE_INSTALL_DIR ${SQLITE_ROOT})
3535
set(SQLITE_INCLUDE_DIR ${SQLITE_INSTALL_DIR}/include)
3636
set(SQLITE_LIB_DIR ${SQLITE_INSTALL_DIR}/lib)
37-
if (NOT IOS)
38-
option(SQLITE_ENABLE_FTS5 "enables full text searches version 5" ON)
37+
if (MSVC OR (UNIX AND NOT IOS))
38+
option(SQLITE_ENABLE_FTS5 "enables full text searches version 5" ON)
3939
option(BUILD_SHELL "build SQLite3 shell application" ON)
4040
add_subdirectory(contrib/sqlite3)
4141
endif()

CMakePresets.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
"CMAKE_INSTALL_PREFIX": {
6666
"type": "PATH",
6767
"value": "${sourceDir}/../../_temp/macos/install"
68+
},
69+
"BUILD_SHELL": {
70+
"type": "BOOL",
71+
"value": "OFF"
6872
}
6973
}
7074
},
@@ -81,9 +85,21 @@
8185
"type": "FILEPATH",
8286
"value": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
8387
},
88+
"BUILD_SHELL": {
89+
"type": "BOOL",
90+
"value": "OFF"
91+
},
8492
"BUILD_TESTING": {
8593
"type": "BOOL",
8694
"value": "OFF"
95+
},
96+
"BUILD_SQLITE3": {
97+
"type": "BOOL",
98+
"value": "ON"
99+
},
100+
"SQLITE_ENABLE_FTS5": {
101+
"type": "BOOL",
102+
"value": "ON"
87103
}
88104
},
89105
"condition": {

contrib/CMakeRC.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif()
3434

3535
set(_version 2.0.0)
3636

37-
cmake_minimum_required(VERSION 3.3)
37+
cmake_minimum_required(VERSION 3.19)
3838
include(CMakeParseArguments)
3939

4040
if(COMMAND cmrc_add_resource_library)

contrib/ios.toolchain.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
# command.
130130
#
131131

132-
cmake_minimum_required(VERSION 3.8.0)
132+
cmake_minimum_required(VERSION 3.19)
133133

134134
# CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds.
135135
if(IOS_TOOLCHAIN_HAS_RUN)

contrib/sqlite3/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.19)
22
project(SQLite3
33
VERSION 3.31.1
44
LANGUAGES C

examples/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.19)
22
project(simple_cpp_example)
33

44
include_directories(${SQLITE3_HEADERS_DIR})

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.19)
22
project(simple CXX)
33

44
if(SIMPLE_WITH_JIEBA)

test/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.19)
22
project(simple_tests)
33

44
# https://github.com/maps-gpu/MAPS/issues/7#issuecomment-418200278
@@ -8,13 +8,20 @@ cmake_policy(SET CMP0057 NEW)
88
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src)
99

1010
# Download and unpack googletest at configure time
11+
set(GTEST_CMAKE_ARGS
12+
"-DCMAKE_POLICY_DEFAULT_CMP0048=NEW"
13+
)
1114
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
12-
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
15+
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${GTEST_CMAKE_ARGS} .
1316
RESULT_VARIABLE result
1417
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
1518
if(result)
1619
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
1720
endif()
21+
22+
# Set policy version minimum before adding googletest
23+
set(CMAKE_POLICY_VERSION_MINIMUM "3.5" CACHE STRING "Minimum CMake policy version" FORCE)
24+
1825
execute_process(COMMAND ${CMAKE_COMMAND} --build .
1926
RESULT_VARIABLE result
2027
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
@@ -32,13 +39,6 @@ add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
3239
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
3340
EXCLUDE_FROM_ALL)
3441

35-
# The gtest/gtest_main targets carry header search path
36-
# dependencies automatically when using CMake 2.8.11 or
37-
# later. Otherwise we have to add them here ourselves.
38-
if (CMAKE_VERSION VERSION_LESS 2.8.11)
39-
include_directories("${gtest_SOURCE_DIR}/include")
40-
endif()
41-
4242
include_directories(${SIMPLE_HEADERS_DIR})
4343
include_directories(${SQLITE3_HEADERS_DIR})
4444
set(SOURCE_FILES main.cpp pinyin_test.cc tokenizer_test.cc)

test/CMakeLists.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.19)
22
cmake_policy(SET CMP0057 NEW)
33

44
project(googletest-download NONE)

0 commit comments

Comments
 (0)