Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: "Coverage"

on:
schedule:
- cron: "0 8,20 * * 1-5"
push:
branches:
- main
workflow_dispatch:

permissions: read-all

jobs:
coverage_virtual:
name: "Coverage Virtual"
runs-on:
[
self-hosted,
1ES.Pool=gha-vmss-d16av5-ci,
"JobId=ci_coverage-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}",
]
container:
image: mcr.microsoft.com/azurelinux/base/core:3.0
options: --user root --publish-all --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_PTRACE

steps:
- name: "Checkout dependencies"
shell: bash
run: |
set -ex
gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY
tdnf -y update
tdnf -y install ca-certificates git

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0

- name: "Install dependencies"
shell: bash
run: |
set -ex
./scripts/setup-ci.sh

- name: "Build Debug with coverage"
run: |
set -ex
git config --global --add safe.directory /__w/CCF/CCF
mkdir build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON ..
ninja
shell: bash

- name: "Run Unit tests"
run: |
set -ex
cd build
./tests.sh --output-on-failure -L unit -j$(nproc --all)
shell: bash

- name: "End to end tests except partition"
run: |
set -ex
cd build
rm -rf /github/home/.cache
mkdir -p /github/home/.cache

# End to end tests
./tests.sh --timeout 360 --output-on-failure -LE "benchmark|suite|unit"
shell: bash

- name: "Generate coverage reports"
run: |
set -exo pipefail
cd build
../scripts/coverage.sh --html coverage_html | tee coverage_report.txt
shell: bash

- name: "Write coverage summary"
if: always()
run: |
set -ex
cd build
if [[ -f coverage_report.txt ]]; then
{
echo '## Code Coverage'
echo ''
echo '```'
cat coverage_report.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fi
shell: bash

- name: "Upload HTML coverage report"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-report-html
path: build/coverage_html/
if-no-files-found: ignore
if: success() || failure()

- name: "Upload logs"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: logs-coverage-virtual
path: |
build/workspace/*/*.config.json
build/workspace/*/out
build/workspace/*/err
build/workspace/*/*.ledger/*
build/workspace/*/stack_trace
if-no-files-found: ignore
if: success() || failure()