Skip to content

Commit a77a44c

Browse files
committed
[ci] Migrate form Travis to Github Actions
1 parent 89945aa commit a77a44c

File tree

8 files changed

+104
-90
lines changed

8 files changed

+104
-90
lines changed
File renamed without changes.

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: LLDB-MI CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_and_test:
7+
name: Build LLDB-MI and run the testsuite
8+
9+
env:
10+
# CMake build type
11+
BUILD_TYPE: Release
12+
13+
BUILD_PATH: "'${{github.workspace}}/build'"
14+
15+
runs-on: ${{matrix.os}}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
20+
steps:
21+
- name: Install Ninja, LLVM, Clang and LLDB (Ubuntu)
22+
run: sudo apt-get install -y ninja-build clang-format clang libclang-dev liblldb-dev lldb llvm-dev llvm
23+
if: matrix.os == 'ubuntu-latest'
24+
25+
- name: Checkout sources
26+
uses: actions/checkout@v2
27+
28+
- name: Check format (Ubuntu)
29+
run: ${{github.workspace}}/.github/scripts/clang-format.sh
30+
if: matrix.os == 'ubuntu-latest'
31+
32+
- name: Install Ninja, LLVM, Clang and LLDB (Mac OS)
33+
run: |
34+
brew install ninja llvm
35+
echo "LLVM_CONFIG_PATH=$(brew --cellar llvm)/$(brew list --versions llvm | sed -E 's/llvm (.*)/\1/g')/lib/cmake/llvm" >> $GITHUB_ENV
36+
if: matrix.os == 'macos-latest'
37+
38+
- name: Install Ninja (Windows)
39+
run: choco install -y --no-progress ninja
40+
if: matrix.os == 'windows-latest'
41+
42+
- name: Download LLVM binaries (Windows)
43+
# Using not yet released feature 'check_artifacts'.
44+
uses: dawidd6/action-download-artifact@master
45+
with:
46+
workflow: ci.yml
47+
workflow_conclusion: success
48+
repo: tkrasnukha/install-llvm
49+
# Get the last available artifact.
50+
check_artifacts: true
51+
if: matrix.os == 'windows-latest'
52+
53+
# Required to find cl.exe
54+
- name: Setup devcmd (Windows)
55+
uses: ilammy/msvc-dev-cmd@v1
56+
if: matrix.os == 'windows-latest'
57+
58+
- name: Set up environment (Windows)
59+
run: |
60+
$LLVM_CONFIG_PATH = ("${{github.workspace}}").Replace("\", "/") + "/llvm-inst/lib/cmake/llvm"
61+
echo "LLVM_CONFIG_PATH='$LLVM_CONFIG_PATH'" >> $env:GITHUB_ENV
62+
63+
$CC = (gcm "cl.exe" | select-object -ExpandProperty Definition)
64+
echo "CC='$CC'" >> $env:GITHUB_ENV
65+
echo "CXX='$CC'" >> $env:GITHUB_ENV
66+
if: matrix.os == 'windows-latest'
67+
68+
- name: Configure CMake project
69+
run: |
70+
export LLVM_DIR=${{env.LLVM_CONFIG_PATH}}
71+
cmake -GNinja -B ${{env.BUILD_PATH}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DINCLUDE_TESTS=ON
72+
shell: bash
73+
74+
- name: Build
75+
run: cmake --build ${{env.BUILD_PATH}} --config ${{env.BUILD_TYPE}}
76+
77+
- name: Run testsuite
78+
run: |
79+
cd ${{env.BUILD_PATH}}
80+
ctest -V -C ${{env.BUILD_TYPE}}

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ ENDIF("${isSystemDir}" STREQUAL "-1")
6161

6262
add_subdirectory(src)
6363

64-
SET(INCLUDE_TESTS FALSE CACHE BOOL "")
64+
SET(INCLUDE_TESTS CACHE BOOL FALSE)
6565
if (INCLUDE_TESTS)
66+
include(CTest)
6667
add_subdirectory(test)
6768
endif()

ci/run-arch.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

ci/run-macOS.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

ci/travis.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

test/unittests/CMakeLists.txt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
enable_testing()
2-
find_package(GTest REQUIRED)
3-
include_directories(${GTEST_INCLUDE_DIRS})
1+
cmake_minimum_required(VERSION 3.11)
2+
3+
include(FetchContent)
4+
FetchContent_Declare(gtest
5+
QUIET
6+
URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip
7+
)
8+
9+
# Prevent overriding the parent project's linker settings, for Windows.
10+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
11+
12+
# GTest uses default label in switch which covers all enumeration values and
13+
# Clang issues an error in this case. Let it be just a warning.
14+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
15+
add_compile_options("-Wno-error=covered-switch-default")
16+
endif()
17+
18+
FetchContent_MakeAvailable(gtest)
19+
20+
include(GoogleTest)
421

522
include_directories(../../src)
623

@@ -22,10 +39,10 @@ function(add_lldb_mi_test NAME TEST)
2239
endforeach(SRC)
2340

2441
add_executable(${NAME} ${TEST} ${SOURCES_RELATIVE})
25-
target_link_libraries(${NAME} GTest::GTest GTest::Main)
42+
target_link_libraries(${NAME} gtest_main)
2643
set_target_properties(${NAME} PROPERTIES FOLDER "unittests")
2744

28-
add_test(unittests ${NAME})
45+
gtest_discover_tests(${NAME})
2946
endfunction(add_lldb_mi_test)
3047

3148
add_subdirectory(arguments)

0 commit comments

Comments
 (0)