Skip to content

Commit 4eff996

Browse files
authored
Add macos CI (#27)
1 parent 6de7d59 commit 4eff996

File tree

7 files changed

+101
-44
lines changed

7 files changed

+101
-44
lines changed

.github/workflows/clang_format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- 'dev**'
78
pull_request:
89
schedule:
910
- cron: '0 5 * * *'

.github/workflows/cmake_format.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- 'dev**'
78
pull_request:
89
schedule:
910
- cron: '0 5 * * *'
@@ -13,7 +14,7 @@ jobs:
1314
name: CMake-Format
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v4
1718

1819
- name: Run CMake format
1920
run: |

.github/workflows/mac.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: MacOS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'dev**'
8+
tags:
9+
- '*'
10+
pull_request:
11+
schedule:
12+
- cron: '0 5 * * *'
13+
14+
# allow manually starting this workflow
15+
workflow_dispatch:
16+
17+
env:
18+
VCPKG_PKGS: >-
19+
boost-dll boost-filesystem boost-algorithm
20+
boost-smart-ptr gtest
21+
22+
jobs:
23+
macos_ci:
24+
name: MacOS
25+
runs-on: macos-14
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
path: workspace/src/plugin_loader
30+
31+
- name: vcpkg build
32+
uses: johnwason/vcpkg-action@v7
33+
id: vcpkg
34+
with:
35+
pkgs: ${{ env.VCPKG_PKGS }}
36+
triplet: arm64-osx-release
37+
cache-key: build-macos-14
38+
token: ${{ github.token }}
39+
- name: install-depends
40+
shell: bash
41+
run: |
42+
python3 -m pip install vcstool --break-system-packages -q
43+
python3 -m pip install colcon-common-extensions --break-system-packages -q
44+
45+
- name: update environment
46+
shell: bash
47+
run: |
48+
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GITHUB_WORKSPACE/vcpkg/installed/arm64-osx-release/lib" >> "$GITHUB_ENV"
49+
echo "CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE\vcpkg\installed\arm64-osx-release" >> "$GITHUB_ENV"
50+
51+
- name: Build and Tests
52+
uses: johnwason/colcon-action@macos
53+
with:
54+
ccache-prefix: ${{ matrix.distro }}
55+
vcs-file: plugin_loader/dependencies.repos
56+
upstream-args: --cmake-args -G "Ninja" -DVCPKG_TARGET_TRIPLET=arm64-osx-release -DCMAKE_BUILD_TYPE=Release
57+
target-path: workspace/src
58+
target-args: --cmake-args -G "Ninja" -DVCPKG_TARGET_TRIPLET=arm64-osx-release -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DENABLE_CPACK=ON
59+
60+
- name: Package
61+
if: ${{ github.event_name == 'release' && github.event.action == 'released' }}
62+
working-directory: workspace/build/boost_plugin_loader
63+
run: |
64+
cpack --config CPackConfig.cmake
65+
cp ./*.nupkg ${{ github.workspace }}/artifacts
66+
cp ./*.tar.xz ${{ github.workspace }}/artifacts
67+

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- 'dev**'
78
pull_request:
89
schedule:
910
- cron: '0 5 * * *'

.github/workflows/windows_2022.yml

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- 'dev**'
78
tags:
89
- '*'
910
pull_request:
@@ -23,62 +24,44 @@ jobs:
2324
name: Windows-2022
2425
runs-on: windows-2022
2526
steps:
26-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2728
with:
2829
path: workspace/src/plugin_loader
29-
30-
- name: checkout-vcpkg
31-
uses: actions/checkout@v2
30+
31+
- name: configure-msvc
32+
uses: ilammy/msvc-dev-cmd@v1
3233
with:
33-
path: vcpkg
34-
repository: microsoft/vcpkg
35-
36-
- name: bootstrap-vcpkg
37-
working-directory: vcpkg
38-
run: bootstrap-vcpkg.bat
39-
40-
- name: vcpkg-dry-run
41-
working-directory: vcpkg
42-
shell: cmd
43-
run: |
44-
vcpkg install --dry-run --triplet x64-windows ${{ env.VCPKG_PKGS }} > vcpkg_dry_run.txt
34+
arch: x64
4535

46-
- name: cache-vcpkg-archives
47-
if: startsWith(github.ref, 'refs/tags/v') != true
48-
id: cache-vcpkg-archives
49-
uses: pat-s/always-upload-cache@v3
36+
- name: vcpkg build
37+
uses: johnwason/vcpkg-action@v7
38+
id: vcpkg
5039
with:
51-
path: C:\Users\runneradmin\AppData\Local\vcpkg\archives
52-
key: ${{ runner.os }}-x64-vcpkg-${{ hashFiles('vcpkg/vcpkg_dry_run.txt') }}-main
53-
40+
pkgs: ${{ env.VCPKG_PKGS }}
41+
triplet: x64-windows-release
42+
cache-key: build-windows-2022
43+
token: ${{ github.token }}
5444
- name: install-depends
5545
shell: cmd
5646
run: |
57-
vcpkg integrate install
5847
python -m pip install vcstool -q
5948
python -m pip install colcon-common-extensions -q
6049
python -m pip install ninja -q
61-
vcpkg install --triplet x64-windows ${{ env.VCPKG_PKGS }}
6250
63-
- name: configure-msvc
64-
uses: ilammy/msvc-dev-cmd@v1
65-
with:
66-
arch: x64
67-
68-
- name: build-workspace
69-
working-directory: workspace
70-
shell: cmd
51+
- name: update environment
52+
shell: bash
7153
run: |
72-
vcs import --input "${{ github.workspace }}/workspace/src/plugin_loader/dependencies.repos" src/
73-
colcon build --event-handlers console_direct+ --cmake-args -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DENABLE_CPACK=ON
74-
if %ERRORLEVEL% GEQ 1 exit 1
54+
echo "PATH=${{ env.PATH }};$GITHUB_WORKSPACE\vcpkg\installed\x64-windows-release\bin" >> "$GITHUB_ENV"
55+
echo "CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE\vcpkg\installed\x64-windows-release" >> "$GITHUB_ENV"
7556
76-
- name: run-test
77-
working-directory: workspace
78-
shell: cmd
79-
run: |
80-
colcon test --event-handlers console_direct+ --return-code-on-test-failure
81-
colcon test-result --verbose
57+
- name: Build and Tests
58+
uses: tesseract-robotics/colcon-action@v11
59+
with:
60+
ccache-prefix: ${{ matrix.distro }}
61+
vcs-file: plugin_loader/dependencies.repos
62+
upstream-args: --cmake-args -G "Ninja" -DVCPKG_TARGET_TRIPLET=x64-windows-release -DCMAKE_BUILD_TYPE=Release
63+
target-path: workspace/src
64+
target-args: --cmake-args -G "Ninja" -DVCPKG_TARGET_TRIPLET=x64-windows-release -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DENABLE_CPACK=ON
8265

8366
- name: Package
8467
if: ${{ github.event_name == 'release' && github.event.action == 'released' }}

src/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ std::vector<std::string> getAllAvailableSections(const boost::dll::shared_librar
8888
if (include_hidden)
8989
return false;
9090

91-
return (section.substr(0, 1) == ".");
91+
return (section.substr(0, 1) == ".") || (section.substr(0, 2) == "__");
9292
};
9393

9494
sections.erase(std::remove_if(sections.begin(), sections.end(), search_fn), sections.end());

test/plugin_loader_unit.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ TEST(BoostPluginLoaderUnit, Utils) // NOLINT
100100
EXPECT_EQ(s.size(), 2);
101101
}
102102

103+
#ifndef __APPLE__
103104
{
104105
const std::optional<boost::dll::shared_library> lib =
105106
loadLibrary(boost::filesystem::path("does_not_exist") / lib_name);
106107
EXPECT_FALSE(lib.has_value());
107108
}
109+
#endif
108110

109111
{
110112
const std::optional<boost::dll::shared_library> lib = loadLibrary(boost::filesystem::path(lib_dir) / "does_not_"
@@ -237,6 +239,7 @@ TEST(BoostPluginLoaderUnit, LoadTestPlugin) // NOLINT
237239
}
238240
#endif
239241

242+
#ifndef __APPLE__
240243
{
241244
PluginLoader plugin_loader;
242245
plugin_loader.search_system_folders = false;
@@ -248,6 +251,7 @@ TEST(BoostPluginLoaderUnit, LoadTestPlugin) // NOLINT
248251
// NOLINTNEXTLINE(cppcoreguidelines-avoid-goto)
249252
EXPECT_ANY_THROW(plugin_loader.createInstance<TestPluginBase>("plugin"));
250253
}
254+
#endif
251255

252256
{
253257
PluginLoader plugin_loader;

0 commit comments

Comments
 (0)