Skip to content

Commit 8129b74

Browse files
authored
Merge pull request #733 from Nordix/add-github-actions-ci
Add GitHub Actions CI
2 parents c80b706 + ac61055 commit 8129b74

File tree

2 files changed

+101
-3
lines changed

2 files changed

+101
-3
lines changed

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
linux:
7+
name: Linux (${{ matrix.backend }})
8+
runs-on: ubuntu-20.04 # for OpenSSL 1.1.1
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- backend: openssl
14+
- backend: botan
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Prepare
18+
run: |
19+
sudo apt update -qq
20+
sudo apt install libcppunit-dev libbotan-2-dev p11-kit
21+
- name: Build
22+
run: |
23+
./autogen.sh
24+
./configure --with-crypto-backend=${{ matrix.backend }}
25+
make
26+
- name: Test
27+
run: |
28+
make check || (find . -name test-suite.log -exec cat {} \; && false)
29+
30+
macos:
31+
name: macOS (${{ matrix.backend }})
32+
runs-on: macos-12
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- backend: openssl
38+
extra-options: --with-openssl=$(brew --prefix [email protected])
39+
- backend: botan
40+
extra-options: --with-botan=$(brew --prefix botan@2)
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Prepare
44+
run: |
45+
brew install automake cppunit botan@2
46+
- name: Build
47+
run: |
48+
./autogen.sh
49+
./configure --with-crypto-backend=${{ matrix.backend }} ${{ matrix.extra-options }}
50+
make
51+
- name: Test
52+
run: |
53+
make check || (find . -name test-suite.log -exec cat {} \; && false)
54+
55+
windows:
56+
name: Windows (${{ matrix.arch }}, ${{ matrix.backend }})
57+
runs-on: windows-2022
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
include:
62+
- arch: x64
63+
backend: openssl
64+
target-platform: x64
65+
- arch: x64
66+
backend: botan
67+
target-platform: x64
68+
- arch: x86
69+
backend: openssl
70+
target-platform: Win32
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: ilammy/msvc-dev-cmd@v1
74+
with:
75+
arch: ${{ matrix.arch }}
76+
- name: Create vcpkg.json
77+
run: >
78+
echo '{ "dependencies": [ "openssl", "botan", "cppunit" ],
79+
"overrides": [ { "name": "openssl", "version-string": "1.1.1n" },
80+
{ "name": "botan", "version-string": "2.19.3" } ],
81+
"builtin-baseline": "38d1652f152d36481f2f4e8a85c0f1e14f3769f7" }' > vcpkg.json
82+
- uses: seanmiddleditch/vcpkg-action@master
83+
id: vcpkg
84+
with:
85+
manifest-dir: ${{ github.workspace }}
86+
triplet: ${{ matrix.arch }}-windows
87+
token: ${{ github.token }}
88+
- name: Build
89+
run: |
90+
mkdir build
91+
cmake -B build ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -A ${{ matrix.target-platform }} -DWITH_CRYPTO_BACKEND=${{ matrix.backend }} -DDISABLE_NON_PAGED_MEMORY=ON -DBUILD_TESTS=ON
92+
cmake --build build
93+
- name: Test
94+
env:
95+
CTEST_OUTPUT_ON_FAILURE: 1
96+
run: |
97+
cmake --build build --target RUN_TESTS

src/lib/test/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ set(SOURCES p11test.cpp
3232
add_executable(${PROJECT_NAME} ${SOURCES})
3333

3434
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
35-
list(APPEND SOURCES ${PROJECT_SOURCE_DIR}/../win32/setenv.cpp ${PROJECT_SOURCE_DIR}/../win32/syslog.cpp)
35+
target_sources(${PROJECT_NAME} PRIVATE
36+
${PROJECT_SOURCE_DIR}/../win32/setenv.cpp
37+
${PROJECT_SOURCE_DIR}/../win32/syslog.cpp)
3638
list(APPEND COMPILE_OPTIONS "/DCRYPTOKI_STATIC")
3739
else()
38-
list(APPEND SOURCES "ForkTests.cpp")
40+
target_sources(${PROJECT_NAME} PRIVATE "ForkTests.cpp")
3941
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS -pthread)
4042
endif()
4143

4244
include_directories(${INCLUDE_DIRS})
4345

4446

4547
target_link_libraries(${PROJECT_NAME} softhsm2-static ${SQLITE3_LIBS} ${CPPUNIT_LIBRARIES})
46-
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS -pthread)
4748

4849
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
4950

0 commit comments

Comments
 (0)