Skip to content

Commit

Permalink
separate test from build (#17)
Browse files Browse the repository at this point in the history
* separate test

* correct path

* Set executable permission

* Install dependencies

* update

* update
  • Loading branch information
aghaeifar authored Dec 22, 2024
1 parent cc5cdd9 commit d47cf8c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:

- uses: Jimver/cuda-toolkit@v0.2.19
id: cuda-toolkit
with:
Expand All @@ -26,7 +27,7 @@ jobs:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -yq libboost-all-dev libhdf5-dev libtbb-dev

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Echo settings
run: nvcc -V
Expand All @@ -39,8 +40,34 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

# Run Unit Tests
- name: Run Unit Tests
run: |
cd ${{github.workspace}}/build/tests
./spinwalk_test
# Upload the build artifact (e.g., compiled executables)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: built-targets-tests
path: ${{github.workspace}}/build/tests

# Separate Test Job
test:
runs-on: ubuntu-latest
needs: build # This job depends on the successful completion of the "build" job

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -yq libboost-all-dev libhdf5-dev libtbb-dev

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: built-targets-tests

- name: change permission
run: chmod +x ${{github.workspace}}/spinwalk_test

- name: test phantom creation
run: ${{github.workspace}}/spinwalk_test --run_test=test_phantom_creation

- name: test config creation
run: ${{github.workspace}}/spinwalk_test --run_test=test_config_creation
3 changes: 3 additions & 0 deletions tests/test_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "../src/config/config_generator.h"
#include "../include/ini.h"

BOOST_AUTO_TEST_SUITE(test_config_creation)

BOOST_AUTO_TEST_CASE(config_creation) {
boost::log::core::get()->set_logging_enabled(false);
Expand All @@ -32,3 +33,5 @@ BOOST_AUTO_TEST_CASE(config_creation) {
BOOST_CHECK(!std::filesystem::exists(temp_file));
BOOST_CHECK(!std::filesystem::exists(temp_file_parent));
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit d47cf8c

Please sign in to comment.