Skip to content

Commit

Permalink
Updating CI with macos build
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit1603 committed Sep 30, 2023
1 parent 6908546 commit 7bb28d0
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 105 deletions.
130 changes: 59 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Main
on:
pull_request:
branches: [main]
# pull_request:
# branches: [main]
push:
branches: [main]
branches: [Mac_Build]
release:
types: [published]
schedule:
Expand All @@ -21,38 +21,38 @@ jobs:
fail-fast: false
matrix:
include:
- name: ubu22-gcc12-clang-repl-17
os: ubuntu-latest
compiler: gcc-12
clang-runtime: '17'
cling: Off
cppyy: Off
extra_cmake_options: '-DLLVM_USE_LINKER=lld'
# - name: ubu22-gcc12-clang-repl-17
# os: ubuntu-latest
# compiler: gcc-12
# clang-runtime: '17'
# cling: Off
# cppyy: Off
# extra_cmake_options: '-DLLVM_USE_LINKER=lld'

- name: ubu22-gcc9-clang-repl-16
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '16'
cling: Off
cppyy: Off
coverage: true
extra_cmake_options: '-DLLVM_USE_LINKER=lld'
# - name: ubu22-gcc9-clang-repl-16
# os: ubuntu-22.04
# compiler: gcc-9
# clang-runtime: '16'
# cling: Off
# cppyy: Off
# coverage: true
# extra_cmake_options: '-DLLVM_USE_LINKER=lld'

- name: ubu22-gcc9-clang13-cling
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '13'
cling: On
cppyy: Off
extra_cmake_options: '-DLLVM_USE_LINKER=lld'
# - name: ubu22-gcc9-clang13-cling
# os: ubuntu-22.04
# compiler: gcc-9
# clang-runtime: '13'
# cling: On
# cppyy: Off
# extra_cmake_options: '-DLLVM_USE_LINKER=lld'

- name: ubu22-gcc9-clang13-cling-cppyy
os: ubuntu-22.04
compiler: gcc-9
clang-runtime: '13'
cling: On
cppyy: On
extra_cmake_options: '-DLLVM_USE_LINKER=lld'
# - name: ubu22-gcc9-clang13-cling-cppyy
# os: ubuntu-22.04
# compiler: gcc-9
# clang-runtime: '13'
# cling: On
# cppyy: On
# extra_cmake_options: '-DLLVM_USE_LINKER=lld'

- name: osx-clang-clang-repl-16
os: macos-latest
Expand Down Expand Up @@ -93,6 +93,11 @@ jobs:
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
if [[ "${os}" == "macos*" ]]; then
echo "ncpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
else
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
fi
- name: Setup compiler on Linux
if: runner.os == 'Linux'
Expand Down Expand Up @@ -164,7 +169,6 @@ jobs:
- name: Build LLVM/Cling on Unix if the cache is invalid
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
os="${{ matrix.os }}"
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "${cling_on}" == "ON" ]]; then
git clone --depth=1 https://github.com/root-project/cling.git
Expand All @@ -176,7 +180,7 @@ jobs:
# Apply patches
echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:"
# Adjust the find command for macOS
# Finding patch and applying it
patch_dir="../patches/llvm"
patch_pattern="clang${{ matrix.clang-runtime }}-*.patch"

Expand All @@ -199,17 +203,10 @@ jobs:
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
../llvm
if [[ "${os}" == "macos*" ]]; then
cmake --build . --target clang --parallel $(sysctl -n hw.physicalcpu)
cmake --build . --target cling --parallel $(sysctl -n hw.physicalcpu)
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
cmake --build . --target gtest_main --parallel $(sysctl -n hw.physicalcpu)
else
cmake --build . --target clang --parallel $(nproc --all)
cmake --build . --target cling --parallel $(nproc --all)
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
cmake --build . --target gtest_main --parallel $(nproc --all)
fi
cmake --build . --target clang --parallel ${{ env.ncpus }}
cmake --build . --target cling --parallel ${{ env.ncpus }}
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
cmake --build . --target gtest_main --parallel ${{ env.ncpus }}
else
cmake -DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
Expand All @@ -220,11 +217,7 @@ jobs:
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
../llvm
if [[ "${os}" == "macos*" ]]; then
cmake --build . --target clang clang-repl --parallel $(sysctl -n hw.physicalcpu)
else
cmake --build . --target clang clang-repl --parallel $(nproc --all)
fi
cmake --build . --target clang clang-repl --parallel ${{ env.ncpus }}
fi
cd ../../

Expand Down Expand Up @@ -266,32 +259,27 @@ jobs:
export CPPINTEROP_BUILD_DIR=$PWD
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
if [[ "${cling_on}" == "ON" ]]; then
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DUSE_CLING=ON \
-DUSE_REPL=OFF \
-DCling_DIR=$LLVM_BUILD_DIR/tools/cling \
-DLLVM_DIR=$LLVM_BUILD_DIR \
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${CODE_COVERAGE} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=ON \
-DUSE_REPL=OFF \
-DCling_DIR=$LLVM_BUILD_DIR/tools/cling \
-DLLVM_DIR=$LLVM_BUILD_DIR \
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
../
else
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DUSE_CLING=OFF \
-DUSE_REPL=ON \
-DLLVM_DIR=$LLVM_BUILD_DIR \
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${CODE_COVERAGE} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=OFF \
-DUSE_REPL=ON \
-DLLVM_DIR=$LLVM_BUILD_DIR \
-DBUILD_SHARED_LIBS=ON \
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
-DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \
../
fi
os="${{ matrix.os }}"
if [[ "${os}" == "macos*" ]]; then
cmake --build . --target check-cppinterop --parallel $(sysctl -n hw.physicalcpu)
else
cmake --build . --target check-cppinterop --parallel $(nproc --all)
fi
cmake --build . --target check-cppinterop --parallel ${{ env.ncpus }}
cppyy_on=$(echo "${{ matrix.cppyy }}" | tr '[:lower:]' '[:upper:]')
if [[ ("${cppyy_on}" != "ON") && ("${os}" = "ubuntu*") ]]; then
valgrind --track-origins=yes --error-exitcode=1 unittests/CppInterOp/CppInterOpTests 2>&1 >/dev/null
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: clang-format

on:
pull_request:
paths:
- '**.h'
- '**.cpp'
# pull_request:
# paths:
# - '**.h'
# - '**.cpp'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/clang-tidy-review-post.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Post clang-tidy review comments

on:
workflow_run:
workflows: ["clang-tidy-review"]
types:
- completed
# workflow_run:
# workflows: ["clang-tidy-review"]
# types:
# - completed

permissions:
checks: write
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: clang-tidy-review

on:
pull_request:
paths:
- '**.h'
- '**.cpp'
# pull_request:
# paths:
# - '**.h'
# - '**.cpp'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
Expand Down
26 changes: 20 additions & 6 deletions unittests/CppInterOp/FunctionReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,11 @@ TEST(FunctionReflectionTest, IsStaticMethod) {
EXPECT_TRUE(Cpp::IsStaticMethod(SubDecls[2]));
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_GetFunctionAddress) {
#else
TEST(FunctionReflectionTest, GetFunctionAddress) {
#endif
std::vector<Decl*> Decls, SubDecls;
std::string code = "int f1(int i) { return i * i; }";

Expand All @@ -537,7 +540,6 @@ TEST(FunctionReflectionTest, GetFunctionAddress) {
address << Cpp::GetFunctionAddress(Decls[0]);
EXPECT_EQ(address.str(), output);
}
#endif

TEST(FunctionReflectionTest, IsVirtualMethod) {
std::vector<Decl*> Decls, SubDecls;
Expand All @@ -558,8 +560,11 @@ TEST(FunctionReflectionTest, IsVirtualMethod) {
EXPECT_FALSE(Cpp::IsVirtualMethod(SubDecls[3])); // y()
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_JitCallAdvanced) {
#else
TEST(FunctionReflectionTest, JitCallAdvanced) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
typedef struct _name {
Expand All @@ -580,7 +585,11 @@ TEST(FunctionReflectionTest, JitCallAdvanced) {
Cpp::Destruct(object, Decls[1]);
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_GetFunctionCallWrapper) {
#else
TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
int f1(int i) { return i * i; }
Expand Down Expand Up @@ -661,7 +670,6 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
output = testing::internal::GetCapturedStdout();
EXPECT_EQ(output, "Dtor Called\n");
}
#endif

TEST(FunctionReflectionTest, IsConstMethod) {
std::vector<Decl*> Decls, SubDecls;
Expand Down Expand Up @@ -716,8 +724,11 @@ TEST(FunctionReflectionTest, GetFunctionArgDefault) {
EXPECT_EQ(Cpp::GetFunctionArgDefault(Decls[1], 2), "34126");
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_Construct) {
#else
TEST(FunctionReflectionTest, Construct) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -751,7 +762,11 @@ TEST(FunctionReflectionTest, Construct) {
EXPECT_EQ(output, "Constructor Executed");
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_Destruct) {
#else
TEST(FunctionReflectionTest, Destruct) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -783,4 +798,3 @@ TEST(FunctionReflectionTest, Destruct) {
output = testing::internal::GetCapturedStdout();
EXPECT_EQ(output, "Destructor Executed");
}
#endif
6 changes: 4 additions & 2 deletions unittests/CppInterOp/JitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ static int printf_jit(const char* format, ...) {
return 0;
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(JitTest, DISABLED_InsertOrReplaceJitSymbol) {
#else
TEST(JitTest, InsertOrReplaceJitSymbol) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
extern "C" int printf(const char*,...);
Expand All @@ -31,7 +34,6 @@ TEST(JitTest, InsertOrReplaceJitSymbol) {
Cpp::InsertOrReplaceJitSymbol("non_existent", (uint64_t)&printf_jit));
EXPECT_TRUE(Cpp::InsertOrReplaceJitSymbol("non_existent", 0));
}
#endif

TEST(Streams, StreamRedirect) {
// printf and etc are fine here.
Expand Down
Loading

0 comments on commit 7bb28d0

Please sign in to comment.