-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds CI (C++ unit tests and pre-commit hooks) to GitHub Actions.
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [ybubnov] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: CXX Unit Test | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-22.04 | ||
container: | ||
image: ubuntu:22.04 | ||
|
||
steps: | ||
- name: Checkout source code | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure apt to disable recommendations installation | ||
id: configure_apt | ||
run: | | ||
echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf | ||
echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf | ||
- name: Install third-party libraries and tools | ||
id: install_packages | ||
run: | | ||
apt-get update | ||
apt-get install -y cmake build-essential libboost-test-dev libfmt-dev wget unzip | ||
apt-get install -y python3-pip python3-numpy | ||
- name: Install python libraries | ||
id: install_torch | ||
run: pip3 install 'torch>=2.2.0+cpu' --index-url https://download.pytorch.org/whl/cpu | ||
|
||
- name: Find PyTorch cmake prefix path | ||
id: find_torch | ||
run: > | ||
echo "cmake_prefix_path=$(python3 -c 'import torch; print(torch.utils.cmake_prefix_path)')" | ||
>> $GITHUB_OUTPUT | ||
- name: Configure CMake | ||
run: > | ||
cmake | ||
-DCMAKE_PREFIX_PATH=${{steps.find_torch.outputs.cmake_prefix_path}} | ||
-B ${{github.workspace}}/build | ||
- name: Build CXX library | ||
run: cmake --build ${{github.workspace}}/build | ||
|
||
- name: Run unit-tests | ||
run: make -C ${{github.workspace}}/build test ARGS="--verbose" BOOST_TEST_LOG_LEVEL="test_suite" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Pre-Commit | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files --show-diff-on-failure --color=always |