-
Notifications
You must be signed in to change notification settings - Fork 3
192 lines (188 loc) · 5.73 KB
/
build-windows.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
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
name: Build Windows
on:
push:
branches-ignore:
- 'coverityScan'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-windows:
name: '${{ matrix.os }} (msvc ${{ matrix.arch }})'
runs-on: ${{ matrix.os }}
# if: false
strategy:
matrix:
os:
- windows-2022
arch:
- x86
- amd64
fail-fast: false
env:
CC: cl.exe
CXX: cl.exe
LD: link.exe
BUILD_OPTS: ''
steps:
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "${env:HOME}/.local/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "GITHUB_WORKSPACE=${{ env.WORKSPACE }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Install OpenCppCoverage
if: github.repository == 'blackmagic-debug/bmpflash'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install OpenCppCoverage
- name: Setup OpenCppCoverage
if: github.repository == 'blackmagic-debug/bmpflash'
run: |
echo "C:/Program Files/OpenCppCoverage" >> $env:GITHUB_PATH
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: true
- name: Setup Meson + Ninja
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install meson ninja
working-directory: ${{ runner.temp }}
- name: Version tools
run: |
cl /Bv
link
meson --version
ninja --version
- name: Configure
run: meson setup build --prefix=$HOME/.local $BUILD_OPTS
- name: Build
run: meson compile -C build
- name: Test
run: meson test -C build
- name: Install
run: meson install -C build
- name: Run coverage build
if: github.repository == 'blackmagic-debug/bmpflash'
run: |
Remove-Item -Recurse build
meson setup build --prefix=$HOME/.local -Db_coverage=true --buildtype=debug -Ddefault_library=static
meson compile -C build
meson test -C build
ninja -C build coverage-xml
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.os }}-${{ matrix.arch }}
path: |
${{ github.workspace }}/build/meson-logs
${{ github.workspace }}/build/test
retention-days: 5
- name: Codecov
if: success() && github.repository == 'blackmagic-debug/bmpflash'
uses: codecov/codecov-action@v4
with:
directory: ./build/meson-logs/
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
build-windows-mingw:
name: '${{ matrix.os }} (${{ matrix.sys }})'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: msys2 {0}
strategy:
matrix:
os:
- windows-2022
sys:
- mingw64
- ucrt64
- clang64
fail-fast: false
env:
BUILD_OPTS: ''
steps:
- name: Use MinGW from MSYS
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
path-type: inherit
pacboy: >-
toolchain:p
lcov:p
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "GITHUB_WORKSPACE=${{ env.WORKSPACE }}" >> $GITHUB_ENV
- name: Setup GCC
if: startsWith(matrix.sys, 'mingw') || startsWith(matrix.sys, 'ucrt64')
run: |
echo "GCOV=gcov" >> $GITHUB_ENV
- name: Setup Clang
if: startsWith(matrix.sys, 'clang')
run: |
echo "GCOV=llvm-cov gcov" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: true
- name: Setup Meson + Ninja + gcovr
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install meson ninja gcovr
working-directory: ${{ runner.temp }}
- name: Version tools
run: |
cc --version
c++ --version
$GCOV --version
meson --version
ninja --version
- name: Configure
run: meson build --prefix=$HOME/.local $BUILD_OPTS
- name: Build
run: meson compile -C build
- name: Test
run: meson test -C build
- name: Install
run: meson install -C build
- name: Run coverage build
if: github.repository == 'blackmagic-debug/bmpflash'
# Codecov no longer parses gcov files automatically
run: |
rm -rf build
meson setup build --prefix=$HOME/.local -Db_coverage=true -Db_lto=false --buildtype=debug
meson compile -C build
meson test -C build
ninja -C build coverage-xml
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.os }}-${{ matrix.sys }}
path: ${{ github.workspace }}/build/meson-logs/*
retention-days: 5
- name: Codecov
if: success() && github.repository == 'blackmagic-debug/bmpflash'
uses: codecov/codecov-action@v4
with:
directory: ./build/meson-logs/
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}