-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (106 loc) · 3.67 KB
/
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Build
on:
push:
branches:
- "*"
paths:
# This action only runs on push when C++ files are changed
- "**.cpp"
- "**.h"
- "**.cmake"
- "**Lists.txt"
workflow_dispatch:
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules
# Allow one concurrent build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest - MSVC",
os: windows-latest,
cc: "cl",
cxx: "cl",
ext: ".exe",
buildtype: "Release",
}
- {
name: "Ubuntu Latest - GCC",
os: ubuntu-latest,
cc: "gcc",
cxx: "g++",
ext: "",
buildtype: Release,
}
- {
name: "MacOS Latest - Clang",
os: macos-latest,
cc: "clang",
cxx: "clang++",
ext: "",
buildtype: "Release",
}
steps:
- uses: actions/checkout@v3
# on linux and mac use the ninja generator
- name: Install Ninja generator
if: runner.os != 'Windows'
uses: seanmiddleditch/gha-setup-ninja@master
- uses: actions/cache@v2
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
# Setup caching of build artifacts to reduce total build time (only Linux and MacOS)
- name: ccache
if: runner.os != 'Windows'
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.config.os }}-${{ matrix.config.buildtype }}
- name: Install dependencies (macOS)
shell: bash
working-directory: ${{github.workspace}}
if: runner.os == 'macOS'
run: |
brew install openvdb
- name: Install dependencies (linux)
shell: bash
working-directory: ${{github.workspace}}
if: runner.os == 'Linux'
run: |
sudo apt install libopenvdb-dev
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}
if: runner.os != 'Windows'
run: |
cmake -B ${{github.workspace}}/build/${{ matrix.config.buildtype }} -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Configure CMake (Windows)
working-directory: ${{github.workspace}}
if: runner.os == 'Windows'
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }}
- name: Build
shell: bash
working-directory: ${{github.workspace}}
if: runner.os != 'Windows'
run: cmake --build ${{github.workspace}}/build/${{ matrix.config.buildtype }} --parallel 4 --config ${{ matrix.config.buildtype }}
- name: Build (Windows)
working-directory: ${{github.workspace}}
if: runner.os == 'Windows'
run: cmake --build ${{github.workspace}}/build/ --parallel 4 --config ${{ matrix.config.buildtype }}
- name: Testing that code runs
shell: bash
working-directory: ${{github.workspace}}
run: |
pwd
./build/${{ matrix.config.buildtype }}/opentonano${{matrix.ext}} # change this or add to it as we progress through the assignments