diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index bb13b19d..2a5261de 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -17,6 +17,7 @@ jobs: test_docker: # Iterates on all ROS 1 and ROS 2 distributions. runs-on: ubuntu-latest strategy: + fail-fast: false matrix: ros_distribution: - humble @@ -31,11 +32,6 @@ jobs: # https://ros.org/reps/rep-0003.html # https://ros.org/reps/rep-2000.html include: - # Noetic Ninjemys (May 2020 - May 2025) - #- docker_image: ubuntu:focal - # ros_distribution: noetic - # ros_version: 1 - # Humble Hawksbill (May 2022 - May 2027) - docker_image: ubuntu:jammy ros_distribution: humble @@ -47,58 +43,48 @@ jobs: ros_version: 2 # Rolling Ridley (No End-Of-Life) - #- docker_image: ubuntu:jammy - # ros_distribution: rolling - # ros_version: 2 + - docker_image: ubuntu:jammy + ros_distribution: rolling + ros_version: 2 container: image: ${{ matrix.docker_image }} steps: - - name: setup ROS environment - - + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup ROS environment uses: ros-tooling/setup-ros@v0.7 with: required-ros-distributions: ${{ matrix.ros_distribution }} - - name: build and test ROS 1 - if: ${{ matrix.ros_version == 1 }} + - name: Build and test ROS 2 packages uses: ros-tooling/action-ros-ci@v0.3 + id: action_ros_ci_step with: colcon-defaults: | { "build": { - "mixin": ["asan-gcc", "coverage-gcc", "coverage-pytest"] - }, - "test": { - "mixin": ["coverage-pytest"] - } - } - package-name: ${{ env.PACKAGES }} - target-ros1-distro: ${{ matrix.ros_distribution }} - - name: build and test ROS 2 - if: ${{ matrix.ros_version == 2 }} - uses: ros-tooling/action-ros-ci@v0.3 - with: - colcon-defaults: | - { - "build": { - "mixin": ["asan-gcc", "coverage-gcc", "coverage-pytest"] + "mixin": ["coverage-gcc", "coverage-pytest"] }, "test": { "mixin": ["coverage-pytest"] } } + # If possible, pin the repository in the workflow to a specific commit to avoid + # changes in colcon-mixin-repository from breaking your tests. + colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/1ddb69bedfd1f04c2f000e95452f7c24a4d6176b/index.yaml + package-name: ${{ env.PACKAGES }} target-ros2-distro: ${{ matrix.ros_distribution }} + - uses: codecov/codecov-action@v1.2.1 with: - token: ${{ secrets.CODECOV_TOKEN }} # only needed for private repos + token: ${{ secrets.CODECOV_TOKEN }} files: ros_ws/lcov/total_coverage.info,ros_ws/coveragepy/.coverage flags: unittests name: codecov-umbrella - uses: actions/upload-artifact@v1 with: - name: colcon-logs + name: Colcon-logs path: ${{ steps.action_ros_ci_step.outputs.ros-workspace-directory-name }}/log if: always() # upload the logs even when the build fails diff --git a/codecov.yml b/codecov.yml index 37d2e856..3b31b916 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,3 @@ fixes: - # For each package in your repo + # For each package in the repo - "ros_ws/src/*/vortex-vkf/vortex-filtering/::" diff --git a/vortex-filtering/test/dynamic_model_test.cpp b/vortex-filtering/test/dynamic_model_test.cpp index d8741487..2a71c498 100644 --- a/vortex-filtering/test/dynamic_model_test.cpp +++ b/vortex-filtering/test/dynamic_model_test.cpp @@ -51,8 +51,8 @@ TEST(DynamicModel, sampleSimpleModel) EXPECT_TRUE(isApproxEqual(approx_gauss.mean(), true_gauss.mean(), 0.1)); EXPECT_TRUE(isApproxEqual(true_gauss.cov(), true_gauss.cov(), 0.1)); + #ifdef GNUPLOT_ENABLE // Plot - Gnuplot gp; gp << "set xrange [-10:10]\nset yrange [-10:10]\n"; gp << "set style circle radius 0.05\n"; @@ -63,6 +63,7 @@ TEST(DynamicModel, sampleSimpleModel) gp << "set object 1 ellipse center " << cov_ellipse.x() << "," << cov_ellipse.y() << " size " << 3 * cov_ellipse.a() << "," << 3 * cov_ellipse.b() << " angle " << cov_ellipse.angle_deg() << "fs empty border lc rgb 'cyan'\n"; gp << "replot\n"; + #endif } } // namespace simple_dynamic_model_test diff --git a/vortex-filtering/test/ekf_test.cpp b/vortex-filtering/test/ekf_test.cpp index a6c013b1..5b04eb41 100644 --- a/vortex-filtering/test/ekf_test.cpp +++ b/vortex-filtering/test/ekf_test.cpp @@ -104,6 +104,7 @@ TEST_F(EKFTestCVModel, convergence) } time.pop_back(); + #ifdef GNUPLOT_ENABLE Gnuplot gp; gp << "set terminal qt size 1600,1000\n"; // Modified to make plot larger gp << "set multiplot layout 2,1\n"; @@ -126,4 +127,5 @@ TEST_F(EKFTestCVModel, convergence) gp.send1d(std::make_tuple(time, x_true_u)); gp.send1d(std::make_tuple(time, x_est_u)); gp << "unset multiplot\n"; + #endif } \ No newline at end of file diff --git a/vortex-filtering/test/numerical_integration_test.cpp b/vortex-filtering/test/numerical_integration_test.cpp index 6d5d19ac..6c07b5aa 100644 --- a/vortex-filtering/test/numerical_integration_test.cpp +++ b/vortex-filtering/test/numerical_integration_test.cpp @@ -76,6 +76,7 @@ class NumericalIntegration : public ::testing::Test { void plot_result(std::string title = "ERK convergence") { + #ifdef GNUPLOT_ENABLE // Plot first state and true solution against time Gnuplot gp; gp << "set terminal wxt size 1200,800\n"; @@ -87,6 +88,8 @@ class NumericalIntegration : public ::testing::Test { gp << "plot '-' with lines title 'True', '-' with lines title 'Approx'\n"; gp.send1d(std::make_tuple(t, vortex::plotting::extract_state_series(x_exact, 0))); gp.send1d(std::make_tuple(t, vortex::plotting::extract_state_series(x_est, 0))); + #endif + (void)title; } }; diff --git a/vortex-filtering/test/probability_test.cpp b/vortex-filtering/test/probability_test.cpp index 6d45fcf2..29cabc82 100644 --- a/vortex-filtering/test/probability_test.cpp +++ b/vortex-filtering/test/probability_test.cpp @@ -94,6 +94,7 @@ TEST(MultiVarGauss, sample) double minorAxisLength = cov_ellipse.minor_axis(); double angle = cov_ellipse.angle_deg(); + #ifdef GNUPLOT_ENABLE Gnuplot gp; gp << "set xrange [-10:10]\nset yrange [-10:10]\n"; gp << "set style circle radius 0.05\n"; @@ -103,9 +104,14 @@ TEST(MultiVarGauss, sample) gp << "set object 1 ellipse center " << true_mean(0) << "," << true_mean(1) << " size " << majorAxisLength << "," << minorAxisLength << " angle " << angle << "fs empty border lc rgb 'cyan'\n"; gp << "replot\n"; + #endif EXPECT_TRUE(isApproxEqual(mean, true_mean, 0.5)); EXPECT_TRUE(isApproxEqual(cov, true_cov, 0.5)); + + (void)majorAxisLength; + (void)minorAxisLength; + (void)angle; } TEST(MultiVarGauss, mahalanobisDistanceIdentityCovariance) diff --git a/vortex-filtering/test/ukf_test.cpp b/vortex-filtering/test/ukf_test.cpp index fb876407..4abc72bc 100644 --- a/vortex-filtering/test/ukf_test.cpp +++ b/vortex-filtering/test/ukf_test.cpp @@ -105,7 +105,6 @@ TEST_F(UKFtest, Convergence) double tol = 1e-1; // Plot results - Gnuplot gp; std::vector x_est_mean, z_est_mean, x_est_std, x_p_std, x_m_std; for (int i = 0; i < n_steps; i++) { @@ -116,6 +115,8 @@ TEST_F(UKFtest, Convergence) x_m_std.push_back(x_est.at(i).mean()(0) - std::sqrt(x_est.at(i).cov()(0, 0))); // x_est - std } + #ifdef GNUPLOT_ENABLE + Gnuplot gp; gp << "set terminal wxt size 1200,800\n"; gp << "set title 'UKF convergence'\n"; gp << "set xlabel 'Time [s]'\n"; @@ -130,6 +131,7 @@ TEST_F(UKFtest, Convergence) gp.send1d(std::make_tuple(time, x_true)); gp.send1d(std::make_tuple(time, x_est_mean)); gp.send1d(std::make_tuple(time, z_meas)); + #endif // Check convergence