Skip to content

Fix: build and help #96

Fix: build and help

Fix: build and help #96

Workflow file for this run

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 }}