[StepSecurity] Apply security best practices #125
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
# Copyright (c) Prevail Verifier contributors. | |
# SPDX-License-Identifier: MIT | |
name: CPP Code Coverage | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
jobs: | |
build_ubuntu: | |
permissions: | |
checks: write # for coverallsapp/github-action to create new checks | |
contents: read # for actions/checkout to fetch code | |
strategy: | |
matrix: | |
configurations: [Debug, Release] | |
runs-on: ubuntu-latest | |
env: | |
# Configuration type to build. For documentation on how build matrices work, see | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: ${{matrix.configurations}} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Install dependencies | |
run: | | |
sudo apt install libboost-dev libboost-filesystem-dev libboost-program-options-dev libyaml-cpp-dev lcov | |
pip install gcovr | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: 'recursive' | |
- name: Build | |
run: | | |
mkdir build | |
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_CONFIGURATION}} -DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage -g" | |
cmake --build build -j $(nproc) | |
- name: Run unit tests | |
run: ./tests --abort --reporter compact | |
- name: Generate code coverage report | |
run: | | |
mkdir coverage | |
lcov --capture --directory build --include '*/ebpf-verifier/src/*' --output-file coverage/lcov.info | |
- name: Coveralls Parallel | |
uses: coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # master | |
with: | |
github-token: ${{ secrets.github_token }} | |
flag-name: run-${{ matrix.configurations }} | |
parallel: true | |
finish: | |
permissions: | |
checks: write # for coverallsapp/github-action to create new checks | |
needs: build_ubuntu | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@09b709cf6a16e30b0808ba050c7a6e8a5ef13f8d # master | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true |