-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (78 loc) · 3.03 KB
/
ubuntu_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Ubuntu build
on:
push:
paths:
- "src/**"
- "lib/**"
- "CMakeLists.txt"
- "scripts/actions/**"
- ".github/workflows/ubuntu_build.yml"
pull_request:
paths:
- "src/**"
- "lib/**"
- "CMakeLists.txt"
- "scripts/actions/**"
- ".github/workflows/ubuntu_build.yml"
defaults:
run:
shell: bash
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-18.04, ubuntu-16.04 ]
cuda: [ "11.2", "11.1", "11.0", "10.2", "10.1", "10.0" ]
gcc: [ 8, 7, 6 ]
exclude:
# Cuda 10.0 doesn't support Ubuntu 20.04
- os: ubuntu-20.04
cuda: "10.0"
# Cuda 10.0 only supports gcc 7 and older
- cuda: "10.0"
gcc: 8
# gcc 6 is deprecated for Ubuntu 20.04
- os: ubuntu-20.04
gcc: 6
runs-on: ${{ matrix.os }}
steps:
# If this is a pull request action NOT from a fork, then cancel run PR checks, run push checks only
# (this is done to avoid double checks on PRs from not forks)
- name: Cancelling the workflow to avoid duplicated runs
if: success() && github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name
id: steps_skiper
run: |
echo THE WORKFLOW RUN WILL BE SKIPPED, because there is another workflow with the same context
echo "::set-output name=SKIP_STEPS::true"
- uses: actions/checkout@v2
if: success() && steps.steps_skiper.outputs.SKIP_STEPS != 'true'
with:
submodules: recursive
- name: Install/Select gcc and g++
if: success() && steps.steps_skiper.outputs.SKIP_STEPS != 'true'
run: |
sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
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
- name: Install CUDA
if: success() && steps.steps_skiper.outputs.SKIP_STEPS != 'true'
run: |
./scripts/actions/install_cuda_${{ matrix.cuda }}.sh
sudo ln -s /usr/local/cuda* /usr/local/cuda
/usr/local/cuda/bin/nvcc -V
echo "/usr/local/cuda/bin/" >> $GITHUB_PATH
- name: Build project
if: success() && steps.steps_skiper.outputs.SKIP_STEPS != 'true'
run: |
mkdir -p build && cd build
# Using the `for`s instead of matrix above to save time spent on preparing environment (i. e. installing CUDA)
for build_type in Release Debug; do
for compile_for_cpu_mode in OFF ON; do
echo BUILDING AS $build_type WITH COMPILE_FOR_CPU=$compile_for_cpu_mode
cmake .. -DCMAKE_BUILD_TYPE=$build_type -DCOMPILE_FOR_CPU=$compile_for_cpu_mode
cmake --build . --target all --verbose -j `nproc`
make clean
done
done