test: enhance ci (#62)

* test: enhance ci

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* typo: README.md

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* fix: typo in workflow files

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* test: ci 安装 protobuf

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* test: cache protobuf

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* docs: update README.md

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* test: ci 调试完成,恢复只在代码更新时执行

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* test: ci 执行 cpu 上测试

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* fix: action paths

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* build: 4 个 submodule 规范到发布版本号

> <https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent>
> 这个项目无法使用最新版因为每个次级版本号 api 都有变化,目前使用的是最接近原来版本的 v3.10.5

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* typo: README.md

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* test: 扩大测试执行范围方便后续扩充检查范围

Signed-off-by: YdrMaster <ydrml@hotmail.com>

* docs: update README.md

Signed-off-by: YdrMaster <ydrml@hotmail.com>

---------

Signed-off-by: YdrMaster <ydrml@hotmail.com>
This commit is contained in:
YdrMaster 2023-02-12 00:01:36 +08:00 committed by GitHub
parent d780f687fc
commit 14c9c82dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 90 additions and 11 deletions

57
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: Build and test cpu
on:
pull_request:
paths-ignore:
- '**.md'
- 'LICENSE'
env:
protobuf_download: https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protobuf-cpp-3.21.12.tar.gz
protobuf_version: 3.21.12
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install libdw
run: sudo apt-get update && sudo apt-get install libdw-dev
- name: Cache protobuf
id: cache-protobuf
uses: actions/cache@v3
with:
path: protobuf-${{ env.protobuf_version }}
key: protobuf-${{ env.protobuf_version }}
- name: Download and compile protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
wget ${{ env.protobuf_download }}
tar xf protobuf-cpp-${{ env.protobuf_version }}.tar.gz
cd protobuf-${{ env.protobuf_version }}
./autogen.sh
./configure CFLAGS="-fPIC" CXXFLAGS="-fPIC"
make -j2
- name: Install protobuf
run: |
cd protobuf-${{ env.protobuf_version }}
sudo make install
sudo ldconfig
- name: Build
run: |
mkdir build
cd build
cmake ..
make -j2
- name: Test cpu
run: |
cd build
make test

View File

@ -1,5 +1,10 @@
name: clang-format Check
on: [pull_request]
on:
pull_request:
paths-ignore:
- '**.md'
- 'LICENSE'
jobs:
formatting-check:
name: Formatting Check
@ -11,7 +16,7 @@ jobs:
- 'src'
- 'test'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.8.0
with:

@ -1 +1 @@
Subproject commit f30744bcf726ea3735df7ecf9e9de9ddac540283
Subproject commit 3bb9240cb15459768adb3e7d963a20e1523a6294

@ -1 +1 @@
Subproject commit e2239ee6043f73722e7aa812a459f54a28552929
Subproject commit b796f7d44681514f58a683a3a71ff17c94edb0c1

@ -1 +1 @@
Subproject commit 6aebf09233951e4ce30a63919186a70b2b195756
Subproject commit 13132dd361c8c5b5753983d5186cf54f689d90f9

2
3rd-party/pybind11 vendored

@ -1 +1 @@
Subproject commit 1e3400b6742288429f2069aaf5febf92d0662dae
Subproject commit 0bd8896a4010f2d91b2340570c24fa08606ec406

View File

@ -1,6 +1,7 @@
# InfiniTensor
## Compilation on Lotus
``` bash
# Enter the root of InfiniTensor
source test/script/env_lotus.sh
@ -8,10 +9,26 @@ mkdir build && cd build
cmake -DUSE_CUDA=ON .. && make -j 12
```
### CMake Options
There are several configurable CMake options, see the [CMakeLists.txt file](/CMakeLists.txt#L5).
- If `USE_BACKTRACE` is `ON`, `libdw-dev` have to be installed. See the README of [backward-cpp](https://github.com/bombela/backward-cpp) for details.
- If `USE_PROTOBUF` is `ON`, `protobuf` have to be installed. See the README of [protobuf](https://github.com/protocolbuffers/protobuf) for details.
## Contributor Guide
InfiniTensor development is based on the pull request on Github. Before requesting for merging, a PR should satisfy the following requirements
1. Pass all tests.
1. Currently, CI on Github only checks code format. Script `test/script/clang_format_inplace.sh` is for formatting all code.
1. Now CI on Github will test everything that can be tested in the ci environment, including code format. So, script `test/script/clang_format_inplace.sh` is for formatting all code.
2. Contributors should run `ctest` manually and copy its output to the PR. Use fenced code blocks (triple backquotes, i.e., `` ``` ``) to avoid referencing in Github. Otherwise, `#` in the output is interpreted as a Github reference. Do not directly paste the ctest output in commit messages either for the same reason.
2. Receive at least one approval from reviewers.
3. PR title should be concise since it is going to be the commit message in the main branch after merging and squashing.
## Dependencies
- [backward-cpp](https://github.com/bombela/backward-cpp): [v1.6](https://github.com/bombela/backward-cpp/releases/tag/v1.6)
- [googletest](https://github.com/google/googletest): [v1.13.0](https://github.com/google/googletest/releases/tag/v1.13.0)
- [nlohmann_json_cmake_fetchcontent](https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent): [v3.10.5](https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent/releases/tag/v3.10.5)
- [pybind11](https://github.com/pybind/pybind11): [v2.10.3](https://github.com/pybind/pybind11/releases/tag/v2.10.3)