@@ -44,33 +44,59 @@ jobs:
44
44
with :
45
45
path : needle
46
46
47
+ - name : Remove ccache
48
+ run : apt-get purge --yes ccache
49
+
47
50
- name : Create source package
48
51
run : |
49
- mkdir package && cd package
52
+ mkdir create_source_package && cd create_source_package
50
53
cmake ../needle -DCMAKE_BUILD_TYPE=Release \
51
- -Dneedle_PACKAGE =ON \
52
- -Dneedle_TEST =OFF
54
+ -DNEEDLE_PACKAGE =ON \
55
+ -DNEEDLE_TEST =OFF
53
56
make package_source
54
- mkdir ../unpacked
55
- tar xf needle-*.tar.xz -C ../unpacked --strip-components=1
57
+ mkdir ../source_package
58
+ tar xf needle-*.tar.xz -C ../source_package --strip-components=1
56
59
57
60
- name : Install from source package
61
+ run : |
62
+ mkdir build_from_source_package install && cd build_from_source_package
63
+ unshare -r -n cmake ../source_package -DCMAKE_BUILD_TYPE=Release \
64
+ -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
65
+ -DNEEDLE_TEST=OFF
66
+ unshare -r -n make install
67
+
68
+ - name : Check installed executable
69
+ run : ${GITHUB_WORKSPACE}/install/bin/needle --help
70
+
71
+ # Clang builds with libc++, but GTest is built with libstdc++
72
+ - name : Install GTest
73
+ if : contains(matrix.compiler, 'gcc')
74
+ run : apt-get update && apt-get install --yes libgtest-dev
75
+
76
+ - name : Build tests
77
+ if : contains(matrix.compiler, 'gcc')
58
78
run : |
59
79
mkdir build && cd build
60
- unshare -r -n cmake ../unpacked -DCMAKE_BUILD_TYPE=Release \
61
- -DCMAKE_INSTALL_PREFIX=$(pwd)/install \
62
- -Dneedle_TEST=OFF
63
- make install
80
+ unshare -r -n cmake ../source_package -DCMAKE_BUILD_TYPE=Release \
81
+ -DCPM_USE_LOCAL_PACKAGES=ON \
82
+ -DNEEDLE_TEST_BINARY_DIR=${GITHUB_WORKSPACE}/install/bin \
83
+ -DNEEDLE_TEST=ON
84
+ unshare -r -n make -k tests
85
+ test -n $(find . -type f -executable -name "needle") # needle binary should exist
86
+ rm bin/needle
87
+ test -z $(find . -type f -executable -name "needle") # needle binary should not exist
64
88
65
89
- name : Run tests
90
+ if : contains(matrix.compiler, 'gcc')
66
91
working-directory : build
67
- run : ./install/bin/needle --help
92
+ run : |
93
+ unshare -r -n ctest -j --output-on-failure --test-dir test
94
+ test -z $(find . -type f -executable -name "needle") # needle binary should not exist
68
95
69
96
- name : Upload source package
70
- if : matrix.compiler == 'gcc-14'
97
+ if : contains( matrix.compiler, 'gcc')
71
98
uses : actions/upload-artifact@v4
72
99
with :
73
- name : source-package
74
- path : package /needle-*.tar.xz*
100
+ name : needle- source-package
101
+ path : create_source_package /needle-*.tar.xz*
75
102
retention-days : 1
76
-
0 commit comments