1- # Original script from https://github.com/ptheywood/cuda-cmake-github-actions
2-
31name : Ubuntu
42
53on :
97 branches : [ master ]
108 workflow_dispatch :
119
10+ env :
11+ build_dir : " build"
12+ artifact : " cubool-ubuntu-build.tar.xz"
13+
1214jobs :
1315 build :
14- name : Build ${{ matrix.os }} GCC ${{ matrix.gcc }} CUDA ${{ matrix.cuda }}
16+ name : Build ${{ matrix.os }}
1517 runs-on : ${{ matrix.os }}
1618 strategy :
1719 fail-fast : false
1820 matrix :
1921 include :
20- - os : ubuntu-18.04
21- cuda : " 10.1"
22- gcc : 8
22+ - os : ubuntu-22.04
2323 env :
24- build_dir : " build"
2524 config : " Release"
26- artifact : " cubool-ubuntu-build.tar.xz"
2725
2826 steps :
29- - uses : actions/checkout@v2
27+ - uses : actions/checkout@v4
3028 with :
3129 submodules : true
32- - uses : actions/setup-python@v2
33- with :
34- python-version : ' 3.7'
3530
36- - name : Install CUDA
37- env :
38- cuda : ${{ matrix.cuda }}
31+ - name : Configure CMake build
3932 run : |
40- source ./scripts/install_cuda_ubuntu.sh
41- if [[ $? -eq 0 ]]; then
42- # Set paths for subsequent steps, using ${CUDA_PATH}
43- echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
44- echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
45- echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
46- echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
47- fi
48- shell : bash
49-
50- - name : Install and configure GCC and GXX
33+ cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCUBOOL_BUILD_TESTS=ON -DCUBOOL_WITH_CUDA=OFF
34+
35+ - name : Build library sources
5136 run : |
52- sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
53- echo "СС=/usr/bin/gcc-${{ matrix.gcc }}" >> $GITHUB_ENV
54- echo "CXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
55- echo "CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
37+ cmake --build ${{ env.build_dir }} --target all --verbose -j `nproc`
5638
57- - name : Configure CMake build
58- run : cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCUBOOL_BUILD_TESTS=YES
39+ - name : Prepare upload binary
40+ run : |
41+ tar cfz ${{ env.artifact }} ${{ env.build_dir }}
5942
60- - name : Build library sources
43+ - name : Upload binary
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : ${{ env.artifact }}
47+ path : ${{ env.artifact }}
48+
49+ test :
50+ name : Test CPU ${{ matrix.cpu }}
51+ needs : build
52+ runs-on : ${{ matrix.os }}
53+ strategy :
54+ fail-fast : false
55+ matrix :
56+ include :
57+ - os : ubuntu-22.04
58+ cpu : AMD-EPYC-7763
59+ env :
60+ unit-test-file : cpu_test_all.log
61+ regression-test-file : cpu_test_regression.log
62+
63+ steps :
64+ - uses : actions/download-artifact@v4
65+ with :
66+ name : ${{ env.artifact }}
67+
68+ - name : Unarchive artifact
69+ run : |
70+ tar xzf ${{ env.artifact }}
71+ rm ${{ env.artifact }}
72+
73+ - name : Run unit-tests
6174 working-directory : ${{ env.build_dir }}
62- run : cmake --build . --target all --verbose -j `nproc`
75+ run : |
76+ bash scripts/run_tests_all.sh | tee ${{ env.unit-test-file }}
77+
78+ - name : Upload unit tests resutls
79+ uses : actions/upload-artifact@v4
80+ with :
81+ name : ${{ env.unit-test-file }}
82+ path : ${{ env.build_dir }}/${{ env.unit-test-file }}
6383
64- - name : Run unit- tests (sequential backend)
84+ - name : Check for unit tests results
6585 working-directory : ${{ env.build_dir }}
66- run : bash scripts/run_tests_fallback.sh
67- shell : bash
86+ run : |
87+ ! grep -q "FAILED" ${{ env.unit-test-file }}
6888
69- - name : Run regression-tests (sequential backend)
89+ - name : Run regression-tests
7090 working-directory : ${{ env.build_dir }}/python
71- run : bash run_tests.sh
72- shell : bash
73-
74- - name : Prepare upload binary
75- shell : bash
76- run : tar cfz ${{ env.artifact }} ${{ env.build_dir }}
91+ run : |
92+ bash run_tests.sh 2>&1 | tee ${{ env.regression-test-file }}
7793
78- - name : Upload binary
79- uses : actions/upload-artifact@v2
94+ - name : Upload regression tests resutls
95+ uses : actions/upload-artifact@v4
8096 with :
81- name : ${{ env.artifact }}
82- path : ${{ env.artifact }}
97+ name : ${{ env.regression-test-file }}
98+ path : ${{ env.build_dir }}/python/${{ env.regression-test-file }}
99+
100+ - name : Check for regression tests results
101+ working-directory : ${{ env.build_dir }}/python
102+ run : |
103+ ! grep -q "FAILED" ${{ env.regression-test-file }}
0 commit comments