Skip to content

Add environment on Edge Webview #1466

Add environment on Edge Webview

Add environment on Edge Webview #1466

Workflow file for this run

name: CI
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
init:
runs-on: ubuntu-22.04
outputs:
gcovr-version: ${{ steps.vars.outputs.gcovr-version }}
steps:
- id: vars
run: |
echo "gcovr-version=7.2" >> "${GITHUB_OUTPUT}"
check:
uses: ./.github/workflows/check.yaml
build:
needs:
- check
- init
uses: ./.github/workflows/build.yaml
with:
gcovr-version: ${{ needs.init.outputs.gcovr-version }}
build-pr:
if: github.event_name == 'pull_request'
needs:
- check
- init
uses: ./.github/workflows/build.yaml
with:
gcovr-version: ${{ needs.init.outputs.gcovr-version }}
pr: true
merge-package-artifacts:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Merge package artifacts
uses: actions/upload-artifact/merge@v4
with:
name: package
pattern: package_*
delete-merged: true
retention-days: 1
generate-coverage-report:
needs:
- build
- init
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
run: >
sudo apt-get update && sudo apt-get install --no-install-recommends -y
python3
python3-lxml
python3-markupsafe
python3-pip
- name: Install gcovr
run: pip install "gcovr==${{ needs.init.outputs.gcovr-version }}"
- name: Merge test coverage artifacts
uses: actions/upload-artifact/merge@v4
with:
name: test_coverage_data
pattern: test_coverage_data_*
delete-merged: true
retention-days: 1
separate-directories: true
- name: Download merged test coverage artifacts
uses: actions/download-artifact@v4
with:
name: test_coverage_data
- name: Generate report
id: generate-report
run: |
tracefile_args=()
while read f; do
tracefile_args+=(--add-tracefile "${f}")
done <<< "$(find . -type f -name "coverage.json")"
artifact_dir="temp_${RANDOM}/report"
mkdir -p "${artifact_dir}/html"
gcovr --config gcovr.ci.cfg --json "${artifact_dir}/gcovr.json" "${tracefile_args[@]}"
gcovr --config gcovr.ci.cfg --coveralls "${artifact_dir}/coveralls.json" --add-tracefile "${artifact_dir}/gcovr.json"
gcovr --config gcovr.ci.cfg --json-summary "${artifact_dir}/summary.json" --add-tracefile "${artifact_dir}/gcovr.json"
gcovr --config gcovr.ci.cfg --html-details "${artifact_dir}/html/index.html" --add-tracefile "${artifact_dir}/gcovr.json"
echo "upload-dir=${artifact_dir}" >> "${GITHUB_OUTPUT}"
- name: Upload report artifacts
uses: actions/upload-artifact@v4
with:
name: test_coverage_report
path: ${{ steps.generate-report.outputs.upload-dir }}
retention-days: 1
if-no-files-found: error
- name: Add report to CI job summary
uses: actions/github-script@v7
with:
script: |
const numberOr = (value, alternative) => Number.isNaN(value = parseInt(value)) ? alternative : value;
const percentValue = (value, percentSymbol = "%") => numberOr(value, "-") + percentSymbol;
const data = require("./${{ steps.generate-report.outputs.upload-dir }}/summary.json");
await core.summary
.addHeading("Test Coverage Summary")
.addTable([
[
{ data: "Lines", header: true },
{ data: "Functions", header: true },
{ data: "Branches", header: true }
],
[
`${percentValue(data.line_percent)} ${data.line_covered}/${data.line_total}`,
`${percentValue(data.function_percent)} ${data.function_covered}/${data.function_total}`,
`${percentValue(data.branch_percent)} ${data.branch_covered}/${data.branch_total}`
]
])
.addTable([
[
{ data: "File", header: true },
{ data: "Lines", header: true },
{ data: "Functions", header: true },
{ data: "Branches", header: true }
],
...data.files.map(file => [
file.filename,
`${percentValue(file.line_percent)} ${file.line_covered}/${file.line_total}`,
`${percentValue(file.function_percent)} ${file.function_covered}/${file.function_total}`,
`${percentValue(file.branch_percent)} ${file.branch_covered}/${file.branch_total}`
])
])
.write();