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 27, 2023
1 parent 6908546 commit 924a074
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 59 deletions.
56 changes: 31 additions & 25 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 Down Expand Up @@ -93,6 +93,12 @@ jobs:
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
os="${{ matrix.os }}"
if [[ "${os}" == "macos*" ]]; then
echo "ncpus=$(sysctl -n hw.physicalcpu)" >> $GITHUB_ENV
else
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
fi
- name: Setup compiler on Linux
if: runner.os == 'Linux'
Expand Down Expand Up @@ -199,17 +205,17 @@ 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
# if [[ "${os}" == "macos*" ]]; then
cmake --build . --target clang --parallel ${ncpus}
cmake --build . --target cling --parallel ${ncpus}
# Now build gtest.a and gtest_main for CppInterOp to run its tests.
cmake --build . --target gtest_main --parallel ${ncpus}
# 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
else
cmake -DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
Expand All @@ -220,11 +226,11 @@ 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
# if [[ "${os}" == "macos*" ]]; then
cmake --build . --target clang clang-repl --parallel ${ncpus}
# else
# cmake --build . --target clang clang-repl --parallel $(nproc --all)
# fi
fi
cd ../../

Expand Down Expand Up @@ -286,12 +292,12 @@ jobs:
../
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
# os="${{ matrix.os }}"
# if [[ "${os}" == "macos*" ]]; then
cmake --build . --target check-cppinterop --parallel ${ncpus}
# else
# cmake --build . --target check-cppinterop --parallel $(nproc --all)
# fi
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
27 changes: 17 additions & 10 deletions unittests/CppInterOp/ScopeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ TEST(ScopeReflectionTest, SizeOf) {
EXPECT_EQ(Cpp::SizeOf(Decls[7]), (size_t)16);
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_IsBuiltin) {
#else
TEST(ScopeReflectionTest, IsBuiltin) {
#endif
// static std::set<std::string> g_builtins =
// {"bool", "char", "signed char", "unsigned char", "wchar_t", "short", "unsigned short",
// "int", "unsigned int", "long", "unsigned long", "long long", "unsigned long long",
Expand Down Expand Up @@ -127,7 +130,6 @@ TEST(ScopeReflectionTest, IsBuiltin) {
for (ClassTemplateSpecializationDecl *CTSD : CTD->specializations())
EXPECT_TRUE(Cpp::IsBuiltin(C.getTypeDeclType(CTSD).getAsOpaquePtr()));
}
#endif

TEST(ScopeReflectionTest, IsTemplate) {
std::vector<Decl *> Decls;
Expand Down Expand Up @@ -410,8 +412,11 @@ TEST(ScopeReflectionTest, GetScopefromCompleteName) {
EXPECT_EQ(Cpp::GetQualifiedName(Cpp::GetScopeFromCompleteName("N1::N2::C::S")), "N1::N2::C::S");
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_GetNamed) {
#else
TEST(ScopeReflectionTest, GetNamed) {
#endif
std::string code = R"(namespace N1 {
namespace N2 {
class C {
Expand Down Expand Up @@ -448,7 +453,6 @@ TEST(ScopeReflectionTest, GetNamed) {
EXPECT_EQ(Cpp::GetQualifiedName(std_string_class), "std::string");
EXPECT_EQ(Cpp::GetQualifiedName(std_string_npos_var), "std::basic_string<char>::npos");
}
#endif

TEST(ScopeReflectionTest, GetParentScope) {
std::string code = R"(namespace N1 {
Expand Down Expand Up @@ -538,7 +542,6 @@ TEST(ScopeReflectionTest, GetNumBases) {
EXPECT_EQ(Cpp::GetNumBases(Decls[5]), 0);
}


TEST(ScopeReflectionTest, GetBaseClass) {
std::vector<Decl *> Decls;
std::string code = R"(
Expand Down Expand Up @@ -708,16 +711,18 @@ TEST(ScopeReflectionTest, InstantiateNNTPClassTemplate) {
/*type_size*/ args1.size()));
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_InstantiateTemplateFunctionFromString) {
#else
TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) {
#endif
Cpp::CreateInterpreter();
std::string code = R"(#include <memory>)";
Interp->process(code);
const char* str = "std::make_unique<int,int>";
auto* Instance1 = (Decl*)Cpp::InstantiateTemplateFunctionFromString(str);
EXPECT_TRUE(Instance1);
}
#endif

TEST(ScopeReflectionTest, InstantiateClassTemplate) {
std::vector<Decl *> Decls;
Expand Down Expand Up @@ -850,12 +855,14 @@ TEST(ScopeReflectionTest, GetClassTemplateInstantiationArgs) {
EXPECT_TRUE(instance_types.size() == 0);
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_IncludeVector) {
#else
TEST(ScopeReflectionTest, IncludeVector) {
#endif
std::string code = R"(
#include <vector>
#include <iostream>
)";
Interp->process(code);
}
#endif
}
8 changes: 5 additions & 3 deletions unittests/CppInterOp/TypeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,11 @@ TEST(TypeReflectionTest, IsPODType) {
EXPECT_FALSE(Cpp::IsPODType(0));
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(TypeReflectionTest, DISABLED_IsSmartPtrType) {
#else
TEST(TypeReflectionTest, IsSmartPtrType) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -552,5 +555,4 @@ TEST(TypeReflectionTest, IsSmartPtrType) {
EXPECT_TRUE(Cpp::IsSmartPtrType(get_type_from_varname("smart_ptr6")));
EXPECT_FALSE(Cpp::IsSmartPtrType(get_type_from_varname("raw_ptr")));
EXPECT_FALSE(Cpp::IsSmartPtrType(get_type_from_varname("object")));
}
#endif
}

0 comments on commit 924a074

Please sign in to comment.