Skip to content

Commit

Permalink
ci: modify CI to test on different OSs (#150)
Browse files Browse the repository at this point in the history
* ci: run test workflow across different OSs

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* ci: specify build config when running test in workflow

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* test: fix running executables on Windows

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* test: fix generator used in `test_integration.cmake`

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

---------

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
  • Loading branch information
threeal authored Oct 9, 2024
1 parent 4f6bed2 commit 61c2684
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ on:
jobs:
test-project:
name: Test Project
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
steps:
- name: Checkout Project
uses: actions/checkout@v4.2.0
Expand All @@ -21,4 +25,5 @@ jobs:
- name: Test Project
uses: threeal/ctest-action@v1.1.0
with:
build-config: Debug
verbose: true
9 changes: 7 additions & 2 deletions test/test_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ section("it should build a package")
endsection()

section("it should build the correct targets")
assert(EXISTS .cdeps/pkg/build/main)
assert_execute_process(.cdeps/pkg/build/main OUTPUT "Hello World!")
if(EXISTS .cdeps/pkg/build/main)
assert_execute_process(.cdeps/pkg/build/main OUTPUT "Hello World!")
elseif(EXISTS .cdeps/pkg/build/main.exe)
assert_execute_process(.cdeps/pkg/build/main.exe OUTPUT "Hello World!")
else()
fail("expected path" .cdeps/pkg/build/main "to exist")
endif()
endsection()
endsection()

Expand Down
9 changes: 8 additions & 1 deletion test/test_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ section("it should install a package")
endsection()

section("it should install the correct targets")
assert_execute_process(.cdeps/pkg/install/bin/main OUTPUT "Hello World!")
if(EXISTS .cdeps/pkg/install/bin/main)
assert_execute_process(.cdeps/pkg/install/bin/main OUTPUT "Hello World!")
elseif(EXISTS .cdeps/pkg/install/bin/main.exe)
assert_execute_process(
.cdeps/pkg/install/bin/main.exe OUTPUT "Hello World!")
else()
fail("expected path" .cdeps/pkg/install/bin/main "to exist")
endif()
endsection()
endsection()

Expand Down
4 changes: 2 additions & 2 deletions test/test_integration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ endsection()

section("it should fail to configure the build due to missing dependencies")
assert_execute_process(
COMMAND "${CMAKE_COMMAND}" -B project/build project
ERROR "Could not find a package configuration file provided by \"MyFibonacci\"")
COMMAND "${CMAKE_COMMAND}" -G "Unix Makefiles" -S project -B project/build
ERROR "Could not find a package configuration file")
endsection()

section("it should regenerate the source code of the test project")
Expand Down

0 comments on commit 61c2684

Please sign in to comment.