-
Notifications
You must be signed in to change notification settings - Fork 3
176 lines (172 loc) · 5.44 KB
/
build-macos.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
name: Build macOS
on:
push:
branches-ignore:
- 'coverityScan'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-macos:
name: '${{ matrix.os }} (Apple Clang)'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os:
- macos-12
- macos-13
- macos-14
build_opts:
- ''
include:
# static+LTO forced build to uncover any potential symbols issues with Mach-O
# single test to save runners as they are scarse and should validate all possible configurations
- os: macos-latest
build_opts: '-Db_lto=true -Ddefault_library=static'
fail-fast: false
env:
BUILD_OPTS: ${{ matrix.build_opts }}
steps:
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: true
- name: Setup Meson + Ninja + gcovr
run: |
brew install meson ninja gcovr
working-directory: ${{ runner.temp }}
- name: Version tools
run: |
cc --version || true
ld --version || true
gcov --version || true
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'
# Codecov no longer parses gcov files automatically
run: |
rm -rf build
meson setup build --prefix=$HOME/.local -Db_coverage=true --buildtype=debug $BUILD_OPTS
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 }}-appleclang
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 }}
build-macos-homebrew:
# Apple LLD is unable to link GCC < 11 generated object files.
# https://stackoverflow.com/questions/73714336/xcode-update-to-version-2395-ld-compile-problem-occurs-computedatomcount-m
# rdar://FB11369327
name: '${{ matrix.os }} (homebrew, ${{ matrix.compiler }})'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os:
- macos-latest
compiler:
- gcc@11
- gcc@12
- gcc@13 # needs hardcoding for the GCOV replacement
fail-fast: false
env:
BUILD_OPTS: ''
steps:
- name: Runtime environment
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV
- name: Setup compiler
run: |
brew install ${{ matrix.compiler }}
CC=${COMPILER/@/-}
CXX=${CC/#gcc/g++}
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV
echo "GCOV=${CC/#gcc/gcov}" >> $GITHUB_ENV
env:
COMPILER: ${{ matrix.compiler }}
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: true
- name: Setup Meson + Ninja + gcovr
run: |
brew install meson ninja gcovr
working-directory: ${{ runner.temp }}
- name: Version tools
shell: bash
run: |
$CC --version
$CXX --version
$GCOV --version
meson --version
ninja --version
- name: Configure
# GCC on macOS cannot do LTO for now due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111635
run: meson setup build --prefix=$HOME/.local -Db_lto=false $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_lto=false -Db_coverage=true --buildtype=debug $BUILD_OPTS
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 }}-homebrew-${{ matrix.compiler }}
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 }}