Files
TheRock/rocm-systems/.github/workflows/rocprofiler-sdk-code_coverage.yml
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

461 lines
17 KiB
YAML

name: rocprofiler-sdk Code Coverage
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- 'projects/rocprofiler-sdk/**'
- '.github/actions/rocprofiler-sdk-util/**'
- '.github/workflows/rocprofiler-sdk-code_coverage.yml'
- '.github/actions/rocprofiler-sdk-util/action.yml'
- '.github/actions/rocprofiler-sdk-util/resolve-ci-config/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
pull_request:
paths:
- 'projects/rocprofiler-sdk/**'
- '.github/actions/rocprofiler-sdk-util/**'
- '.github/workflows/rocprofiler-sdk-code_coverage.yml'
- '.github/actions/rocprofiler-sdk-util/action.yml'
- '.github/actions/rocprofiler-sdk-util/resolve-ci-config/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'
- '!projects/rocprofiler-sdk/CODEOWNERS'
- '!projects/rocprofiler-sdk/source/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
ROCM_PATH: "/opt/rocm"
GPU_TARGETS: "gfx906 gfx908 gfx90a gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201"
PATH: "/usr/bin:$PATH"
SUBMODULE_PATHS: "projects/rocprofiler-sdk projects/aqlprofile projects/rocprofiler-register projects/rocr-runtime projects/clr projects/hip"
## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake
## A task should be assigned directly to fix the issue
## Scratch memory tests need to be fixed for ROCm 7.0 release
navi3_EXCLUDE_TESTS_REGEX: ""
vega20_EXCLUDE_TESTS_REGEX: ""
mi200_EXCLUDE_TESTS_REGEX: ""
mi300_EXCLUDE_TESTS_REGEX: ""
mi300a_EXCLUDE_TESTS_REGEX: ""
mi325_EXCLUDE_TESTS_REGEX: ""
mi3xx_EXCLUDE_TESTS_REGEX: ""
navi4_EXCLUDE_TESTS_REGEX: ""
navi3_EXCLUDE_LABEL_REGEX: ""
vega20_EXCLUDE_LABEL_REGEX: ""
mi200_EXCLUDE_LABEL_REGEX: ""
mi300_EXCLUDE_LABEL_REGEX: ""
mi300a_EXCLUDE_LABEL_REGEX: ""
mi325_EXCLUDE_LABEL_REGEX: ""
mi3xx_EXCLUDE_LABEL_REGEX: ""
navi4_EXCLUDE_LABEL_REGEX: ""
GLOBAL_CMAKE_OPTIONS: ""
ENABLE_ROCR_BUILD: "true"
ENABLE_HIP_CLR_BUILD: "true"
ENABLE_ROCPROFILER_REGISTER_BUILD: "true"
ENABLE_AQLPROFILE_BUILD: "true"
ENABLE_ROCDECODE_BUILD: "true"
ENABLE_ROCJPEG_BUILD: "true"
ENABLE_HIPFILE_BUILD: "true"
jobs:
ci_config:
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
name: Load CI config
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
gfx94x_runner: ${{ steps.runner.outputs.gfx94x_runner }}
gfx94x_sandbox_runner: ${{ steps.runner.outputs.gfx94x_sandbox_runner }}
steps:
- name: Checkout workflow actions
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .github/actions/rocprofiler-sdk-util/resolve-ci-config
set-safe-directory: true
- name: Resolve runner labels
id: runner
uses: ./.github/actions/rocprofiler-sdk-util/resolve-ci-config
code-coverage:
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}
needs: ci_config
name: Code Coverage • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
permissions:
contents: write
pull-requests: write
strategy:
# fail-fast: false
matrix:
system:
- { gpu: 'mi325', os: 'ubuntu-22.04', build-type: 'Release', gpu-target: 'gfx94X' }
runs-on: ${{ needs.ci_config.outputs.gfx94x_runner }}
container:
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
credentials:
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
env:
DEBIAN_FRONTEND: noninteractive
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
GPU_RUNNER: ${{ needs.ci_config.outputs.gfx94x_runner }}
GCC_COMPILER_VERSION: 11
steps:
- name: Clone ROCProfiler SDK & AQLProfile & ROCProfiler Register & ROCR-Runtime
uses: actions/checkout@v6
with:
sparse-checkout: |
.github/actions/rocprofiler-sdk-util
projects/rocprofiler-sdk
projects/aqlprofile
projects/rocprofiler-register
projects/rocr-runtime
projects/clr
projects/hip
projects/hipfile
submodules: false
set-safe-directory: true
- name: Compute submodule cache key
id: submods
shell: bash
run: |
git config --global --add safe.directory '*'
git submodule status --recursive -- ${SUBMODULE_PATHS} > .git-submodules-status-raw
awk '{print $1,$2}' .git-submodules-status-raw > .git-submodules-status
echo "hash=$(sha256sum .git-submodules-status | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
# cache scoped submodule working trees plus their .git/modules gitdirs
awk '{print $2}' .git-submodules-status-raw > .git-submodule-paths
for p in ${SUBMODULE_PATHS}; do echo ".git/modules/${p}"; done >> .git-submodule-paths
{ echo "paths<<EOF"; cat .git-submodule-paths; echo "EOF"; } >> "$GITHUB_OUTPUT"
- name: Restore submodule cache
uses: actions/cache@v6
with:
path: |
${{ steps.submods.outputs.paths }}
key: submods-scoped-v1-${{ runner.os }}-${{ steps.submods.outputs.hash }}
restore-keys: |
submods-scoped-v1-${{ runner.os }}-
- name: Init/Update submodules
run: git submodule update --init --recursive --jobs 16 -- ${SUBMODULE_PATHS}
- name: Clone ROCDecode
uses: actions/checkout@v6
with:
repository: 'ROCm/rocDecode'
ref: 'release/rocm-rel-7.0'
set-safe-directory: true
path: 'rocDecode'
- name: Clone ROCJPEG
uses: actions/checkout@v6
with:
repository: 'ROCm/rocJPEG'
ref: 'release/rocm-rel-7.0'
set-safe-directory: true
path: 'rocJPEG'
- name: Load Existing XML Code Coverage
if: github.event_name == 'pull_request'
id: load-coverage
uses: actions/cache@v6
with:
key: ${{ github.event.pull_request.base.sha }}-codecov
path: .codecov/**
- name: Copy Existing XML Code Coverage
if: github.event_name == 'pull_request'
shell: bash
run: |
if [ -d .codecov ]; then cp -r .codecov .codecov.ref; fi
- name: Configure Env
shell: bash
run: |
echo "${PATH}:/usr/local/bin:${HOME}/.local/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:${HOME}/.local/lib" >> $GITHUB_ENV
- name: Install requirements
timeout-minutes: 10
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential ccache python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev libsqlite3-dev libdrm-dev file autoconf pkg-config rpm libzstd-dev
python3 -m pip install -U --user cmake==3.25.0
python3 -m pip install -U --user -r requirements.txt
- name: Sync gcov with compilers
timeout-minutes: 10
shell: bash
run:
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} &&
update-alternatives
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 500
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }}
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
- name: Enable PC Sampling
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
- name: Build ROCProfiler SDK Dependencies
uses: ./.github/actions/rocprofiler-sdk-util
with:
rocm-path: ${{ env.ROCM_PATH }}
gpu-target: ${{ matrix.system.gpu-target }}
compiler-launcher: /usr/bin/ccache
enable-rocr-build: ${{ env.ENABLE_ROCR_BUILD }}
enable-hip-clr-build: ${{ env.ENABLE_HIP_CLR_BUILD }}
enable-rocprofiler-register-build: ${{ env.ENABLE_ROCPROFILER_REGISTER_BUILD }}
enable-aqlprofile-build: ${{ env.ENABLE_AQLPROFILE_BUILD }}
enable-rocdecode-build: ${{ env.ENABLE_ROCDECODE_BUILD }}
enable-rocjpeg-build: ${{ env.ENABLE_ROCJPEG_BUILD }}
enable-hipfile-build: ${{ env.ENABLE_HIPFILE_BUILD }}
ccache-key: ccache-${{ matrix.system.os }}-${{ needs.ci_config.outputs.gfx94x_runner }}-${{ matrix.system.gpu }}
ccache-variant: ccache
- name: Configure, Build, and Test (Total Code Coverage)
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov
--build-jobs 16
--site ${{ needs.ci_config.outputs.gfx94x_runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage all
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Tests Code Coverage)
timeout-minutes: 30
shell: bash
working-directory: projects/rocprofiler-sdk
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-tests
--build-jobs 16
--site ${{ needs.ci_config.outputs.gfx94x_runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage tests
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Configure, Build, and Test (Samples Code Coverage)
timeout-minutes: 30
working-directory: projects/rocprofiler-sdk
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-samples
--build-jobs 16
--site ${{ needs.ci_config.outputs.gfx94x_runner }}
--gpu-targets ${{ env.GPU_TARGETS }}
--coverage samples
--run-attempt ${{ github.run_attempt }}
--
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
-DPython3_EXECUTABLE=$(which python3)
${{ env.GLOBAL_CMAKE_OPTIONS }}
--
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
- name: Save XML Code Coverage
id: save-coverage
uses: actions/cache/save@v4
with:
key: ${{ github.sha }}-codecov
path: |
projects/rocprofiler-sdk/.codecov/*.xml
- id: generatereport
name: Generate Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 10
working-directory: projects/rocprofiler-sdk
shell: bash
run: |
echo "PWD: ${PWD}"
ls -la
for i in "all" "tests" "samples"; do
wkhtmltoimage --enable-local-file-access --quality 70 .codecov/${i}.html .codecov/${i}.png
done
ls -la .codecov
which -a git
git --version
./source/scripts/upload-image-to-github.py --bot --token ${{ secrets.GITHUB_TOKEN }} --files .codecov/{all,tests,samples}.png --output-dir .codecov --name pr-${{ github.event.pull_request.number }}
echo -e "\n${PWD}:"
ls -la .
echo -e "\n.codecov:"
ls -la .codecov
get-base-md-contents() { cat .codecov/${1}.png.md; }
get-full-md-contents() { cat .codecov/${1}.png.md .codecov/${1}.md; }
cat << EOF > .codecov/report.md
# Code Coverage Report
## Tests Only
$(get-base-md-contents tests)
## Samples Only
$(get-base-md-contents samples)
## Tests + Samples
$(get-base-md-contents all)
<!-- code-coverage-comment-identifier -->
EOF
echo 'CODECOVERAGE_REPORT<<EOF' > $GITHUB_OUTPUT
cat .codecov/report.md >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Write Code Coverage Comment
if: github.event_name == 'pull_request'
timeout-minutes: 10
uses: actions/github-script@v6
env:
COMMENT_BODY: |
<details>
<summary><h2>Code Coverage Report</h2></summary>
<!-- Keep the empty line above to render markdown properly -->
${{ steps.generatereport.outputs.CODECOVERAGE_REPORT }}
</details>
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commentIdentifier = '<!-- code-coverage-comment-identifier -->'; // Used to identify codecov comment
const commentBody = process.env.COMMENT_BODY;
// Fetch existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
});
// Check for an existing comment
const existingComment = comments.find(comment => comment.body.includes(commentIdentifier));
if (existingComment) {
// Update the existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody,
});
core.info(`Updated comment with ID: ${existingComment.id}`);
} else {
// Create a new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: commentBody,
});
core.info('Created a new comment.');
}
- name: Archive Code Coverage Data
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v7
with:
name: code-coverage-details
path: |
${{github.workspace}}/projects/rocprofiler-sdk/.codecov/*
- name: Verify Test Labels
timeout-minutes: 5
shell: bash
working-directory: projects/rocprofiler-sdk
run: |
pushd build
#
# if following fails, there is a test that does not have
# a label identifying it as sample or test (unit or integration).
# Recommended labels are:
# - samples
# - unittests
# - integration-tests
#
ctest -N -LE 'samples|tests' -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" -O ctest.mislabeled.log
grep 'Total Tests: 0' ctest.mislabeled.log
#
# if following fails, then there is overlap between the labels.
# A test cannot both be a sample and (unit/integration) test.
#
ctest -N -O ctest.all.log
ctest -N -O ctest.samples.log -L samples
ctest -N -O ctest.tests.log -L tests
NUM_ALL=$(grep 'Total Tests:' ctest.all.log | awk '{print $NF}')
NUM_SAMPLE=$(grep 'Total Tests:' ctest.samples.log | awk '{print $NF}')
NUM_TEST=$(grep 'Total Tests:' ctest.tests.log | awk '{print $NF}')
NUM_SUM=$((${NUM_SAMPLE} + ${NUM_TEST}))
echo "Total tests: ${NUM_ALL}"
echo "Total labeled tests: ${NUM_SUM}"
if [ ${NUM_ALL} != ${NUM_SUM} ]; then
echo "Test label overlap"
exit 1
fi
popd