-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (139 loc) · 4.95 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: build
on:
push:
branches:
- '**'
tags-ignore:
- 'v*.*.*'
pull_request:
workflow_call:
jobs:
Build:
name: ${{ matrix.os-name }} (${{ matrix.compiler }}, ${{ matrix.config }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
config: [Release, Debug]
name: [windows-msvc, windows-clang, linux-clang, linux-gcc, macos-clang]
include:
- name: windows-msvc
os: windows-latest
os-name: Windows
compiler: msvc
- name: windows-clang
os: windows-latest
os-name: Windows
compiler: clang-17
- name: linux-clang
os: ubuntu-latest
os-name: Linux
compiler: clang-16
- name: linux-gcc
os: ubuntu-latest
os-name: Linux
compiler: gcc-13
- name: macos-clang
os: macos-14
os-name: MacOS
compiler: clang-17
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ (matrix.os-name != 'MacOS' || !contains(matrix.compiler, 'clang')) && matrix.compiler || '' }}
vcvarsall: ${{ matrix.os-name == 'Windows' }}
cmake: true
ninja: true
- name: (MacOS) Install clang through brew
if: matrix.os-name == 'MacOS' && contains(matrix.compiler, 'clang')
run: |
brew install llvm@17
export LLVM_DIR="$(brew --prefix llvm@17)/lib/cmake"
echo "CC=$(brew --prefix llvm@17)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm@17)/bin/clang++" >> $GITHUB_ENV
echo "$(brew --prefix llvm@17)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@17
- name: Cache Build
uses: actions/cache@v4
with:
path: Build
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.config }}-build-${{ secrets.VCACHE}}
- name: Configure
run: cmake -GNinja -S . -B Build -DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
run: cmake --build Build --config ${{ matrix.config }}
- name: Install
run: cmake --install Build --config ${{ matrix.config }} --prefix Install
- name: Upload installation
uses: actions/upload-artifact@v4
if: ${{ contains(matrix.compiler, 'clang') }} # Only clang artifacts are stored
with:
name: Pipe-${{ matrix.os-name }}-${{ matrix.config }}
path: Install
- name: Run Tests
if: ${{ matrix.os-name != 'macos' }} # Tests are skipped temporarily on MacOS
working-directory: ./Build
run: ctest --output-on-failure -j2 -C ${{ matrix.config }}
Package:
needs: Build
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Download Debug Linux
uses: actions/download-artifact@v4
with:
name: Pipe-Linux-Debug
path: Install/Linux/Debug
- name: Download Release Linux
uses: actions/download-artifact@v4
with:
name: Pipe-Linux-Release
path: Install/Linux/Release
- name: Download Debug Windows
uses: actions/download-artifact@v4
with:
name: Pipe-Windows-Debug
path: Install/Windows/Debug
- name: Download Release Windows
uses: actions/download-artifact@v4
with:
name: Pipe-Windows-Release
path: Install/Windows/Release
- name: Download Debug MacOS
uses: actions/download-artifact@v4
with:
name: Pipe-MacOS-Debug
path: Install/MacOS/Debug
- name: Download Release MacOS
uses: actions/download-artifact@v4
with:
name: Pipe-MacOS-Release
path: Install/MacOS/Release
- name: Copy includes
run: |
mkdir -p Install/Final/include
cp -r Install/Linux/Release/include/. Install/Final/include
- name: Copy binaries
run: |
mkdir -p Install/Final/lib/Linux/Debug
mkdir -p Install/Final/lib/Linux/Release
mkdir -p Install/Final/lib/Windows/Debug
mkdir -p Install/Final/lib/Windows/Release
mkdir -p Install/Final/lib/MacOS/Debug
mkdir -p Install/Final/lib/MacOS/Release
cp -r Install/Linux/Debug/lib/. Install/Final/lib/Linux/Debug
cp -r Install/Linux/Release/lib/. Install/Final/lib/Linux/Release
cp -r Install/Windows/Debug/lib/. Install/Final/lib/Windows/Debug
cp -r Install/Windows/Release/lib/. Install/Final/lib/Windows/Release
cp -r Install/MacOS/Debug/lib/. Install/Final/lib/MacOS/Debug
cp -r Install/MacOS/Release/lib/. Install/Final/lib/MacOS/Release
- name: Upload all
uses: actions/upload-artifact@v4
with:
name: Pipe
path: Install/Final