forked from trueagi-io/hyperon-experimental
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (154 loc) · 5.07 KB
/
common.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# This reusable workflow builds the project and tests it.
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
name: common
on:
workflow_call:
inputs:
python-version:
description: "A version of a python interpreter to use"
default: "3.7"
required: false
type: string
os:
description: "A container which is used to make a build"
default: "ubuntu-22.04"
required: false
type: string
cmake-version:
description: "CMake version to use"
default: "3.24.x"
required: false
type: string
env:
CMAKE_MULTIBUILD_CONFIG: "${{ startsWith(inputs.os, 'windows') && '--config Debug' || '' }}"
CMAKE_GIT_EXCLUDE: "${{ startsWith(inputs.os, 'windows') && '-DGIT=OFF' || '' }}"
jobs:
build-all:
runs-on: ${{ inputs.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Rust stable
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
- name: Build Rust library
working-directory: ./lib
run: |
cargo check
cargo build
- name: Install cbindgen
uses: actions-rs/[email protected]
with:
command: install
args: cbindgen
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ inputs.cmake-version }}
- name: Install Conan
uses: turtlebrowser/[email protected]
with:
version: "2.5.0"
- name: Setup Conan profile
run: |
conan profile detect --force
shell: bash
- name: Test Rust library
run: RUST_LOG=hyperon=debug cargo test
shell: bash
- name: Print environment
if: ${{ startsWith(inputs.os, 'windows') }}
run: |
echo "uname -a"
uname -a
echo "rustc --version"
rustc --version
echo "cbindgen --version"
cbindgen --version
echo "python --version"
which python
python --version
python -c "import platform; print(platform.platform())"
echo "python3 --version"
which python3
python3 --version
python3 -c "import platform; print(platform.platform())"
echo "conan --version"
conan --version
# conan_python=$( head -1 $(which conan) | cut -c 3- )
# echo "conan Python: $conan_python"
# echo -n "conan Python platform: "
# $conan_python -c "import platform; print(platform.platform())"
echo "conan profile show"
conan profile show
# echo "gcc --version"
# gcc --version
# echo "g++ --version"
# g++ --version
echo "cmake --version"
cmake --version
file $(which cmake)
echo "make --version"
make --version
file $(which make)
shell: bash
- name: Print environment
if: ${{ !startsWith(inputs.os, 'windows') }}
run: |
echo "uname -a"
uname -a
echo "rustc --version"
rustc --version
echo "cbindgen --version"
cbindgen --version
echo "python --version"
which python
python --version
python -c "import platform; print(platform.platform())"
echo "python3 --version"
which python3
python3 --version
python3 -c "import platform; print(platform.platform())"
echo "conan --version"
conan --version
conan_python=$( head -1 $(which conan) | cut -c 3- )
echo "conan Python: $conan_python"
echo -n "conan Python platform: "
$conan_python -c "import platform; print(platform.platform())"
echo "conan profile show"
conan profile show
echo "gcc --version"
gcc --version
echo "g++ --version"
g++ --version
echo "cmake --version"
cmake --version
file $(which cmake)
echo "make --version"
make --version
file $(which make)
shell: bash
- name: Setup C API build
run: |
mkdir -p build
cd build
# specify C compiler as conan could not find it automatically
# see https://github.com/conan-io/conan/issues/4322
cmake -DPython3_EXECUTABLE=`which python` -DCMAKE_C_COMPILER=gcc ${{ env.CMAKE_GIT_EXCLUDE }} ..
shell: bash
- name: Build C API
working-directory: ./build
run: cmake --build . ${{ env.CMAKE_MULTIBUILD_CONFIG }}
shell: bash
- name: Test C API
working-directory: ./build
run: cmake --build . --target check ${{ env.CMAKE_MULTIBUILD_CONFIG }}
shell: bash