ci: Migrate the Coverity workflow to a Github Action #22
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: Coverity | |
on: | |
push: | |
branches: | |
- coverityScan | |
jobs: | |
scan-linux: | |
runs-on: ubuntu-20.04 | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Runtime environment | |
shell: bash | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV | |
- name: Setup 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: gcc-11 | |
- name: Checkout substrate | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja | |
shell: bash | |
run: | | |
sudo pip3 install --upgrade pip setuptools wheel | |
pip3 install --user meson ninja | |
working-directory: ${{ runner.temp }} | |
- name: Version tools | |
shell: bash | |
run: | | |
$CC --version | |
$CXX --version | |
$GCOV --version | |
meson --version | |
ninja --version | |
- name: Configure | |
shell: bash | |
run: | | |
meson setup build --prefix=$HOME/.local -Dcpp_std=c++17 | |
echo "SUBSTRATE_VERSION=`meson introspect build --projectinfo | jq -r '.["version"]'`-`git rev-parse --short HEAD`" >> $GITHUB_ENV | |
- name: Run and upload Coverity | |
uses: vapier/coverity-scan-action@v1 | |
with: | |
command: ninja -C build | |
email: [email protected] | |
project: substrate | |
version: ${{ env.SUBSTRATE_VERSION }} | |
description: A collection of headers containing useful tools and gadgets for building C++ programs | |
token: ${{ secrets.COVERITY_SCAN_TOKEN }} |