Add thresholds for Benchmarks #233
Workflow file for this run
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
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml | |
name: CI Build & Test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- OS: ubuntu-latest | |
cpp_compiler: g++ | |
c_compiler: gcc | |
- OS: ubuntu-latest | |
cpp_compiler: clang++ | |
c_compiler: clang | |
- OS: windows-latest | |
cpp_compiler: cl | |
c_compiler: cl | |
name: Build & Test ${{ matrix.os }} ${{ matrix.c_compiler }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CC: ${{ matrix.c_compiler }} | |
CXX: ${{ matrix.cpp_compiler }} | |
steps: | |
# this Action should follow steps to set up Python build environment | |
- uses: actions/checkout@v4 | |
- name: Install Protoc Windows | |
if: ${{ startsWith(matrix.OS, 'windows') }} | |
uses: arduino/setup-protoc@v3 | |
- name: Install Protoc Ubuntu | |
if: ${{ startsWith(matrix.OS, 'ubuntu') }} | |
run: sudo apt install protobuf-compiler | |
- name: Install Python dependencies | |
uses: py-actions/py-dependency-install@v4 | |
with: | |
path: "PyTorch_requirements.txt" | |
- name: Configure CMake ubuntu | |
if: ${{ startsWith(matrix.OS, 'ubuntu') }} | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
cmake \ | |
-DNT_TEST_COVERAGE=ON \ | |
-DCMAKE_PREFIX_PATH=`python3 -c "import torch;print(torch.utils.cmake_prefix_path)"` \ | |
-B ${{github.workspace}}/build \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Configure CMake windows | |
if: ${{ startsWith(matrix.OS, 'windows') }} | |
# on windows to get the pytorch config we have to | |
# run the same python command as before but now save it | |
# to a file then read from the file into a variable to pass to cmake | |
run: | | |
$Torch_DIR = python3 -c "import torch;print(torch.utils.cmake_prefix_path)" | |
echo "torch location: $Torch_DIR" | |
cmake -DNT_TEST_COVERAGE=ON -DCMAKE_PREFIX_PATH="$Torch_DIR" -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 2 | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest -C ${{env.BUILD_TYPE}} | |
- name: Generate Coverage Report | |
# only need to do this for one combination of OS and compiler | |
if: ${{ matrix.OS == 'ubuntu-latest' && matrix.c_compiler == 'gcc' }} | |
working-directory: ${{github.workspace}}/build | |
run: gcovr --json -o nuTens_coverage.json -r .. -f "../nuTens/*" | |
- name: Upload coverage reports to Codecov | |
# only need to do this for one combination of OS and compiler | |
if: ${{ matrix.OS == 'ubuntu-latest' && matrix.c_compiler == 'gcc' }} | |
uses: codecov/[email protected] | |
with: | |
verbose: true | |
files: nuTens_coverage.json | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |