File tree 5 files changed +91
-40
lines changed
5 files changed +91
-40
lines changed Original file line number Diff line number Diff line change 24
24
run : |
25
25
echo "/host_usr_local/bin" >> $GITHUB_PATH
26
26
script/ci_setup_linux.sh
27
- - name : Setup Dependencies
28
- run : script/ci_setup_dependencies.sh
29
- - name : Build
30
- run : script/ci_build.sh
27
+ - name : Build and Test
28
+ run : script/ci.sh run_tests
31
29
32
30
33
31
build_clang :
62
60
apt-get install -y --no-install-recommends libunwind-${{ matrix.build_config.version }}-dev;
63
61
fi
64
62
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
65
- - name : Setup Dependencies
66
- run : script/ci_setup_dependencies.sh
67
- - name : Build
68
- run : script/ci_build.sh
63
+ - name : Build and Test
64
+ run : script/ci.sh run_tests
69
65
70
66
71
67
build_osx :
76
72
CXX : clang++
77
73
steps :
78
74
- uses : actions/checkout@main
79
- - name : Setup
80
- run : sudo script/ci_setup_dependencies.sh
81
- - name : Build
82
- run : script/ci_build.sh
75
+ - name : Build and Test
76
+ run : script/ci.sh run_tests
83
77
84
78
85
79
build_windows_msvc :
93
87
steps :
94
88
- uses : actions/checkout@main
95
89
- uses : ilammy/msvc-dev-cmd@v1
96
- - name : Setup
97
- shell : bash
98
- run : script/ci_setup_dependencies.sh
99
- - name : Build
90
+ - name : Build and Test
100
91
shell : bash
101
- run : script/ci_build .sh
92
+ run : script/ci .sh run_tests
102
93
103
94
104
95
formatting-check :
Original file line number Diff line number Diff line change @@ -16,16 +16,13 @@ jobs:
16
16
steps :
17
17
- name : Checkout
18
18
uses : actions/checkout@main
19
- - name : Install dependencies
20
- run : sudo script/ci_setup_dependencies.sh
21
19
- name : CodeQL Initialization
22
20
uses : github/codeql-action/init@v3
23
21
with :
24
22
languages : cpp
25
23
queries : +security-and-quality
26
24
- name : Build
27
- run : |
28
- cmake -S test -B build
29
- cmake --build build -j 4
25
+ shell : bash
26
+ run : script/ci.sh run_build
30
27
- name : CodeQL Analysis
31
28
uses : github/codeql-action/analyze@v3
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Central script called by the CI
4
+ # Usage:
5
+ # ci.sh {run_build|run_tests}
6
+
7
+ #
8
+ # Private Impl
9
+ #
10
+
11
+ # Get the directory of the current script (this is bash's notion of poetry)
12
+ THIS_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
13
+ REPO_DIR=" $THIS_DIR " /..
14
+
15
+ # Determine the install prefix based on the OS
16
+ if [[ " $OSTYPE " == " msys" || " $OSTYPE " == " cygwin" ]]; then
17
+ # Windows path handling is a never ending source of ...
18
+ INSTALL_PREFIX=" $USERPROFILE \\ .local"
19
+ INSTALL_PREFIX=$( cygpath -u " $INSTALL_PREFIX " ) # Make CMake happy when using git bash under windows
20
+ export CMAKE_PREFIX_PATH=$INSTALL_PREFIX ; $CMAKE_PREFIX_PATH # Notice the ";" instead of ":"
21
+ else
22
+ INSTALL_PREFIX=" $HOME /.local"
23
+ export CMAKE_PREFIX_PATH=$INSTALL_PREFIX :$CMAKE_PREFIX_PATH
24
+ fi
25
+
26
+ # Function to install doctest
27
+ _install_doctest () {
28
+ cd " $REPO_DIR "
29
+ git clone --depth=1 --branch=v2.4.11 https://github.com/doctest/doctest
30
+ cd doctest && mkdir -p build && cd build
31
+ cmake .. -DDOCTEST_WITH_TESTS=OFF -DDOCTEST_WITH_MAIN_IN_STATIC_LIB=OFF -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
32
+ cmake --build . --config Release --target install
33
+ }
34
+
35
+ # Function to build the project
36
+ _build_impl () {
37
+ cd " $REPO_DIR "
38
+ JOBS=4
39
+ BUILD_TYPE=Release
40
+ cmake -S test -B build -D CMAKE_BUILD_TYPE=${BUILD_TYPE}
41
+ cmake --build build --config ${BUILD_TYPE} -j ${JOBS}
42
+ }
43
+
44
+ # Function to run tests
45
+ _tests_impl () {
46
+ cd " $REPO_DIR /build"
47
+ JOBS=4
48
+ BUILD_TYPE=Release
49
+ ctest -C ${BUILD_TYPE} -j ${JOBS} --output-on-failure
50
+ }
51
+
52
+ #
53
+ # API
54
+ #
55
+
56
+ # API function to run tests
57
+ run_tests () {
58
+ _install_doctest
59
+ _build_impl
60
+ _tests_impl
61
+ }
62
+
63
+ # API function to build the project
64
+ run_build () {
65
+ _install_doctest
66
+ _build_impl
67
+ }
68
+
69
+ # Main script logic
70
+ case " $1 " in
71
+ run_build)
72
+ run_build
73
+ ;;
74
+ run_tests)
75
+ run_tests
76
+ ;;
77
+ * )
78
+ echo " Usage: $0 {run_build|run_tests}"
79
+ exit 1
80
+ ;;
81
+ esac
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments