Fix: build and help #142
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Linux | |
on: | |
push: | |
branches-ignore: | |
- 'coverityScan' | |
pull_request: | |
branches: | |
- 'main' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-linux: | |
name: '${{ matrix.os.id }} (${{ matrix.compiler }})' | |
runs-on: ${{ matrix.os.id }} | |
strategy: | |
matrix: | |
os: | |
- { id: ubuntu-22.04, name: jammy } | |
- { id: ubuntu-24.04, name: noble } | |
compiler: | |
- 'clang-13' | |
- 'clang-14' | |
- 'clang-15' | |
- 'clang-16' | |
- 'clang-17' | |
- 'clang-18' | |
- 'gcc-9' | |
- 'gcc-10' | |
- 'gcc-11' | |
- 'gcc-12' | |
- 'gcc-13' | |
exclude: | |
# Exclude compilers that don't exist on the new LTS | |
- os: { id: ubuntu-24.04, name: noble } | |
compiler: 'clang-13' | |
- os: { id: ubuntu-24.04, name: noble } | |
compiler: 'clang-14' | |
- os: { id: ubuntu-24.04, name: noble } | |
compiler: 'clang-15' | |
- os: { id: ubuntu-24.04, name: noble } | |
compiler: 'clang-16' | |
fail-fast: false | |
env: | |
BUILD_OPTS: '' | |
steps: | |
- name: Runtime environment | |
shell: bash | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV | |
- name: Setup GCC | |
if: startsWith(matrix.compiler, 'gcc') | |
shell: bash | |
run: | | |
CXX=${CC/#gcc/g++} | |
sudo apt-add-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install $CC $CXX | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
echo "GCOV=${CC/#gcc/gcov}" >> $GITHUB_ENV | |
env: | |
CC: ${{ matrix.compiler }} | |
- name: Setup Clang | |
if: startsWith(matrix.compiler, 'clang') | |
shell: bash | |
run: | | |
wget https://apt.llvm.org/llvm-snapshot.gpg.key | |
sudo apt-key add llvm-snapshot.gpg.key | |
rm llvm-snapshot.gpg.key | |
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }}${CC/#clang/} main" | |
sudo apt-get update | |
sudo apt-get install $CC | |
CXX=${CC/#clang/clang++} | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
echo "GCOV=${CC/#clang/llvm-cov} gcov" >> $GITHUB_ENV | |
env: | |
CC: ${{ matrix.compiler }} | |
working-directory: ${{ runner.temp }} | |
- name: Remove old LLVM 12 plugins | |
run: | | |
sudo apt purge llvm-12-linker-tools || true | |
- name: Remove old LLVM 13 plugins | |
if: matrix.compiler != 'clang-13' | |
run: | | |
sudo apt purge llvm-13-linker-tools || true | |
- name: Remove old LLVM 14 plugins | |
if: matrix.compiler != 'clang-14' | |
run: | | |
sudo apt purge llvm-14-linker-tools || true | |
- name: Remove old LLVM 15 plugins | |
if: matrix.compiler != 'clang-15' | |
run: | | |
sudo apt purge llvm-15-linker-tools || true | |
- name: Install dependencies | |
shell: bash | |
run: sudo apt-get install libudev-dev | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja + gcovr | |
shell: bash | |
run: | | |
sudo python3 -m pip install --break-system-packages --upgrade pip setuptools wheel | |
python3 -m pip install --break-system-packages --user 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 | |
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' && matrix.compiler != 'clang-17' | |
# Codecov no longer parses gcov files automatically | |
run: | | |
rm -rf build | |
meson setup build --prefix=$HOME/.local -Db_coverage=true --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.id }}-${{ matrix.compiler }} | |
path: ${{ github.workspace }}/build/meson-logs/* | |
retention-days: 5 | |
- name: Codecov | |
if: success() && github.repository == 'blackmagic-debug/bmpflash' && matrix.compiler != 'clang-17' | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: ./build/meson-logs/ | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} |