-
Notifications
You must be signed in to change notification settings - Fork 3
291 lines (237 loc) · 8.13 KB
/
build.yaml
File metadata and controls
291 lines (237 loc) · 8.13 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# CREDITS
# I took a lot of this code from `cmkr` (developed by Duncan Ogilvie / @mrexodia)
# https://github.com/build-cpp/cmkr/blob/main/.github/workflows/build.yml
name: build
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
name: Build via muuk (${{ matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
compiler: msvc
binary_name: muuk.exe
artifact_name: muuk-windows
zip_name: muuk-windows.zip
muuk_exec: .\muuk.exe
copy_cmd: copy build\release\muuk.exe muuk.exe
- os: macos-latest
compiler: clang
binary_name: muuk
artifact_name: muuk-macos
zip_name: muuk-macos.zip
muuk_exec: ./muuk
copy_cmd: cp build/release/muuk muuk
- os: ubuntu-latest
compiler: gcc
binary_name: muuk
artifact_name: muuk-linux
zip_name: muuk-linux.zip
muuk_exec: ./muuk
copy_cmd: cp build/release/muuk muuk
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v6
- name: Set up MSVC (Windows only)
if: matrix.compiler == 'msvc'
uses: ilammy/msvc-dev-cmd@v1
- name: Use Apple Clang (Xcode)
if: runner.os == 'macOS'
run: |
echo "Using Apple Clang:"
clang++ --version
clang-scan-deps --version || echo "clang-scan-deps not available"
- name: Install LLVM (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential llvm clang lld
echo "LLVM installed at: $(llvm-config --prefix)"
echo "$(llvm-config --bindir)" >> $GITHUB_PATH
- name: Download latest release
shell: bash
run: |
url=$(gh release view --json assets -q ".assets[] | select(.name == \"${{ matrix.zip_name }}\") | .url")
curl -L "$url" -o muuk.zip
unzip -o muuk.zip
if [[ "${{ runner.os }}" != "Windows" ]]; then
chmod +x muuk
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies with muuk
run: ${{ matrix.muuk_exec }} install
- name: Create build directory
shell: bash
run: |
mkdir -p build/release
mkdir -p build/debug
- name: Build project (Release)
run: ${{ matrix.muuk_exec }} build -c ${{ matrix.compiler }} -p release
- name: Copy executable
run: ${{ matrix.copy_cmd }}
- name: Make executable runnable (chmod +x)
if: runner.os != 'Windows'
run: chmod +x ${{ matrix.binary_name }}
- name: Upload raw binary as artifact (for internal use)
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.binary_name }}
- name: Zip for GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: vimtor/action-zip@v1.1
with:
files: ${{ matrix.binary_name }}
dest: ${{ matrix.zip_name }}
# - name: Upload Release (if tagged)
# if: startsWith(github.ref, 'refs/tags/')
# uses: softprops/action-gh-release@v1
# with:
# prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') || contains(github.ref, '-pre') }}
# files: ${{ matrix.zip_name }}
# generate_release_notes: true
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
test:
name: Test the built binary
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: muuk-windows
binary_name: muuk.exe
compiler: msvc
muuk_exec: .\muuk.exe
- os: macos-latest
artifact_name: muuk-macos
binary_name: muuk
compiler: clang
muuk_exec: ./muuk
- os: ubuntu-latest
artifact_name: muuk-linux
binary_name: muuk
compiler: gcc
muuk_exec: ./muuk
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: .
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v6
- name: Set up MSVC (Windows only)
if: matrix.compiler == 'msvc'
uses: ilammy/msvc-dev-cmd@v1
# - name: Install LLVM (macOS only)
# if: runner.os == 'macOS'
# run: |
# brew install llvm
# echo "LLVM installed at: $(brew --prefix llvm)"
# echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
- name: Install LLVM
if: runner.os == 'macOS'
run: |
brew install llvm
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
- name: Verify clang-scan-deps
if: runner.os == 'macOS'
run: clang-scan-deps --version
- name: Install LLVM (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential llvm clang lld
echo "LLVM installed at: $(llvm-config --prefix)"
echo "$(llvm-config --bindir)" >> $GITHUB_PATH
- name: Make binary executable (Linux/macOS only)
if: runner.os != 'Windows'
run: chmod +x muuk
- name: Install dependencies with muuk
run: ${{ matrix.muuk_exec }} install
- name: Create build directory
shell: bash
run: |
mkdir -p build/release
mkdir -p build/debug
- name: Build project
run: ${{ matrix.muuk_exec }} build -c ${{ matrix.compiler }} -p debug
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pytest
run: pip install pytest
- name: Run test
if: runner.os == 'Windows'
run: pytest test/external/test.py
- name: Run C++ tests (Windows)
if: runner.os == 'Windows'
run: ./build/debug/test.exe
# - name: Run C++ tests (Unix)
# if: runner.os != 'Windows'
# run: ./build/debug/test/test
clang:
name: Compile with Clang on ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: muuk-windows
binary_name: muuk.exe
muuk_exec: .\muuk.exe
# - os: macos-latest
# artifact_name: muuk-macos
# binary_name: muuk
# compiler: clang
# muuk_exec: ./muuk
- os: ubuntu-latest
artifact_name: muuk-linux
binary_name: muuk
muuk_exec: ./muuk
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: .
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v6
- name: Set up MSVC (Windows only)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install LLVM (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential llvm clang lld
echo "LLVM installed at: $(llvm-config --prefix)"
echo "$(llvm-config --bindir)" >> $GITHUB_PATH
- name: Make binary executable (Linux/macOS only)
if: runner.os != 'Windows'
run: chmod +x muuk
- name: Install dependencies with muuk
run: ${{ matrix.muuk_exec }} install
- name: Create build directory
shell: bash
run: |
mkdir -p build/release
mkdir -p build/debug
- name: Build project
run: ${{ matrix.muuk_exec }} build -c clang -p debug