Skip to content

Commit 0c4e38b

Browse files
committed
ci: add build + test on ubuntu and self-hosted
1 parent 077867a commit 0c4e38b

File tree

2 files changed

+180
-40
lines changed

2 files changed

+180
-40
lines changed

.github/workflows/self-hosted.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Self-Hosted
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
env:
11+
build_dir: "build"
12+
13+
jobs:
14+
build:
15+
name: Build ${{ matrix.os }} GCC ${{ matrix.gcc }} CUDA ${{ matrix.cuda }}
16+
runs-on: self-hosted
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: ubuntu-24.04
22+
cuda: "12.8"
23+
gcc: 14
24+
env:
25+
config: "Release"
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
submodules: recursive
31+
32+
- name: Set environment variables
33+
run: |
34+
echo "CUDA_PATH=/usr/local/cuda-12.8" >> $GITHUB_ENV
35+
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
36+
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
37+
echo "CC=/usr/bin/gcc-${{ matrix.gcc }}" >> $GITHUB_ENV
38+
echo "CXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
39+
echo "CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
40+
echo "CUDACXX=/usr/local/cuda-${{ matrix.cuda }}/bin/nvcc" >> $GITHUB_ENV
41+
42+
- name: Configure CMake build
43+
run: |
44+
cmake -B ${{ env.build_dir }} -S . \
45+
-DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \
46+
-DCMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \
47+
-DCMAKE_BUILD_TYPE=${{ env.config }} \
48+
-DCUBOOL_BUILD_TESTS=ON \
49+
-DCUBOOL_GRAPH_ENABLE_TESTING=ON
50+
51+
- name: Build library sources
52+
run: |
53+
cmake --build ${{ env.build_dir }} \
54+
--verbose \
55+
-j10
56+
57+
test:
58+
name: Test GPU ${{ matrix.gpu }} CUDA ${{ matrix.cuda }}
59+
needs: build
60+
runs-on: self-hosted
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
include:
65+
- gpu: NVIDIA-GeForce-GT-1030
66+
cuda: "12.9"
67+
env:
68+
test-file: gpu_test.log
69+
70+
steps:
71+
- name: Run tests
72+
working-directory: ${{ env.build_dir }}/tests
73+
run: |
74+
bash cuboolgraph_tests | tee ${{ env.test-file }}
75+
76+
- name: Upload tests resutls
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: ${{ env.test-file }}
80+
path: ${{ env.build_dir }}/tests/${{ env.test-file }}
81+
82+
- name: Check for unit tests results
83+
working-directory: ${{ env.build_dir }}/tests
84+
run: |
85+
! grep -q "FAILED" ${{ env.test-file }}
86+
87+
clean:
88+
name: Cleanup workspace
89+
needs: test
90+
if: always()
91+
runs-on: self-hosted
92+
93+
steps:
94+
- name: Cleanup workspace
95+
run: |
96+
rm -rf ${{ github.workspace }}/*
97+
rm -rf ${{ github.workspace }}/.*

.github/workflows/ubuntu.yml

Lines changed: 83 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,97 @@
1-
name: Compile, run tests and check code style
1+
name: Ubuntu
22

33
on:
44
push:
5-
branches:
6-
- '**'
5+
branches: [ main ]
76
pull_request:
8-
branches:
9-
- '**'
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
build_dir: "build"
12+
artifact: "cubool-ubuntu-build.tar.xz"
1013

1114
jobs:
1215
build:
16+
name: Build ${{ matrix.os }}
1317
runs-on: ${{ matrix.os }}
14-
1518
strategy:
1619
fail-fast: false
20+
matrix:
21+
include:
22+
- os: ubuntu-24.04
23+
gcc: 14
24+
25+
env:
26+
config: "Release"
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
32+
33+
- name: Configure CMake build
34+
run: |
35+
cmake -B ${{ env.build_dir }} -S . \
36+
-DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \
37+
-DCMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \
38+
-DCMAKE_BUILD_TYPE=${{ env.config }} \
39+
-DCUBOOL_BUILD_TESTS=ON \
40+
-DCUBOOL_WITH_CUDA=OFF \
41+
-DCUBOOL_WITH_SEQUENTIAL=ON \
42+
-DCUBOOL_GRAPH_ENABLE_TESTING=ON
43+
44+
- name: Build library sources
45+
run: |
46+
cmake --build ${{ env.build_dir }} \
47+
--verbose \
48+
-j10
49+
50+
- name: Prepare upload binary
51+
run: |
52+
tar cfz ${{ env.artifact }} ${{ env.build_dir }}
1753
54+
- name: Upload binary
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: ${{ env.artifact }}
58+
path: ${{ env.artifact }}
59+
60+
test:
61+
name: Test CPU ${{ matrix.cpu }}
62+
needs: build
63+
runs-on: ${{ matrix.os }}
64+
strategy:
65+
fail-fast: false
1866
matrix:
19-
os: [ubuntu-24.04]
20-
c_compiler: [gcc-14]
21-
cpp_compiler: [g++-14]
22-
build_type: [Release, Debug]
67+
include:
68+
- os: ubuntu-22.04
69+
cpu: AMD-EPYC-7763
70+
env:
71+
test-file: cpu_test.log
2372

2473
steps:
25-
- uses: actions/checkout@v2
26-
with:
27-
submodules: recursive
28-
29-
- name: Setup enviroment
30-
run: |
31-
sudo apt update
32-
sudo apt install gcc-14
33-
sudo apt install g++-14
34-
sudo apt install cmake
35-
sudo apt install clang-format
36-
37-
- name: Configure CMake
38-
run: |
39-
cd ${{ github.workspace }}
40-
cmake -B build -S . \
41-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
42-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
43-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
44-
-DCUBOOL_GRAPH_ENABLE_TESTING=ON \
45-
-DCUBOOL_WITH_CUDA=OFF \
46-
-DCUBOOL_WITH_SEQUENTIAL=ON
47-
48-
- name: Build
49-
run: |
50-
cmake --build build -j10
51-
52-
- name: Run tests
53-
run: |
54-
./build/tests/cuboolgraph_tests
74+
- uses: actions/download-artifact@v4
75+
with:
76+
name: ${{ env.artifact }}
77+
78+
- name: Unarchive artifact
79+
run: |
80+
tar xzf ${{ env.artifact }}
81+
rm ${{ env.artifact }}
82+
83+
- name: Run tests
84+
working-directory: ${{ env.build_dir }}/tests
85+
run: |
86+
bash cuboolgraph_tests | tee ${{ env.test-file }}
87+
88+
- name: Upload tests resutls
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: ${{ env.test-file }}
92+
path: ${{ env.build_dir }}/tests/${{ env.test-file }}
93+
94+
- name: Check for unit tests results
95+
working-directory: ${{ env.build_dir }}/tests
96+
run: |
97+
! grep -q "FAILED" ${{ env.test-file }}

0 commit comments

Comments
 (0)