Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: MSVC C tests #349

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/auto-cancellation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Cancelling previous actions runs.
on: pull_request

jobs:
cancel:
name: auto-cancellation-running-action
runs-on: ubuntu-latest
steps:
- uses: fauguste/[email protected]
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
10 changes: 9 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
---
name: CI
on: [push, pull_request]

on:
push:
branches:
- 'main'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:

jobs:
# Regular C build with two compilers, using the environment:
build_using_compiler_in_environment:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: test-linters

on: [push, pull_request]
on:
push:
branches:
- 'main'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:

jobs:
test-clang-format:
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: cmake-msvc
on: [push, pull_request]

jobs:
job:
name: ${{ matrix.os }}-hosted-basic
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest ]
include:
- os: windows-latest
triplet: x64-windows
vcpkgCommitId: '30124253eecff36bc90f73341edbfb4f845e2a1e'
vcpkgPackages: 'sqlite3'

steps:
- uses: actions/checkout@v1
with:
submodules: recursive

- uses: lukka/get-cmake@latest
- name: dir
run: find $RUNNER_WORKSPACE
shell: bash
- name: Restore artifacts, or run vcpkg, build and cache artifacts
uses: lukka/run-vcpkg@main
id: runvcpkg
with:
vcpkgArguments: '${{ matrix.vcpkgPackages }}'
vcpkgTriplet: '${{ matrix.triplet }}'
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}'
- name: dir
run: find $RUNNER_WORKSPACE
shell: bash
- name: Prints outputs of run-vcpkg task
run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "
- name: Run CMake+VS16Win64 without triplet
uses: lukka/run-cmake@main
id: runcmake
with:
cmakeGenerator: 'VS16Win64' # 'Ninja' fails
cmakeListsOrSettingsJson: 'CMakeListsTxtBasic'
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildWithCMakeArgs: '-j 1'
buildDirectory: '${{ runner.workspace }}/b/'

- name: Run tests
run: '${{ runner.workspace }}\b\tests\Debug\test_libsettings.exe'
9 changes: 8 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Python

on: [push, pull_request]
on:
push:
branches:
- 'main'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:

jobs:
build:

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ include(CCache)
include(SwiftCmakeOptions)

if(MSVC)
message(STATUS "Skipping unit tests, MSVC detected")
set(disable_tests TRUE)
#message(STATUS "Skipping unit tests, MSVC detected")
#set(disable_tests TRUE)
elseif(SKIP_UNIT_TESTS)
message(STATUS "Skipping unit tests requested")
set(disable_tests TRUE)
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ add_library(settings
setting_type_int.c
setting_type_str.c)

target_compile_definitions(settings PRIVATE "_WINDLL")

target_link_libraries(settings swiftnav)

target_include_directories(settings PUBLIC ${PROJECT_SOURCE_DIR}/include)
Expand Down
10 changes: 2 additions & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
${PROJECT_SOURCE_DIR}/src/settings.c
${PROJECT_SOURCE_DIR}/src/settings_util.c)

target_compile_definitions(test_libsettings PRIVATE "_WINDLL")

target_include_directories(test_libsettings
PRIVATE
${PROJECT_SOURCE_DIR}/include
Expand All @@ -30,18 +32,10 @@
target_link_libraries(test_libsettings swiftnav gtest_main)

if (WIN32)
add_custom_command(
TARGET test_libsettings POST_BUILD
COMMENT "Running unit tests"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/libgtest.dll ${CMAKE_BINARY_DIR}/tests
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/libgtest_main.dll ${CMAKE_BINARY_DIR}/tests
COMMAND test_libsettings
)
else (WIN32)
add_custom_command(
TARGET test_libsettings POST_BUILD
COMMENT "Running unit tests"
COMMAND test_libsettings
)
endif (WIN32)