Skip to content

Create cmake.yml #41

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

Open
wants to merge 2 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
46 changes: 46 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CMake

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE --target test_libswoc

- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: test_libswoc
2 changes: 1 addition & 1 deletion code/include/swoc/DiscreteRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ DiscreteSpace<METRIC, PAYLOAD>::blend(DiscreteSpace::range_type const& range, U
, F&& blender) -> self_type& {
// Do a base check for the color to use on unmapped values. If self blending on @a color
// is @c false, then do not color currently unmapped values.
PAYLOAD plain_color; // color to paint uncolored metrics.
[[maybe_unused]] PAYLOAD plain_color{}; // color to paint uncolored metrics.
bool plain_color_p = blender(plain_color, color); // start with default and blend in @a color.

auto node_cleaner = [&](Node *ptr) -> void { _fa.destroy(ptr); };
Expand Down
4 changes: 4 additions & 0 deletions code/include/swoc/Errata.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,3 +955,7 @@ get(swoc::Rv<R> const& rv) {
}

}} // namespace swoc

namespace std {
using swoc::get; // Import specialized overloads to standard namespace.
}
1 change: 1 addition & 0 deletions unit_tests/ex_Lexicon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ TEST_CASE("Lexicon Example", "[libts][Lexicon]") {
// doc.lookup.begin
auto && [ range, flags ] = *space.find(addr);
// doc.lookup.end
static_cast<void>(range);
REQUIRE(flags == bits);
}
// doc.lookup.end
Expand Down
7 changes: 5 additions & 2 deletions unit_tests/test_Errata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,19 @@ TEST_CASE("Rv", "[libswoc][Errata]")
REQUIRE(result == 17); // Local copy binding, no update.

auto &[r_result, r_erratum] = zret;
REQUIRE(r_erratum.is_ok() == false);

REQUIRE(r_result == 38);
zret = 56;
REQUIRE(r_result == 56); // reference binding, update.

auto const &[cr_result, cr_erratum] = zret;
REQUIRE(cr_result == 56);
REQUIRE(cr_erratum.is_ok() == false);

auto test = [](Rv<int> const &rvc) {
auto const &[cv_result, cv_erratum] = rvc;
REQUIRE(cv_result == 56);
auto n = std::get<0>(rvc);
REQUIRE(n == 56);
};

test(zret); // invoke it.
Expand Down Expand Up @@ -142,4 +144,5 @@ TEST_CASE("Rv", "[libswoc][Errata]")

auto &&[tr2, te2]{maker()};
REQUIRE(tr2->s == "made"sv);
REQUIRE(te2.is_ok() == true);
};
4 changes: 3 additions & 1 deletion unit_tests/test_Lexicon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ TEST_CASE("Lexicon", "[libts][Lexicon]")
{Radio::DELTA, {"Delta"}}});

// test structured binding for iteration.
for ([[maybe_unused]] auto const &[key, name] : lex) {
for (auto const &[key, name] : lex) {
static_cast<void>(key);
static_cast<void>(name);
}
};

Expand Down
12 changes: 12 additions & 0 deletions unit_tests/test_ip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") {
// Verify that earlier ranges are still valid after the double blend.
for (auto &&[text, value] : r2) {
IPRange range{text};
static_cast<void>(value);
REQUIRE(space.end() != space.find(range.min()));
REQUIRE(space.end() != space.find(range.max()));
}
Expand All @@ -765,6 +766,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") {
// Verify all the data is in the ranges.
for (auto &&[text, value] : r2) {
IPRange range{text};
static_cast<void>(value);
REQUIRE(space.end() != space.find(range.min()));
REQUIRE(space.end() != space.find(range.max()));
}
Expand All @@ -777,6 +779,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") {
}
{
auto && [ r, p ] = *space.find(IPAddr{"2001:4997:58:400::1E"});
static_cast<void>(p);
REQUIRE(true == r.empty());
}
}
Expand Down Expand Up @@ -808,8 +811,10 @@ TEST_CASE("IPSpace bitset", "[libswoc][ipspace][bitset]") {

// Check that if an IPv4 lookup misses, it doesn't pass on to the first IPv6
auto && [ r1, p1 ] = *(space.find(IP4Addr{"172.28.56.100"}));
static_cast<void>(p1);
REQUIRE(true == r1.empty());
auto && [ r2, p2 ] = *(space.find(IPAddr{"172.28.56.100"}));
static_cast<void>(p2);
REQUIRE(true == r2.empty());
}

Expand Down Expand Up @@ -864,6 +869,7 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") {

idx = 0;
for (auto const&[range, bits] : space) {
static_cast<void>(range);
REQUIRE(idx < results.size());
CHECK(bits == make_bits(results[idx]));
++idx;
Expand All @@ -872,6 +878,7 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") {
idx = results.size();
for (auto spot = space.end(); spot != space.begin();) {
auto const&[range, bits]{*--spot};
static_cast<void>(range);
REQUIRE(idx > 0);
--idx;
CHECK(bits == make_bits(results[idx]));
Expand All @@ -885,6 +892,7 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") {
for (auto spot = space.begin(); spot != space.end() ; ++spot) {
iter = spot;
std::tie(range, bits) = *iter;
static_cast<void>(range);
REQUIRE(idx < results.size());
CHECK(bits == make_bits(results[idx]));
++idx;
Expand Down Expand Up @@ -1500,10 +1508,14 @@ TEST_CASE("IPSpace Uthira", "[libswoc][ipspace][uthira]") {
auto spot = space.begin();
auto [ r1, p1 ] = *++spot;
auto [ r2, p2 ] = *++spot;
static_cast<void>(p1);
static_cast<void>(p2);
REQUIRE(r1.max() < r2.min()); // This is supposed to be an invariant! Make sure.
auto back = space.end();
auto [ br1, bp1 ] = *--back;
auto [ br2, bp2 ] = *--back;
static_cast<void>(bp1);
static_cast<void>(bp2);
REQUIRE(br2.max() < br1.min()); // This is supposed to be an invariant! Make sure.
}
}
Expand Down