Skip to content

Commit a086685

Browse files
authored
Add support for successful conda builds (#650)
* feat: support conda env build (for at least basic cmake) * ci: Create action for pixi/conda build * fix: Ensure int definitiions are defined * fix: finding correct include path linux * fix: add missing slash to test path * fix: windows test command in CI
1 parent 25ef945 commit a086685

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

.github/workflows/pixi.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Pixi (conda)
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7+
# Note if this value is changed, has to be manually updated in the `windows-latest` tests_command
8+
BUILD_TYPE: Release
9+
10+
jobs:
11+
pixi_conda_build:
12+
strategy:
13+
matrix:
14+
include:
15+
- os: windows-latest
16+
shell: "pwsh -Login {0}"
17+
pixi_install: "iwr -useb https://pixi.sh/install.ps1 | iex"
18+
build_depend: vs2022_win-64=19.*
19+
tests_command: "'PATH=\\\"$PATH;build/Release\\\" build/tests/Release/behaviortree_cpp_test.exe'"
20+
- os: ubuntu-latest
21+
shell: "bash -el {0}"
22+
pixi_install: "curl -fsSL https://pixi.sh/install.sh | bash"
23+
build_depend: "gxx=12.2.*"
24+
tests_command: "./build/tests/behaviortree_cpp_test"
25+
runs-on: ${{ matrix.os }}
26+
defaults:
27+
run:
28+
shell: ${{ matrix.shell }}
29+
steps:
30+
# Pixi is the tool used to create/manage conda environment
31+
- name: Set up pixi
32+
run: |
33+
${{ matrix.pixi_install }}
34+
- name: Setup windows path
35+
if: "startsWith(runner.os, 'windows')"
36+
run: echo "C:\Users\runneradmin\AppData\Local\pixi\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
37+
- name: Make pixi workspace
38+
run: |
39+
pixi init build-env
40+
- name: Install dependencies
41+
working-directory: ${{github.workspace}}/build-env
42+
run: |
43+
pixi add cmake zeromq=4.3.4 gtest=1.12.* gmock=1.12.* sqlite=3.40.* ${{ matrix.build-depend }}
44+
pixi install
45+
- name: Create Build Directory
46+
working-directory: ${{github.workspace}}/build-env
47+
run: mkdir build
48+
- uses: actions/checkout@v3
49+
with:
50+
path: build-env/BehaviorTree.CPP
51+
- name: Build
52+
working-directory: ${{github.workspace}}/build-env
53+
run: |
54+
pixi task add build "cd build; cmake ../BehaviorTree.CPP -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}; cmake --build . --parallel --config ${{env.BUILD_TYPE}}"
55+
pixi run build
56+
- name: Run tests
57+
working-directory: ${{github.workspace}}/build-env
58+
run: |
59+
pixi task add tests ${{ matrix.tests_command }}
60+
pixi run tests
61+
62+
63+
64+

3rdparty/minitrace/minitrace.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#include <unistd.h>
2828
#endif
2929

30+
#define __STDC_FORMAT_MACROS
31+
#include <inttypes.h>
32+
3033
#include "minitrace.h"
3134

3235
#ifdef __GNUC__

cmake/FindZeroMQ.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ else (ZeroMQ_LIBRARIES AND ZeroMQ_INCLUDE_DIRS)
2929
find_path(ZeroMQ_INCLUDE_DIR
3030
NAMES
3131
zmq.h
32+
HINTS
33+
"$ENV{CONDA_PREFIX}/include"
3234
PATHS
3335
/usr/include
3436
/usr/local/include
@@ -38,6 +40,7 @@ else (ZeroMQ_LIBRARIES AND ZeroMQ_INCLUDE_DIRS)
3840
find_library(ZeroMQ_LIBRARY
3941
NAMES
4042
zmq
43+
libzmq
4144
PATHS
4245
/usr/lib
4346
/usr/local/lib

cmake/conan_build.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
33
if(BTCPP_GROOT_INTERFACE)
44
find_package(ZeroMQ REQUIRED)
55
list(APPEND BTCPP_EXTRA_LIBRARIES ${ZeroMQ_LIBRARIES})
6+
list(APPEND BTCPP_EXTRA_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIRS})
67
message(STATUS "ZeroMQ_LIBRARIES: ${ZeroMQ_LIBRARIES}")
78
endif()
89

0 commit comments

Comments
 (0)