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

Add CI and Fix Windows Build Errors #604

Merged
merged 92 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
f4d31d1
Add CI
matthew-lidar Jul 16, 2024
6012b96
Change something
matthew-lidar Jul 17, 2024
354de47
Add missing dep
matthew-lidar Jul 17, 2024
65aea32
add python build
matthew-lidar Jul 17, 2024
b6f74ba
Try again
matthew-lidar Jul 17, 2024
bac7af4
Try a third time
matthew-lidar Jul 17, 2024
c9496e7
Again
matthew-lidar Jul 17, 2024
30f4c00
su-do it
matthew-lidar Jul 17, 2024
e1b7c61
Install docs
matthew-lidar Jul 17, 2024
e37c0a3
Run tests and lint
matthew-lidar Jul 17, 2024
60bc1cf
Fix
matthew-lidar Jul 17, 2024
6c23d43
Final try maybe?
matthew-lidar Jul 17, 2024
511d66a
Maybe this is it?
matthew-lidar Jul 17, 2024
b247174
Try and add clang format
matthew-lidar Jul 17, 2024
8fded9d
Add max and linux build
matthew-lidar Jul 31, 2024
1dacde3
Try again
matthew-lidar Jul 31, 2024
a5e9364
New attempt
matthew-lidar Jul 31, 2024
b6a196e
Another attempt
matthew-lidar Jul 31, 2024
462dd69
Fix mac and lint
matthew-lidar Jul 31, 2024
7a06b52
Add python on mac
matthew-lidar Jul 31, 2024
20d427f
Try and fix lint and mac python
matthew-lidar Jul 31, 2024
d38148d
Try it again
matthew-lidar Jul 31, 2024
191a7a8
Again
matthew-lidar Jul 31, 2024
afec069
Again
matthew-lidar Jul 31, 2024
3cb4206
Just get pip to work
matthew-lidar Jul 31, 2024
2b5804b
Last try
matthew-lidar Jul 31, 2024
7cbb2ab
Try again
matthew-lidar Jul 31, 2024
51221a1
Add missing dep
matthew-lidar Jul 31, 2024
859bc2b
Try again
matthew-lidar Jul 31, 2024
5417d54
Again
matthew-lidar Jul 31, 2024
b7e99f5
Last try
matthew-lidar Jul 31, 2024
46ada4d
Maybe fix linker error
matthew-lidar Jul 31, 2024
07fa3a7
Try again
matthew-lidar Aug 1, 2024
fbcc0cf
Try again
matthew-lidar Aug 1, 2024
02d72a1
Install ninja since we require it for no reason
matthew-lidar Aug 1, 2024
43b287e
Fix test
matthew-lidar Aug 1, 2024
2c2bb69
Attempt to fix windows python build
matthew-lidar Aug 1, 2024
9860d84
Try again
matthew-lidar Aug 1, 2024
14098b2
last try
matthew-lidar Aug 1, 2024
39d1750
Again?
matthew-lidar Aug 1, 2024
e627917
Again
matthew-lidar Aug 1, 2024
d2b37da
Fix tests on windows
matthew-lidar Aug 1, 2024
713acd5
Try and generate debian on linux
matthew-lidar Aug 1, 2024
311d33c
Whoops
matthew-lidar Aug 1, 2024
f389f01
Try using msvc
matthew-lidar Aug 1, 2024
2795418
Update CI name
matthew-lidar Aug 2, 2024
5bcc733
Add python build
matthew-lidar Jul 17, 2024
24a7ea7
Try again
matthew-lidar Jul 17, 2024
184b61d
Try a third time
matthew-lidar Jul 17, 2024
55e55e1
Again
matthew-lidar Jul 17, 2024
cbed544
Su-do it
matthew-lidar Jul 17, 2024
5bbd446
Install docs
matthew-lidar Jul 17, 2024
e53a6bb
Run tests and lint
matthew-lidar Jul 17, 2024
5665bf3
Fix
matthew-lidar Jul 17, 2024
7a26d10
Final try maybe
matthew-lidar Jul 17, 2024
fd7bdf8
Maybe this is it?
matthew-lidar Jul 17, 2024
aa55ba4
Try and add clang format
matthew-lidar Jul 17, 2024
b506886
Add max and linux build
matthew-lidar Jul 31, 2024
6e6fc83
Try again
matthew-lidar Jul 31, 2024
f0895be
New attempt
matthew-lidar Jul 31, 2024
25999f9
Another attempt
matthew-lidar Jul 31, 2024
e874677
Fix mac and lint
matthew-lidar Jul 31, 2024
053d384
Add python on mac
matthew-lidar Jul 31, 2024
37b7754
Try and fix lint and mac python
matthew-lidar Jul 31, 2024
45e5ccb
Try it again
matthew-lidar Jul 31, 2024
8de92a6
Again
matthew-lidar Jul 31, 2024
827a03e
Again
matthew-lidar Jul 31, 2024
ca8404d
Just get pip to work
matthew-lidar Jul 31, 2024
4f877ba
Last try
matthew-lidar Jul 31, 2024
55fe2da
Try again
matthew-lidar Jul 31, 2024
da6ca65
Add missing dep
matthew-lidar Jul 31, 2024
501439c
Try again
matthew-lidar Jul 31, 2024
cb23f46
Again
matthew-lidar Jul 31, 2024
94a0749
Last try
matthew-lidar Jul 31, 2024
5c08479
Maybe fix linker error
matthew-lidar Jul 31, 2024
51a43c2
Try again
matthew-lidar Aug 1, 2024
07eff03
Try again
matthew-lidar Aug 1, 2024
623b829
Install ninja since we require it for no reason
matthew-lidar Aug 1, 2024
590d54c
Fix test
matthew-lidar Aug 1, 2024
a27969c
Attempt to fix windows python build
matthew-lidar Aug 1, 2024
038f5d1
Try again
matthew-lidar Aug 1, 2024
50cf29c
Last try
matthew-lidar Aug 1, 2024
8c7a558
Again?
matthew-lidar Aug 1, 2024
147849f
Again
matthew-lidar Aug 1, 2024
3277580
Fix tests on windows
matthew-lidar Aug 1, 2024
fc5f415
Try and generate debian on linux
matthew-lidar Aug 1, 2024
b932347
Whoops
matthew-lidar Aug 1, 2024
20c1cc6
Try using msvc
matthew-lidar Aug 1, 2024
ef2601b
Update CI name
matthew-lidar Aug 2, 2024
642014b
Remove warning silence and extra semicolon
matthew-lidar Aug 5, 2024
e332711
Merge branch 'add-ci' of github.com:matthew-lidar/ouster_example into…
matthew-lidar Aug 5, 2024
cf93b9f
Fix build?
matthew-lidar Aug 5, 2024
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
115 changes: 115 additions & 0 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Lint Build and Test

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install deps
run: sudo apt install build-essential cmake libjsoncpp-dev libeigen3-dev libcurl4-openssl-dev libtins-dev libpcap-dev libglfw3-dev libglew-dev libspdlog-dev libflatbuffers-dev libgtest-dev clang-format
- name: cpp-lint
run: ./clang-linting.sh
- name: install python
run: sudo apt install python3 python3-pip
- name: install python-deps one
run: cd python && python3 setup.py egg_info && pip3 install `grep -v '^\[' src/*.egg-info/requires.txt`
- name: install python-deps
run: pip3 install mypy flake8
- name: python-lint
run: cd python && mypy ./src ./tests && flake8
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install deps
run: sudo apt install build-essential cmake libjsoncpp-dev libeigen3-dev libcurl4-openssl-dev libtins-dev libpcap-dev libglfw3-dev libglew-dev libspdlog-dev libflatbuffers-dev libgtest-dev clang-format
- name: cmake configure
run: cmake . -B build -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON
- name: cmake build
run: cmake --build build -j4
- name: run tests
run: cd build/ && ctest -j4 --output-on-failure
linux-python-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install python
run: sudo apt install python3 python3-pip
- name: install deps
run: sudo apt install build-essential cmake libjsoncpp-dev libeigen3-dev libcurl4-openssl-dev libtins-dev libpcap-dev libglfw3-dev libglew-dev libspdlog-dev libflatbuffers-dev
- name: install python-deps
run: pip3 install pytest pytest-xdist
- name: build python
run: cd python && sudo python3 -m pip install -e .[test]
- name: run tests
run: cd python/tests && pytest -n4
windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: vcpkg build
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: jsoncpp eigen3 curl libtins glfw3 glew spdlog libpng flatbuffers gtest
triplet: x64-windows
revision: 2024.04.26
token: ${{ github.token }}
github-binarycache: true
- name: cmake configure
run: cmake . -B build -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE=D:/a/ouster-sdk/ouster-sdk/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: cmake build
run: cmake --build build -j4
- name: run tests
run: cd build/ && ctest -j4 -C Debug --output-on-failure
windows-python-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
- name: vcpkg build
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: jsoncpp eigen3 curl libtins glfw3 glew spdlog libpng flatbuffers gtest
triplet: x64-windows
revision: 2024.04.26
token: ${{ github.token }}
github-binarycache: true
- name: install python-deps
run: pip3 install pytest pytest-xdist
- name: build python
run: cd python && python3 -m pip install -e .[test]
env:
OUSTER_SDK_CMAKE_ARGS: '-DCMAKE_TOOLCHAIN_FILE=D:/a/ouster-sdk/ouster-sdk/vcpkg/scripts/buildsystems/vcpkg.cmake'
- name: run tests
run: cd python/tests && pytest -n3
mac-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: install deps
run: brew install cmake pkg-config jsoncpp eigen curl libtins glfw glew spdlog flatbuffers googletest
- name: cmake configure
run: cmake . -B build -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON
- name: cmake build
run: cmake --build build -j3
- name: run tests
run: cd build/ && ctest -j3 --output-on-failure
mac-python-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: install deps
run: brew install cmake pkg-config jsoncpp eigen curl libtins glfw glew spdlog flatbuffers
- name: install python-deps
run: pip3 install pytest pytest-xdist --break-system-packages
- name: build python
run: cd python && python3 -m pip install -e .[test] --break-system-packages
- name: set netparams
run: sudo sysctl -w net.inet.udp.maxdgram=65535
- name: run tests
run: cd python/tests && pytest -n3
2 changes: 1 addition & 1 deletion ouster_client/include/ouster/lidar_scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class LidarScan {
template <typename Iterator>
LidarScan(size_t w, size_t h, Iterator begin, Iterator end,
size_t columns_per_packet = DEFAULT_COLUMNS_PER_PACKET)
: LidarScan(w, h, {begin, end}, columns_per_packet){};
: LidarScan(w, h, {begin, end}, columns_per_packet) {}

/**
* Initialize a lidar scan from another lidar scan.
Expand Down
4 changes: 4 additions & 0 deletions ouster_client/src/lidar_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include "ouster/strings.h"
#include "ouster/types.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

Samahu marked this conversation as resolved.
Show resolved Hide resolved
using namespace ouster::strings;

namespace ouster {
Expand Down
1 change: 0 additions & 1 deletion ouster_osf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ target_link_libraries(ouster_osf
target_include_directories(ouster_osf PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${EIGEN3_INCLUDE_DIR}
)
add_dependencies(ouster_osf cpp_gen)
add_library(OusterSDK::ouster_osf ALIAS ouster_osf)
Expand Down
1 change: 1 addition & 0 deletions ouster_osf/src/compat_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <direct.h>
#include <fcntl.h>
#include <io.h>
#include <share.h>
#include <shlwapi.h>
#include <tchar.h>
#include <windows.h>
Expand Down
6 changes: 6 additions & 0 deletions ouster_osf/tests/png_tools_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,15 @@ TEST_F(OsfPngToolsTest, InternalsTest) {
EXPECT_NE(error_loc, std::string::npos);
output_error = output_error.substr(error_loc);
EXPECT_TRUE(error_caught);
#ifdef _WIN32
EXPECT_EQ(output_error,
"[error] ERROR libpng osf: Also Checkout Porcupine Tree"
" - Arriving Somewhere But Not Here\r\n");
#else
EXPECT_EQ(output_error,
"[error] ERROR libpng osf: Also Checkout Porcupine Tree"
" - Arriving Somewhere But Not Here\n");
#endif
}

#ifndef OUSTER_OSF_NO_THREADING
Expand Down
4 changes: 4 additions & 0 deletions ouster_osf/tests/reader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ TEST_F(ReaderTest, MetadataFromBufferTest) {
EXPECT_NE(error_loc, std::string::npos);

output_error = output_error.substr(error_loc);
#ifdef _WIN32
EXPECT_EQ(output_error, "[error] UNKNOWN TYPE: NON EXISTENT\r\n");
#else
EXPECT_EQ(output_error, "[error] UNKNOWN TYPE: NON EXISTENT\n");
#endif
EXPECT_EQ(result, nullptr);

result = sensor->from_buffer(sensor->buffer(),
Expand Down
1 change: 0 additions & 1 deletion ouster_pcap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ target_include_directories(ouster_pcap PUBLIC
CodeCoverageFunctionality(ouster_pcap)

if(WIN32)
target_compile_options(ouster_pcap PRIVATE /wd4200)
target_link_libraries(ouster_pcap PUBLIC ws2_32)
endif()
target_link_libraries(ouster_pcap
Expand Down
52 changes: 50 additions & 2 deletions ouster_pcap/src/ip_reassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,29 @@

#include "ip_reassembler.h"

#include <tins/arp.h>
#include <tins/constants.h>
#include <tins/detail/pdu_helpers.h>
#include <tins/dot11/dot11_base.h>
#include <tins/dot1q.h>
#include <tins/eapol.h>
#include <tins/ethernetII.h>
#include <tins/icmp.h>
#include <tins/icmpv6.h>
#include <tins/ieee802_3.h>
#include <tins/ip.h>

#include <tins/ipsec.h>
#include <tins/ipv6.h>
#include <tins/loopback.h>
#include <tins/mpls.h>
#include <tins/pdu_allocator.h>
#include <tins/ppi.h>
#include <tins/pppoe.h>
#include <tins/radiotap.h>
#include <tins/rawpdu.h>
#include <tins/sll.h>
#include <tins/tcp.h>
#include <tins/udp.h>
using std::make_pair;

namespace Tins {
Expand Down Expand Up @@ -95,6 +114,35 @@ bool IPv4Stream2::is_complete() const {
return fragments_.begin()->offset() == 0;
}

static Tins::PDU* pdu_from_flag2(Constants::IP::e flag, const uint8_t* buffer,
uint32_t size,
bool rawpdu_on_no_match = true) {
switch (flag) {
case Constants::IP::PROTO_IPIP:
return new Tins::IP(buffer, size);
case Constants::IP::PROTO_TCP:
return new Tins::TCP(buffer, size);
case Constants::IP::PROTO_UDP:
return new Tins::UDP(buffer, size);
case Constants::IP::PROTO_ICMP:
return new Tins::ICMP(buffer, size);
case Constants::IP::PROTO_ICMPV6:
return new Tins::ICMPv6(buffer, size);
case Constants::IP::PROTO_IPV6:
return new Tins::IPv6(buffer, size);
case Constants::IP::PROTO_AH:
return new Tins::IPSecAH(buffer, size);
case Constants::IP::PROTO_ESP:
return new Tins::IPSecESP(buffer, size);
default:
break;
}
if (rawpdu_on_no_match) {
return new Tins::RawPDU(buffer, size);
}
return 0;
}

PDU* IPv4Stream2::allocate_pdu() const {
PDU::serialization_type buffer;
buffer.reserve(total_size_);
Expand All @@ -108,7 +156,7 @@ PDU* IPv4Stream2::allocate_pdu() const {
expected = it->offset() + it->payload().size();
buffer.insert(buffer.end(), it->payload().begin(), it->payload().end());
}
return Internals::pdu_from_flag(
return pdu_from_flag2(
static_cast<Constants::IP::e>(first_fragment_.protocol()),
buffer.empty() ? 0 : &buffer[0], static_cast<uint32_t>(buffer.size()));
}
Expand Down
4 changes: 2 additions & 2 deletions ouster_pcap/src/ip_reassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class IPv4Fragment2 {
uint16_t offset_;
};

class TINS_API IPv4Stream2 {
class IPv4Stream2 {
public:
IPv4Stream2();

Expand Down Expand Up @@ -119,7 +119,7 @@ class TINS_API IPv4Stream2 {
* });
* \endcode
*/
class TINS_API IPv4Reassembler2 {
class IPv4Reassembler2 {
public:
/**
* The status of each processed packet.
Expand Down
4 changes: 4 additions & 0 deletions ouster_viz/src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#include "ouster/point_viz.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
Samahu marked this conversation as resolved.
Show resolved Hide resolved

namespace ouster {
namespace viz {

Expand Down
4 changes: 4 additions & 0 deletions ouster_viz/src/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include "glfw.h"
#include "ouster/point_viz.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

namespace ouster {
namespace viz {
namespace impl {
Expand Down
1 change: 1 addition & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def install_requires():
install_requires.append(temp)
return install_requires


if __name__ == "__main__":
setup(
name='ouster-sdk',
Expand Down
16 changes: 8 additions & 8 deletions python/src/ouster/sdk/examples/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ def filter_3d_by_range_and_azimuth(hostname: str,
plt.figure()
ax = plt.axes(projection='3d')
r = 3
ax.set_xlim3d([-r, r])
ax.set_ylim3d([-r, r])
ax.set_zlim3d([-r, r])
ax.set_xlim3d([-r, r]) # type: ignore
ax.set_ylim3d([-r, r]) # type: ignore
ax.set_zlim3d([-r, r]) # type: ignore

plt.title("Filtered 3D Points from {}".format(hostname))

Expand All @@ -155,7 +155,7 @@ def filter_3d_by_range_and_azimuth(hostname: str,
# [doc-etag-filter-3d]

[x, y, z] = [c.flatten() for c in np.dsplit(xyz_filtered, 3)]
ax.scatter(x, y, z, c=z / max(z), s=0.2)
ax.scatter(x, y, z, c=z / max(z), s=0.2) # type: ignore
plt.show()


Expand Down Expand Up @@ -210,9 +210,9 @@ def plot_xyz_points(hostname: str, lidar_port: int = 7502) -> None:
plt.figure()
ax = plt.axes(projection='3d')
r = 3
ax.set_xlim3d([-r, r])
ax.set_ylim3d([-r, r])
ax.set_zlim3d([-r, r])
ax.set_xlim3d([-r, r]) # type: ignore
ax.set_ylim3d([-r, r]) # type: ignore
ax.set_zlim3d([-r, r]) # type: ignore

plt.title("3D Points from {}".format(hostname))

Expand All @@ -224,7 +224,7 @@ def plot_xyz_points(hostname: str, lidar_port: int = 7502) -> None:

# graph xyz
[x, y, z] = [c.flatten() for c in np.dsplit(xyz, 3)]
ax.scatter(x, y, z, c=z / max(z), s=0.2)
ax.scatter(x, y, z, c=z / max(z), s=0.2) # type: ignore
plt.show()


Expand Down
8 changes: 4 additions & 4 deletions python/src/ouster/sdk/examples/pcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def pcap_display_xyz_points(source: client.PacketSource,
plt.figure()
ax = plt.axes(projection='3d')
r = 6
ax.set_xlim3d([-r, r])
ax.set_ylim3d([-r, r])
ax.set_zlim3d([-r, r])
ax.set_xlim3d([-r, r]) # type: ignore
ax.set_ylim3d([-r, r]) # type: ignore
ax.set_zlim3d([-r, r]) # type: ignore

plt.title("3D Points XYZ for scan")

Expand All @@ -107,7 +107,7 @@ def pcap_display_xyz_points(source: client.PacketSource,
key = scan.field(client.ChanField.REFLECTIVITY)

[x, y, z] = [c.flatten() for c in np.dsplit(xyz, 3)]
ax.scatter(x, y, z, c=normalize(key.flatten()), s=0.2)
ax.scatter(x, y, z, c=normalize(key.flatten()), s=0.2) # type: ignore
plt.show()
# [doc-etag-pcap-plot-xyz-points]

Expand Down
1 change: 1 addition & 0 deletions tests/cartesian_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <gtest/gtest.h>

#include <Eigen/Eigen>
#include <iomanip>
#include <numeric>
#include <random>

Expand Down
1 change: 1 addition & 0 deletions tests/parsing_benchmark_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <gtest/gtest.h>

#include <iomanip>
#include <numeric>
#include <random>

Expand Down
Loading