diff --git a/.github/workflows/self-hosted.yml b/.github/workflows/self-hosted.yml new file mode 100644 index 0000000..e7c1fd1 --- /dev/null +++ b/.github/workflows/self-hosted.yml @@ -0,0 +1,97 @@ +name: Self-Hosted + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + build_dir: "build" + +jobs: + build: + name: Build ${{ matrix.os }} GCC ${{ matrix.gcc }} CUDA ${{ matrix.cuda }} + runs-on: self-hosted + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + cuda: "12.8" + gcc: 14 + env: + config: "Release" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set environment variables + run: | + echo "CUDA_PATH=/usr/local/cuda-12.8" >> $GITHUB_ENV + echo "${CUDA_PATH}/bin" >> $GITHUB_PATH + echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "CC=/usr/bin/gcc-${{ matrix.gcc }}" >> $GITHUB_ENV + echo "CXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV + echo "CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV + echo "CUDACXX=/usr/local/cuda-${{ matrix.cuda }}/bin/nvcc" >> $GITHUB_ENV + + - name: Configure CMake build + run: | + cmake -B ${{ env.build_dir }} -S . \ + -DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \ + -DCMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \ + -DCMAKE_BUILD_TYPE=${{ env.config }} \ + -DCUBOOL_WITH_CUDA=ON \ + -DCUBOOL_GRAPH_ENABLE_TESTING=ON + + - name: Build library sources + run: | + cmake --build ${{ env.build_dir }} \ + --verbose \ + -j10 + + test: + name: Test GPU ${{ matrix.gpu }} CUDA ${{ matrix.cuda }} + needs: build + runs-on: self-hosted + strategy: + fail-fast: false + matrix: + include: + - gpu: NVIDIA-GeForce-GT-1030 + cuda: "12.9" + env: + test-file: gpu_test.log + + steps: + - name: Run tests + working-directory: ${{ env.build_dir }}/tests + run: | + ./cuboolgraph_tests | tee ${{ env.test-file }} + + - name: Upload tests resutls + uses: actions/upload-artifact@v4 + with: + name: ${{ env.test-file }} + path: ${{ env.build_dir }}/tests/${{ env.test-file }} + + - name: Check for tests results + working-directory: ${{ env.build_dir }}/tests + run: | + ! grep -q "FAILED" ${{ env.test-file }} + + clean: + name: Cleanup workspace + needs: test + if: always() + runs-on: self-hosted + + steps: + - name: Cleanup workspace + run: | + rm -rf ${{ github.workspace }}/* + rm -rf ${{ github.workspace }}/.* diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0da2f3b..128c765 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,54 +1,100 @@ -name: Compile, run tests and check code style +name: Ubuntu on: push: - branches: - - '**' + branches: [ main ] pull_request: - branches: - - '**' + branches: [ main ] + workflow_dispatch: + +env: + build_dir: "build" + artifact: "cuboolgraph-ubuntu-build.tar.xz" jobs: build: + name: Build ${{ matrix.os }} runs-on: ${{ matrix.os }} - strategy: fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + gcc: 14 + + env: + config: "Release" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Configure CMake build + run: | + cmake -B ${{ env.build_dir }} -S . \ + -DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \ + -DCMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \ + -DCMAKE_BUILD_TYPE=${{ env.config }} \ + -DCUBOOL_WITH_CUDA=OFF \ + -DCUBOOL_WITH_SEQUENTIAL=ON \ + -DCUBOOL_GRAPH_ENABLE_TESTING=ON + + - name: Build library sources + run: | + cmake --build ${{ env.build_dir }} \ + --verbose \ + -j10 + + - name: Prepare upload project + run: | + tar cfz ${{ env.artifact }} ${{ env.build_dir }} + - name: Upload project + uses: actions/upload-artifact@v4 + with: + name: ${{ env.artifact }} + path: ${{ env.artifact }} + + test: + name: Test CPU ${{ matrix.cpu }} + needs: build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false matrix: - os: [ubuntu-24.04] - c_compiler: [gcc-14] - cpp_compiler: [g++-14] - build_type: [Release, Debug] + include: + - os: ubuntu-24.04 + cpu: AMD-EPYC-7763 + env: + test-file: cpu_test.log steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Setup enviroment - run: | - sudo apt update - sudo apt install gcc-14 - sudo apt install g++-14 - sudo apt install cmake - sudo apt install clang-format - - - name: Configure CMake - run: | - cd ${{ github.workspace }} - cmake -B build -S . \ - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DCUBOOL_GRAPH_ENABLE_TESTING=ON \ - -DCUBOOL_WITH_CUDA=OFF \ - -DCUBOOL_WITH_SEQUENTIAL=ON - - - name: Build - run: | - cmake --build build -j10 - - - name: Run tests - run: | - ./build/tests/cuboolgraph_tests + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/download-artifact@v4 + with: + name: ${{ env.artifact }} + + - name: Unarchive artifact + run: | + tar xzf ${{ env.artifact }} + rm ${{ env.artifact }} + + - name: Run tests + working-directory: ${{ env.build_dir }}/tests + run: | + ./cuboolgraph_tests | tee ${{ env.test-file }} + + - name: Upload tests resutls + uses: actions/upload-artifact@v4 + with: + name: ${{ env.test-file }} + path: ${{ env.build_dir }}/tests/${{ env.test-file }} + + - name: Check for tests results + working-directory: ${{ env.build_dir }}/tests + run: | + ! grep -q "FAILED" ${{ env.test-file }}