Skip to content

Commit 9a8d277

Browse files
authored
Update with up-transport-vsomeip-rust build changes (#60)
* Add shell script to set environment variables, updated CI workflows to use it. * Update up-transport-vsomeip-rust and up-streamer-rust to use up-rust 0.3.0 * Update up-transport-mqtt5 to 0.2.0 * Add necessary piping through of environment variables for paths to C++ stdlib * Update to published up-transport-vsomeip 0.4.1 * Update README.md on how to build using either config.toml or envsetup.sh
1 parent 9e60039 commit 9a8d277

File tree

7 files changed

+256
-30
lines changed

7 files changed

+256
-30
lines changed

.github/workflows/bundled-lint-and-test.yaml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ name: Lint and Test - Bundled
1515

1616
env:
1717
VSOMEIP_INSTALL_PATH: vsomeip-install
18-
GENERIC_CPP_STDLIB_PATH: /usr/include/c++/11
19-
ARCH_SPECIFIC_CPP_STDLIB_PATH: /usr/include/x86_64-linux-gnu/c++/11
2018

2119
on:
2220
push:
@@ -35,9 +33,35 @@ concurrency:
3533

3634
jobs:
3735

36+
set-env:
37+
name: Set environment variables
38+
runs-on: ubuntu-22.04
39+
40+
outputs:
41+
arch_specific_cpp_stdlib_path: ${{ steps.set_env.outputs.arch_specific_cpp_stdlib_path }}
42+
generic_cpp_stdlib_path: ${{ steps.set_env.outputs.generic_cpp_stdlib_path }}
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Add execute permissions for envsetup
48+
run: chmod +x build/envsetup.sh
49+
50+
- name: Set stdlib paths dynamically
51+
id: set_env
52+
run: |
53+
source ./build/envsetup.sh highest
54+
echo "arch_specific_cpp_stdlib_path=$ARCH_SPECIFIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT
55+
echo "generic_cpp_stdlib_path=$GENERIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT
56+
3857
lint:
3958
name: Lint
40-
runs-on: ubuntu-latest
59+
runs-on: ubuntu-22.04
60+
needs: set-env
61+
62+
env:
63+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
64+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
4165

4266
steps:
4367
- uses: actions/checkout@v4
@@ -48,10 +72,14 @@ jobs:
4872
- name: Set environment variables
4973
run: |
5074
echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV
75+
env
5176
5277
- name: Print environment variables for debugging
5378
run: |
5479
echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}"
80+
echo "GENERIC_CPP_STDLIB_PATH: ${{ env.GENERIC_CPP_STDLIB_PATH }}"
81+
echo "ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ env.ARCH_SPECIFIC_CPP_STDLIB_PATH }}"
82+
env
5583
5684
- name: Ensure vsomeip install path exists
5785
run: |
@@ -81,7 +109,12 @@ jobs:
81109

82110
test:
83111
name: Test
84-
runs-on: ubuntu-latest
112+
runs-on: ubuntu-22.04
113+
needs: set-env
114+
115+
env:
116+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
117+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
85118

86119
steps:
87120
- uses: actions/checkout@v4
@@ -146,7 +179,12 @@ jobs:
146179

147180
build-docs:
148181
name: Build documentation
149-
runs-on: ubuntu-latest
182+
runs-on: ubuntu-22.04
183+
needs: set-env
184+
185+
env:
186+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
187+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
150188

151189
steps:
152190
- uses: actions/checkout@v4

.github/workflows/unbundled-lint-and-test.yaml

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ env:
1919
VSOMEIP_SOURCE_PATH: vsomeip-src
2020
VSOMEIP_INSTALL_PATH: vsomeip-install
2121

22-
GENERIC_CPP_STDLIB_PATH: /usr/include/c++/11
23-
ARCH_SPECIFIC_CPP_STDLIB_PATH: /usr/include/x86_64-linux-gnu/c++/11
24-
2522
on:
2623
push:
2724
branches: [ main ]
@@ -38,10 +35,38 @@ concurrency:
3835
cancel-in-progress: true
3936

4037
jobs:
38+
39+
set-env:
40+
name: Set environment variables
41+
runs-on: ubuntu-22.04
42+
43+
outputs:
44+
arch_specific_cpp_stdlib_path: ${{ steps.set_env.outputs.arch_specific_cpp_stdlib_path }}
45+
generic_cpp_stdlib_path: ${{ steps.set_env.outputs.generic_cpp_stdlib_path }}
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Add execute permissions for envsetup
51+
run: chmod +x build/envsetup.sh
52+
53+
- name: Set stdlib paths dynamically
54+
id: set_env
55+
run: |
56+
source ./build/envsetup.sh highest
57+
echo "arch_specific_cpp_stdlib_path=$ARCH_SPECIFIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT
58+
echo "generic_cpp_stdlib_path=$GENERIC_CPP_STDLIB_PATH" >> $GITHUB_OUTPUT
59+
4160
obtain_and_build_vsomeip:
61+
needs: set-env
4262
runs-on: ubuntu-22.04
4363
outputs:
4464
cache_key: ${{ steps.generate_cache_key.outputs.CACHE_KEY }}
65+
66+
env:
67+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
68+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
69+
4570
steps:
4671
- name: Checkout repository
4772
uses: actions/checkout@v4
@@ -52,14 +77,18 @@ jobs:
5277
echo "VSOMEIP_SOURCE_PATH=${{ github.workspace }}/${{ env.VSOMEIP_SOURCE_PATH }}" >> $GITHUB_ENV
5378
echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV
5479
echo "VSOMEIP_SOURCE_PATH_WITH_WILDCARD=${{ github.workspace }}/${{ env.VSOMEIP_SOURCE_PATH }}/*" >> $GITHUB_ENV
80+
env
5581
5682
- name: Print environment variables for debugging
5783
run: |
5884
echo "VSOMEIP_SOURCE_TARBALL: ${{ env.VSOMEIP_SOURCE_TARBALL }}"
5985
echo "VSOMEIP_SOURCE_PATH: ${{ env.VSOMEIP_SOURCE_PATH }}"
6086
echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}"
6187
echo "VSOMEIP_SOURCE_PATH_WITH_WILDCARD: ${{ env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD }}"
62-
88+
echo "GENERIC_CPP_STDLIB_PATH: ${{ env.GENERIC_CPP_STDLIB_PATH }}"
89+
echo "ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ env.ARCH_SPECIFIC_CPP_STDLIB_PATH }}"
90+
env
91+
6392
- name: Download tarball
6493
run: |
6594
wget -O vsomeip-source.tar.gz $VSOMEIP_SOURCE_TARBALL
@@ -101,7 +130,7 @@ jobs:
101130
102131
- name: Install dependencies
103132
if: steps.cache-vsomeip.outputs.cache-hit != 'true'
104-
run: sudo apt-get install -y build-essential cmake libboost-all-dev
133+
run: sudo apt-get install -y build-essential cmake libboost-all-dev doxygen asciidoc
105134

106135
- name: Build vsomeip
107136
if: steps.cache-vsomeip.outputs.cache-hit != 'true'
@@ -119,9 +148,13 @@ jobs:
119148

120149
lint:
121150
name: Lint
122-
needs: obtain_and_build_vsomeip
151+
needs:
152+
- set-env
153+
- obtain_and_build_vsomeip
123154
runs-on: ubuntu-22.04
124155
env:
156+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
157+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
125158
CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }}
126159

127160
steps:
@@ -178,9 +211,14 @@ jobs:
178211

179212
test:
180213
name: Test
181-
needs: obtain_and_build_vsomeip
214+
needs:
215+
- set-env
216+
- obtain_and_build_vsomeip
182217
runs-on: ubuntu-22.04
218+
183219
env:
220+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
221+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
184222
CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }}
185223

186224
steps:
@@ -257,9 +295,13 @@ jobs:
257295

258296
build-docs:
259297
name: Build documentation
260-
needs: obtain_and_build_vsomeip
298+
needs:
299+
- obtain_and_build_vsomeip
300+
- set-env
261301
runs-on: ubuntu-22.04
262302
env:
303+
ARCH_SPECIFIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.arch_specific_cpp_stdlib_path }}
304+
GENERIC_CPP_STDLIB_PATH: ${{ needs.set-env.outputs.generic_cpp_stdlib_path }}
263305
CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }}
264306

265307
steps:

Cargo.lock

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ serde_json = { version = "1.0.94" }
4141
uuid = { version = "1.7.0" }
4242
tokio = { version = "1.35.1", default-features = false, features = ["rt", "rt-multi-thread", "sync", "time"] }
4343
protobuf = { version = "3.3", features = ["with-bytes"] }
44-
up-rust = { version = "0.2.0", default-features = false }
45-
up-transport-zenoh = { version = "0.3.0" }
46-
up-transport-vsomeip = { git = "https://github.com/eclipse-uprotocol/up-transport-vsomeip-rust.git", tag = "v0.3.0", default-features = false }
47-
up-transport-mqtt5 = { version = "0.1.0" }
44+
up-rust = { version = "0.3.0", default-features = false }
45+
up-transport-zenoh = { version = "0.4.0" }
46+
up-transport-vsomeip = { version = "0.4.1", default-features = false }
47+
up-transport-mqtt5 = { version = "0.2.0" }
4848
zenoh = { version = "1.0.0", features = ["default", "plugins"] }
4949
zenoh-core = { version = "1.0.0" }
5050
zenoh-plugin-trait = { version = "1.0.0" }

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ cargo build
3333

3434
You'll need to use the feature flags `vsomeip-transport`, `zenoh-transport` or `mqtt-transport` depending on which implementation you want to build. You then also have the option of including your own vsomeip or using one bundled in `up-transport-vsomeip`.
3535

36-
For the bundled option, set the following environment variables (for example in your .cargo/config.toml file):
36+
For the bundled option, you have two options to set environment variables needed.
37+
38+
#### Using `config.toml`
39+
40+
Set the following environment variables (for example in your .cargo/config.toml file):
3741

3842
```toml
3943
[env]
@@ -45,6 +49,16 @@ ARCH_SPECIFIC_CPP_STDLIB_PATH=<path to your c++ stdlib (for example /usr/include
4549
cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport
4650
```
4751

52+
#### Using `build/envsetup.sh`
53+
54+
Alternatively, you may run:
55+
56+
```shell
57+
build/envsetup.sh
58+
```
59+
60+
to set the environment variables.
61+
4862
The environment variables are necessary because of a workaround done in `up-transport-vsomeip` due to not being able to figure out another way to compile vsomeip without them. (If you can figure out how to avoid this, I'm all ears!)
4963

5064
Please reference the documentation for [vsomeip-sys](https://github.com/eclipse-uprotocol/up-transport-vsomeip-rust/tree/main/vsomeip-sys) for more details on:

0 commit comments

Comments
 (0)