Skip to content

Commit

Permalink
Merge pull request #733 from Nordix/add-github-actions-ci
Browse files Browse the repository at this point in the history
Add GitHub Actions CI
  • Loading branch information
jschlyter authored Nov 29, 2024
2 parents c80b706 + ac61055 commit 8129b74
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 3 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on: [push, pull_request]

jobs:
linux:
name: Linux (${{ matrix.backend }})
runs-on: ubuntu-20.04 # for OpenSSL 1.1.1
strategy:
fail-fast: false
matrix:
include:
- backend: openssl
- backend: botan
steps:
- uses: actions/checkout@v4
- name: Prepare
run: |
sudo apt update -qq
sudo apt install libcppunit-dev libbotan-2-dev p11-kit
- name: Build
run: |
./autogen.sh
./configure --with-crypto-backend=${{ matrix.backend }}
make
- name: Test
run: |
make check || (find . -name test-suite.log -exec cat {} \; && false)
macos:
name: macOS (${{ matrix.backend }})
runs-on: macos-12
strategy:
fail-fast: false
matrix:
include:
- backend: openssl
extra-options: --with-openssl=$(brew --prefix [email protected])
- backend: botan
extra-options: --with-botan=$(brew --prefix botan@2)
steps:
- uses: actions/checkout@v4
- name: Prepare
run: |
brew install automake cppunit botan@2
- name: Build
run: |
./autogen.sh
./configure --with-crypto-backend=${{ matrix.backend }} ${{ matrix.extra-options }}
make
- name: Test
run: |
make check || (find . -name test-suite.log -exec cat {} \; && false)
windows:
name: Windows (${{ matrix.arch }}, ${{ matrix.backend }})
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- arch: x64
backend: openssl
target-platform: x64
- arch: x64
backend: botan
target-platform: x64
- arch: x86
backend: openssl
target-platform: Win32
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Create vcpkg.json
run: >
echo '{ "dependencies": [ "openssl", "botan", "cppunit" ],
"overrides": [ { "name": "openssl", "version-string": "1.1.1n" },
{ "name": "botan", "version-string": "2.19.3" } ],
"builtin-baseline": "38d1652f152d36481f2f4e8a85c0f1e14f3769f7" }' > vcpkg.json
- uses: seanmiddleditch/vcpkg-action@master
id: vcpkg
with:
manifest-dir: ${{ github.workspace }}
triplet: ${{ matrix.arch }}-windows
token: ${{ github.token }}
- name: Build
run: |
mkdir build
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
cmake --build build
- name: Test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cmake --build build --target RUN_TESTS
7 changes: 4 additions & 3 deletions src/lib/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ set(SOURCES p11test.cpp
add_executable(${PROJECT_NAME} ${SOURCES})

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND SOURCES ${PROJECT_SOURCE_DIR}/../win32/setenv.cpp ${PROJECT_SOURCE_DIR}/../win32/syslog.cpp)
target_sources(${PROJECT_NAME} PRIVATE
${PROJECT_SOURCE_DIR}/../win32/setenv.cpp
${PROJECT_SOURCE_DIR}/../win32/syslog.cpp)
list(APPEND COMPILE_OPTIONS "/DCRYPTOKI_STATIC")
else()
list(APPEND SOURCES "ForkTests.cpp")
target_sources(${PROJECT_NAME} PRIVATE "ForkTests.cpp")
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS -pthread)
endif()

include_directories(${INCLUDE_DIRS})


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

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

Expand Down

0 comments on commit 8129b74

Please sign in to comment.