update README.md #6
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| workflow_dispatch: | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| test: | |
| name: ${{ matrix.build_type }} - CUDA ${{ matrix.cuda-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build_type: [Debug, Release] | |
| cuda-version: ['12.4.0', '12.5.0'] | |
| include: | |
| - cuda-version: '12.4.0' | |
| cuda-arch: 'sm_80,sm_86,sm_89,sm_90' | |
| - cuda-version: '12.5.0' | |
| cuda-arch: 'sm_80,sm_86,sm_89,sm_90' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up CUDA | |
| uses: Jimver/cuda-toolkit@v0.2.11 | |
| with: | |
| cuda: ${{ matrix.cuda-version }} | |
| method: 'network' | |
| sub-packages: '["nvcc", "cudart", "cublas", "curand", "cusparse", "cusolver", "cufft"]' | |
| - name: Set up CMake | |
| uses: jwlawson/actions-setup-cmake@v1.14 | |
| with: | |
| cmake-version: '3.25' | |
| - name: Cache CMake build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| build/** | |
| key: ${{ runner.os }}-cmake-${{ matrix.cuda-version }}-${{ matrix.build_type }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake', '**/*.cu', '**/*.cpp', '**/*.h') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cmake-${{ matrix.cuda-version }}-${{ matrix.build_type }}- | |
| - name: Configure CMake | |
| run: | | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DCMAKE_CUDA_ARCHITECTURES="${{ matrix.cuda-arch }}" \ | |
| -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc | |
| - name: Build | |
| run: | | |
| cmake --build build --config ${{ matrix.build_type }} --parallel $(nproc) | |
| - name: Test | |
| working-directory: build | |
| run: | | |
| ctest --output-on-failure --verbose --build-config ${{ matrix.build_type }} | |
| - name: Upload test results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.build_type }}-cuda-${{ matrix.cuda-version }} | |
| path: | | |
| build/CMakeCache.txt | |
| build/CMakeFiles/CMakeOutput.log | |
| build/CMakeFiles/CMakeError.log | |
| build/Testing/**/*.xml | |
| retention-days: 7 | |
| sanitizers: | |
| name: Sanitizers (${{ matrix.sanitizer }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| sanitizer: [address, undefined] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up CUDA | |
| uses: Jimver/cuda-toolkit@v0.2.11 | |
| with: | |
| cuda: '12.4.0' | |
| method: 'network' | |
| sub-packages: '["nvcc", "cudart", "cublas", "curand", "cusparse", "cusolver", "cufft"]' | |
| - name: Set up CMake | |
| uses: jwlawson/actions-setup-cmake@v1.14 | |
| with: | |
| cmake-version: '3.25' | |
| - name: Configure CMake with sanitizers | |
| run: | | |
| SANITIZER_FLAGS="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer -g" | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_CXX_FLAGS="${SANITIZER_FLAGS}" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="${SANITIZER_FLAGS}" \ | |
| -DCMAKE_CUDA_ARCHITECTURES="sm_80,sm_86,sm_89,sm_90" \ | |
| -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \ | |
| -DCMAKE_CUDA_FLAGS="-Xcompiler ${SANITIZER_FLAGS}" | |
| - name: Build | |
| run: cmake --build build -j $(nproc) | |
| - name: Run tests with sanitizers | |
| working-directory: build | |
| env: | |
| ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1 | |
| UBSAN_OPTIONS: print_stacktrace=1 | |
| TSAN_OPTIONS: second_deadlock_stack=1 | |
| run: ctest --output-on-failure -j $(nproc) | |
| - name: Upload sanitizer results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sanitizer-results-${{ matrix.sanitizer }} | |
| path: | | |
| build/Testing/**/*.xml | |
| build/CMakeFiles/CMakeError.log | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up CUDA | |
| uses: Jimver/cuda-toolkit@v0.2.11 | |
| with: | |
| cuda: '12.4.0' | |
| method: 'network' | |
| sub-packages: '["nvcc", "cudart", "cublas", "curand", "cusparse", "cusolver", "cufft"]' | |
| - name: Set up CMake | |
| uses: jwlawson/actions-setup-cmake@v1.14 | |
| with: | |
| cmake-version: '3.25' | |
| - name: Install coverage tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcovr lcov | |
| - name: Configure CMake with coverage | |
| run: | | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ | |
| -DCMAKE_CUDA_ARCHITECTURES="sm_80,sm_86,sm_89,sm_90" \ | |
| -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \ | |
| -DCMAKE_CUDA_FLAGS="-Xcompiler --coverage -Xcompiler -fprofile-arcs -Xcompiler -ftest-coverage" | |
| - name: Build | |
| run: cmake --build build -j $(nproc) | |
| - name: Run tests | |
| working-directory: build | |
| run: ctest --output-on-failure -j $(nproc) | |
| - name: Generate coverage report | |
| run: | | |
| gcovr --root . --xml --output coverage.xml \ | |
| --exclude '3rdparty/.*' \ | |
| --exclude 'build/_deps/.*' \ | |
| --exclude 'test/.*' \ | |
| --exclude 'example/.*' \ | |
| --exclude '.*\.cu$' || echo "Coverage generation completed" | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [test, sanitizers] | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [ "${{ needs.test.result }}" = "failure" ] || [ "${{ needs.sanitizers.result }}" = "failure" ]; then | |
| echo "❌ Tests failed!" | |
| exit 1 | |
| else | |
| echo "✅ All tests passed!" | |
| fi | |