Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use github self-hosted runner for CI #169

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.linux.arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Linux ARM

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
centos8-gcc921-epoll:
runs-on: [self-hosted, Linux, ARM64]

container:
image: dokken/centos-stream-8:sha-40294ce
options: --cpus 4
Copy link
Collaborator Author

@beef9999 beef9999 Aug 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RedHat不再给docker hub提供官方镜像,只提供在自己的quary.io仓库 ...


steps:
- uses: actions/checkout@v3

- name: Install Dependencies
run: |
dnf install -y git gcc-c++ cmake
dnf install -y gcc-toolset-9-gcc-c++
dnf install -y openssl-devel libcurl-devel libaio-devel
dnf install -y epel-release
dnf install -y fuse-devel libgsasl-devel

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake -B build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D ENABLE_SASL=ON -D ENABLE_FUSE=ON \
-D ENABLE_URING=OFF -D FETCH_GTEST_GFLAGS_SOURCE=ON
cmake --build build

- name: Test
run: |
ulimit -l unlimited
cd build
ctest --timeout 3600 -V
73 changes: 73 additions & 0 deletions .github/workflows/ci.linux.x86.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Linux x86

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
centos8-gcc921-epoll:
runs-on: [self-hosted, Linux, X64]

container:
image: dokken/centos-stream-8:sha-40294ce
options: --cpus 4

steps:
- uses: actions/checkout@v3

- name: Install Dependencies
run: |
dnf install -y git gcc-c++ cmake
dnf install -y gcc-toolset-9-gcc-c++
dnf install -y openssl-devel libcurl-devel libaio-devel
dnf install -y epel-release
dnf install -y fuse-devel libgsasl-devel

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake -B build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D ENABLE_SASL=ON -D ENABLE_FUSE=ON \
-D ENABLE_URING=OFF -D FETCH_GTEST_GFLAGS_SOURCE=ON
cmake --build build

- name: Test
run: |
ulimit -l unlimited
cd build
ctest --timeout 3600 -V

centos8-gcc921-iouring:
runs-on: [self-hosted, Linux, X64]

container:
image: dokken/centos-stream-8:sha-40294ce
# In order to run io_uring, the docker daemon should add --default-ulimit memlock=-1:-1
options: --cpus 4

steps:
- uses: actions/checkout@v3

- name: Install Dependencies
run: |
dnf install -y git gcc-c++ cmake
dnf install -y gcc-toolset-9-gcc-c++
dnf install -y openssl-devel libcurl-devel libaio-devel
dnf install -y epel-release
dnf install -y fuse-devel libgsasl-devel

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake -B build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D ENABLE_SASL=ON -D ENABLE_FUSE=ON \
-D ENABLE_URING=ON -D FETCH_GTEST_GFLAGS_SOURCE=ON
cmake --build build

- name: Test
run: |
ulimit -l unlimited
cd build
ctest --timeout 3600 -V
52 changes: 0 additions & 52 deletions .github/workflows/ci.linux.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/ci.macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main" ]

jobs:
Debug:
macOS-12-Monterey:
runs-on: macos-12

steps:
Expand All @@ -18,11 +18,11 @@ jobs:
run: |
brew install cmake openssl gflags googletest gsasl

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -D BUILD_TESTING=1 -D ENABLE_SASL=1 -D CMAKE_BUILD_TYPE=Debug -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3

- name: Build
run: cmake --build ${{github.workspace}}/build -j
run: |
cmake -B ${{github.workspace}}/build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Debug \
-D ENABLE_SASL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3
cmake --build ${{github.workspace}}/build

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
51 changes: 30 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project(
include(FindPackageHandleStandardArgs)
include(CheckCXXCompilerFlag)
include(FetchContent)
include(ProcessorCount)
set(FETCHCONTENT_QUIET false)
find_package(PkgConfig REQUIRED)

Expand All @@ -23,24 +24,27 @@ option(FETCH_GTEST_GFLAGS_SOURCE "Fetch gtest, gmock and gflags source code. Lin
option(ENABLE_FSTACK_DPDK "Use f-stack + DPDK as the event engine" OFF)
option(ENABLE_EXTFS "enable extfs" OFF)

# Get CPU arch
# Get CPU arch and number
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT (${ARCH} STREQUAL x86_64) AND NOT (${ARCH} STREQUAL aarch64) AND NOT (${ARCH} STREQUAL arm64))
message(FATAL_ERROR "Unknown CPU architecture ${ARCH}")
endif ()
ProcessorCount(NumCPU)

# Compiler options
add_compile_options(-Wall) # -Werror is not enable yet

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_CXX_EXTENSIONS off)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# CMake didn't provide an abstraction of optimization level for now.
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") # For development
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") # For production
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g") # For CI test
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI 现在使用-O3编译

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_RPATH_USE_ORIGIN on)
set(CMAKE_POSITION_INDEPENDENT_CODE on)
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_BUILD_PARALLEL_LEVEL ${NumCPU})

if (${ARCH} STREQUAL x86_64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
Expand Down Expand Up @@ -125,7 +129,8 @@ if (ENABLE_EXTFS)
find_package(e2fs REQUIRED)
endif()

if (FETCH_GTEST_GFLAGS_SOURCE)
function(do_fetch_gtest_gflags_src)
set(BUILD_TESTING OFF) # Only disable in this function
FetchContent_Declare(
gflags
GIT_REPOSITORY https://github.com/gflags/gflags.git
Expand All @@ -141,6 +146,10 @@ if (FETCH_GTEST_GFLAGS_SOURCE)
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
endfunction()

if (FETCH_GTEST_GFLAGS_SOURCE)
do_fetch_gtest_gflags_src()
endif()

# Compile photon objects
Expand Down Expand Up @@ -274,15 +283,15 @@ target_link_libraries(photon_static ${static_link_libs})
if (BUILD_TESTING)
include(CTest)

if (FETCH_GTEST_GFLAGS_SOURCE)
set(testing_libs gtest gmock gflags::gflags)
else()
find_package(GTest REQUIRED)
find_package(gmock REQUIRED)
find_package(gflags REQUIRED)
set(testing_libs ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES} ${GFLAGS_LIBRARIES})
include_directories(${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS})
endif()
if (FETCH_GTEST_GFLAGS_SOURCE)
set(testing_libs gtest gmock gflags::gflags)
else ()
find_package(GTest REQUIRED)
find_package(gmock REQUIRED)
find_package(gflags REQUIRED)
set(testing_libs ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES} ${GFLAGS_LIBRARIES})
include_directories(${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS})
endif ()

add_subdirectory(examples)
add_subdirectory(common/checksum/test)
Expand All @@ -294,8 +303,8 @@ endif()
add_subdirectory(rpc/test)
add_subdirectory(thread/test)
add_subdirectory(net/security-context/test)
if (ENABLE_EXTFS)
add_subdirectory(fs/extfs/test)
endif ()
if (ENABLE_EXTFS)
add_subdirectory(fs/extfs/test)
endif ()

endif ()
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# PhotonLibOS

[![CI](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.linux.yml/badge.svg)](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.linux.yml)
[![CI](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.linux.x86.yml/badge.svg)](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.linux.x86.yml)
[![CI](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.linux.arm.yml/badge.svg)](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.linux.arm.yml)
[![CI](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.macos.yml/badge.svg)](https://github.com/alibaba/PhotonLibOS/actions/workflows/ci.macos.yml)


Visit [photonlibos.github.io](https://photonlibos.github.io) for detailed documents.
[PhotonlibOS.github.io](https://photonlibos.github.io)

## What's New
* Since version 0.6, Photon can run with a userspace TCP/IP stack on top of `DPDK`.
Expand Down
21 changes: 11 additions & 10 deletions doc/docs/introduction/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ brew install cmake openssl pkg-config
```bash
cd PhotonLibOS
cmake -B build
cmake --build build -j
cmake --build build
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake默认的编译并发数是32,小配置机器用默认值很容易OOM,因此采用检测cpu数的方法,并作为新的默认值

```

```mdx-code-block
Expand All @@ -75,7 +75,7 @@ cmake --build build -j
```bash
cd PhotonLibOS
cmake -B build
cmake --build build -j
cmake --build build
```

```mdx-code-block
Expand All @@ -87,7 +87,7 @@ cmake --build build -j
cd PhotonLibOS
# Use `brew info openssl` to find openssl path
cmake -B build -D OPENSSL_ROOT_DIR=/path/to/openssl/
cmake --build build -j
cmake --build build
```

```mdx-code-block
Expand All @@ -110,11 +110,12 @@ The examples and test code are built together.

```bash
# Install additional dependencies
dnf install epel-releaase
dnf install gtest-devel gmock-devel gflags-devel fuse-devel libgsasl-devel

# Build examples and test code
cmake -B build -D BUILD_TESTING=1 -D CMAKE_BUILD_TYPE=Debug
cmake --build build -j
cmake -B build -D BUILD_TESTING=ON
cmake --build build

# Run all test cases
cd build
Expand All @@ -131,8 +132,8 @@ ctest
apt install libgtest-dev libgmock-dev libgflags-dev libfuse-dev libgsasl7-dev

# Build examples and test code
cmake -B build -D BUILD_TESTING=1 -D CMAKE_BUILD_TYPE=Debug
cmake --build build -j
cmake -B build -D BUILD_TESTING=ON
cmake --build build

# Run all test cases
cd build
Expand All @@ -149,8 +150,8 @@ ctest
brew install gflags googletest gsasl

# Build examples and test code
cmake -B build -D BUILD_TESTING=1 -D CMAKE_BUILD_TYPE=Debug
cmake --build build -j
cmake -B build -D BUILD_TESTING=ON
cmake --build build

# Run all test cases
cd build
Expand All @@ -173,4 +174,4 @@ ctest
| ENABLE_FUSE | OFF | Enable fuse. Requires `libfuse` |
| ENABLE_SASL | OFF | Enable SASL. Requires `libgsasl` |
| ENABLE_FSTACK_DPDK | OFF | Enable F-Stack and DPDK. Requires both. |
| ENABLE_EXTFS | OFF | Enable extfs. Requires `libe2fs` |
| ENABLE_EXTFS | OFF | Enable extfs. Requires `libe2fs` |
Loading
Loading