forked from conan-io/examples2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_test_example.py
29 lines (23 loc) · 961 Bytes
/
ci_test_example.py
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
import os
import platform
import shutil
from test.examples_tools import run
# ############# Example ################
print("\n- Use the BazelToolchain and BazelDeps generators -\n")
if platform.system() != "Linux":
print(f"SKIPPED TEST BECAUSE BAZEL IS NOT INSTALLED IN {platform.system()} PLATFORM YET.")
exit(0)
# Add bazel path
os.environ["PATH"] += os.pathsep + '/usr/share/bazel-6.3.2/bin'
output = run("bazel --version")
try:
print("\n- Conan installing all the files into the build folder -\n")
run("conan install . --build=missing")
print("\n- Running bazel build command to compile the demo bazel target -\n")
run("bazel --bazelrc=./conan/conan_bzl.rc build --config=conan-config //main:demo")
print("\n- Running the application 'demo' created -\n")
run("./bazel-bin/main/demo")
finally:
# Remove all the bazel symlinks and clean its cache
run("bazel clean")
shutil.rmtree("conan", ignore_errors=True)