Skip to content

[CI] Added run of unit tests (gtest) #20

[CI] Added run of unit tests (gtest)

[CI] Added run of unit tests (gtest) #20

Workflow file for this run

name: Build
on:
push:
branches:
- "*"
tags:
- "*"
jobs:
build_rg3:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { name: "Windows MSVC", os: windows-latest, cc: "cl", cxx: "cl", boost_toolset: msvc }
steps:
# Download repository with submodules
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
# Setup msbuild
- name: Add msbuild to PATH
uses: microsoft/[email protected]
with:
msbuild-architecture: x64
# Setup Python of specific version
- name: Install Python
id: install-python3
uses: actions/setup-python@v5
with:
python-version: '3.10'
# Check cache of Boost & LLVM - take if exists
# Build Boost 1.81.0
- name: Install Boost 1.81.0
uses: MarkusJx/[email protected]
id: install-boost
with:
boost_version: 1.81.0
toolset: msvc
link: static
# Try to locate llvm binaries (I'm not sure, but this list should be enough to precache all required things)
- name: Cache LLVM binaries
id: cache-llvm-binaries
uses: actions/cache@v3
with:
key: "${{ runner.os }}-build-llvmorg-16.0.4"
path: |
llvm_repo/cmake
llvm_repo/build/cmake
llvm_repo/build/MinSizeRel
llvm_repo/build/include
llvm_repo/build/lib
llvm_repo/build/tools/clang/include
llvm_repo/llvm
llvm_repo/clang
# Checkout & Build LLVM (On cache miss - build from sources!)
- name: Checkout LLVM
if: steps.cache-llvm-binaries.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
submodules: "recursive"
repository: "llvm/llvm-project"
ref: "llvmorg-16.0.4"
path: "llvm_repo"
# Build LLVM (very slow process, lmao) TODO: Add support of Ninja build system!!!
- name: Build LLVM
if: steps.cache-llvm-binaries.outputs.cache-hit != 'true'
working-directory: llvm_repo
run: |
mkdir build
cmake -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE="MinSizeRel" -S llvm -B build -G "Visual Studio 17 2022"
cd build
cmake --build . --config MinSizeRel
# Build our project. TODO: Add support of Ninja build system!!!
- name: Build RG3
env:
LLVM_DIR: ${{ github.workspace }}/llvm_repo/build/lib/cmake/llvm
CLANG_DIR: ${{ github.workspace }}/llvm_repo/build/lib/cmake/clang
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
Python3_USE_STATIC_LIBS: "TRUE"
run: |
mkdir build
cmake -DCMAKE_BUILD_TYPE="MinSizeRel" -B build -G "Visual Studio 17 2022"
cd build
cmake --build . --config MinSizeRel
# Install Clang 16.0.4 (for testing env)
- name: Install Clang TestEnv
uses: egor-tensin/setup-clang@v1
with:
version: "16.0.4"
platform: x64
- name: Print Clang Info
run: clang++ --version
# Run Unit Tests
- name: RG3 Run unit tests
run: |
cd build
ctest . --verbose --output-on-failure
# Run Integration Tests TODO
# Make python packages (whl) TODO
# Make dist folder with pyd & pyi files.
- name: Create distribution package
run: |
mkdir dist
mv PyBind/rg3py.pyi dist
mv build/PyBind/MinSizeRel/rg3py.pyd dist
# Upload artifacts
- name: Upload RG3 artifacts
uses: actions/upload-artifact@v2
with:
name: RG3_${{ runner.os }}_Python310
path: dist
# Upload WHL artifacts