Skip to content

Fix: build and help #130

Fix: build and help

Fix: build and help #130

Workflow file for this run

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