[rocprof-compute] Automate ctest coverage and test cases on runners with CDash (#1481)
* Add nightly coverage workflow * ruff formatting * temp workflow testing * restore workflow file * add workflow condition * update workflow file * update workflow file * fix typo in run-ci.py * edit run-ci.py * add python deps install * add python deps install * add python deps install * add python deps install * check if enable coverage is on when using workflow * remove github CI breakdown and fix enable coverage * set cache variables must be set before dashboard starts * Update run-ci.py * Update run-ci.py to fix ctest cache * Update rocprofiler-compute-code-coverage.yml to install tests * Update rocprofiler-compute-code-coverage.yml * Restore workflow file * Update run-ci.py * Simplify workflow build command * Update run-ci.py to build tests * edited run-ci script * edit ctest configure commands * edit ctest configure commands to be on one line * edit ctest configure command to include path to amdclang++ * update clang check in tests/cmakelists.txt * update rocm * update rocm * update rocm version 7.0.2 * update tests/CMakeLists.txt * use tarball instead for rocm install * apt install rocm-dev instead for 7.0.0 release * workflow tweaks * update to use new 'tools' dir * install rocm-dev * add CMAKE_CXX_COMPILER as clang * update tests/cmakelists.txt * update cdasg site and build names * remove run automatically on pull requests * ruff format * increased timeouts for tests * add back reruns for workflow testing * fix typo * rename workflow "nightly" -> "code" * added tracks to keep track of gpu (325 vs 355) * remove test_db_connector.py * revert build names and tracking * update workflow pushes * CMake format * changed parallel level back to 1
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
75ad45d5f1
Коммит
d49e2e35fd
@@ -1,89 +0,0 @@
|
||||
name: rocprofiler-compute CDash Coverage Upload
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
paths:
|
||||
- 'projects/rocprofiler-compute/coverage/Coverage.xml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
coverage_file:
|
||||
description: 'Path to coverage XML file'
|
||||
required: false
|
||||
default: 'projects/rocprofiler-compute/coverage/Coverage.xml'
|
||||
|
||||
concurrency:
|
||||
group: rocprofiler-compute-cdash-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
upload-coverage:
|
||||
runs-on: ubuntu-latest
|
||||
name: Upload Coverage to CDash
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: projects/rocprofiler-compute
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
- name: Check Coverage File Exists
|
||||
working-directory: projects/rocprofiler-compute
|
||||
run: |
|
||||
COVERAGE_FILE="${{ github.event.inputs.coverage_file || 'coverage/Coverage.xml' }}"
|
||||
if [[ "$COVERAGE_FILE" == projects/rocprofiler-compute/* ]]; then
|
||||
COVERAGE_FILE="${COVERAGE_FILE#projects/rocprofiler-compute/}"
|
||||
fi
|
||||
|
||||
if [ ! -f "$COVERAGE_FILE" ]; then
|
||||
echo "ERROR: Coverage file not found at $COVERAGE_FILE!"
|
||||
echo "Please run manual coverage generation"
|
||||
echo "Use: cd projects/rocprofiler-compute && ./utils/update_coverage.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COVERAGE_INFO=$(python3 -c "
|
||||
import xml.etree.ElementTree as ET
|
||||
try:
|
||||
tree = ET.parse('$COVERAGE_FILE')
|
||||
root = tree.getroot()
|
||||
line_rate = float(root.get('line-rate', 0)) * 100
|
||||
print(f'{line_rate:.1f}%')
|
||||
except Exception as e:
|
||||
print(f'Error parsing coverage: {e}')
|
||||
exit(1)
|
||||
")
|
||||
|
||||
echo "Line Coverage: $COVERAGE_INFO"
|
||||
echo "COVERAGE_INFO=$COVERAGE_INFO" >> $GITHUB_ENV
|
||||
echo "COVERAGE_FILE=$COVERAGE_FILE" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload to CDash
|
||||
working-directory: projects/rocprofiler-compute
|
||||
run: |
|
||||
GIT_SHA_SHORT=$(git rev-parse --short HEAD)
|
||||
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
||||
|
||||
python3 utils/run-ci.py \
|
||||
--coverage-file "${{ env.COVERAGE_FILE }}" \
|
||||
--build-name "${BRANCH_NAME}-${GIT_SHA_SHORT}-$(date +%Y%m%d)" \
|
||||
--mode "Continuous" \
|
||||
--site "Monorepo-Upload" \
|
||||
--project-name "rocprofiler-compute" \
|
||||
--source-dir "." \
|
||||
--binary-dir "build"
|
||||
|
||||
- name: Summary
|
||||
run: |
|
||||
echo "## CDash Upload Complete!" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Line Coverage**: ${{ env.COVERAGE_INFO }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Commit**: $(git rev-parse --short HEAD)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **CDash Project**: rocprofiler-compute" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Coverage File**: ${{ env.COVERAGE_FILE }}" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -0,0 +1,157 @@
|
||||
name: rocprofiler-compute Code Coverage
|
||||
run-name: rocprofiler-compute-code-coverage
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
runner_matrix:
|
||||
description: 'Runner configuration'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
env:
|
||||
ROCM_PATH: "/opt/rocm"
|
||||
ROCM_VERSION: "7.0.2"
|
||||
|
||||
jobs:
|
||||
prepare_matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.generate_matrix.outputs.matrix }}
|
||||
|
||||
steps:
|
||||
- name: Generate matrix
|
||||
id: generate_matrix
|
||||
run: |
|
||||
MATRIX='[{"os-release":"22.04","gpu":"mi355","arch":"gfx950","runner":"linux-mi355-1gpu-ossci-rocm","code-name":"jammy"},{"os-release":"24.04","gpu":"mi355","arch":"gfx950","runner":"linux-mi355-1gpu-ossci-rocm","code-name":"noble"},{"os-release":"22.04","gpu":"mi325","arch":"gfx94X","runner":"linux-mi325-1gpu-ossci-rocm","code-name":"jammy"},{"os-release":"24.04","gpu":"mi325","arch":"gfx94X","runner":"linux-mi325-1gpu-ossci-rocm","code-name":"noble"}]'
|
||||
|
||||
if [ -n "${{ github.event.inputs.runner_matrix }}" ]; then
|
||||
MATRIX='${{ github.event.inputs.runner_matrix }}'
|
||||
fi
|
||||
|
||||
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
|
||||
|
||||
coverage:
|
||||
name: Coverage • ${{ matrix.system.gpu }} • Ubuntu ${{ matrix.system.os-release }}
|
||||
needs: prepare_matrix
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
system: ${{ fromJSON(needs.prepare_matrix.outputs.matrix) }}
|
||||
runs-on: ${{ matrix.system.runner }}
|
||||
env:
|
||||
HIP_PLATFORM: "amd"
|
||||
OMPI_ALLOW_RUN_AS_ROOT: 1
|
||||
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
|
||||
permissions:
|
||||
packages: read
|
||||
container:
|
||||
image: ghcr.io/rocm/rocprofiler-ubuntu:${{ matrix.system.os-release }}-systems-ci-${{ matrix.system.arch }}
|
||||
options:
|
||||
--privileged
|
||||
--ipc host
|
||||
--group-add video
|
||||
--device /dev/kfd
|
||||
--device /dev/dri
|
||||
--cap-add CAP_SYS_ADMIN
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
sparse-checkout: projects/rocprofiler-compute/
|
||||
|
||||
- name: Update system packages
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get dist-upgrade -y
|
||||
echo "✅ System packages updated!"
|
||||
|
||||
- name: Install amdgpu and dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
ROCM_MAJOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $1}')
|
||||
ROCM_MINOR=$(echo ${{ env.ROCM_VERSION }} | sed 's/\./ /g' | awk '{print $2}')
|
||||
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
|
||||
wget -N -P /tmp/ https://repo.radeon.com/amdgpu-install/${ROCM_MAJOR}.${ROCM_MINOR}/ubuntu/${{ matrix.system.code-name }}/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
|
||||
apt-get install -y /tmp/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
|
||||
apt-get update
|
||||
apt install -y amd-smi-lib libdw-dev
|
||||
echo "✅ amdgpu and dependencies Installed!"
|
||||
|
||||
- name: Install MPI
|
||||
run: |
|
||||
apt install -y libopenmpi-dev
|
||||
echo "✅ MPI Installed!"
|
||||
|
||||
- name: Install ROCm
|
||||
run: |
|
||||
apt install -y rocm-dev
|
||||
echo "✅ ROCm Installation Complete!"
|
||||
|
||||
- name: Install Python Dependencies
|
||||
working-directory: projects/rocprofiler-compute
|
||||
run: |
|
||||
pip install -r requirements.txt --break-system-packages --ignore-installed
|
||||
pip install -r requirements-test.txt --break-system-packages --ignore-installed
|
||||
echo "✅ Python dependencies installed!"
|
||||
|
||||
- name: Configure, Build, Test, and Upload Coverage
|
||||
id: run_coverage
|
||||
timeout-minutes: 120
|
||||
working-directory: projects/rocprofiler-compute
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set -e
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
git config --global --add safe.directory ${PWD}
|
||||
|
||||
BUILD_NAME="ROCm/rocprofiler-compute-${{ github.ref_name }}-ubuntu-${{ matrix.system.os-release }}-${{ matrix.system.gpu }}"
|
||||
SITE_NAME="${{ matrix.system.runner }}"
|
||||
|
||||
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH \
|
||||
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH \
|
||||
python3 ./tools/run-ci.py \
|
||||
--build-name "${BUILD_NAME}" \
|
||||
--site "${SITE_NAME}" \
|
||||
--mode "Nightly" \
|
||||
--build-jobs 16 \
|
||||
--pytest-numprocs 8 \
|
||||
--install
|
||||
|
||||
- name: Check Coverage Configuration
|
||||
if: always()
|
||||
working-directory: projects/rocprofiler-compute
|
||||
run: |
|
||||
echo "=== Checking Build Configuration ==="
|
||||
if [ -f "build/CMakeCache.txt" ]; then
|
||||
echo "CMakeCache.txt contents (relevant variables):"
|
||||
grep -E "ENABLE_TESTS|ENABLE_COVERAGE|INSTALL_TESTS|PYTEST_NUMPROCS" build/CMakeCache.txt || echo "⚠️ Coverage variables not found!"
|
||||
echo ""
|
||||
echo "=== Checking for coverage.xml ==="
|
||||
if [ -f "build/coverage.xml" ]; then
|
||||
echo "✅ coverage.xml found!"
|
||||
ls -lh build/coverage.xml
|
||||
else
|
||||
echo "❌ coverage.xml NOT found!"
|
||||
fi
|
||||
echo ""
|
||||
echo "=== Checking CTest results ==="
|
||||
if [ -f "build/Testing/Temporary/LastTest.log" ]; then
|
||||
echo "Last 50 lines of test log:"
|
||||
tail -n 50 build/Testing/Temporary/LastTest.log
|
||||
fi
|
||||
else
|
||||
echo "❌ build/CMakeCache.txt not found - build may have failed!"
|
||||
fi
|
||||
|
||||
- name: Upload Logs on Failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-logs-${{ matrix.system.gpu }}-${{ matrix.system.os-release }}
|
||||
path: |
|
||||
projects/rocprofiler-compute/build/Testing/Temporary/LastTest*.log
|
||||
projects/rocprofiler-compute/build/coverage.xml
|
||||
retention-days: 7
|
||||
Ссылка в новой задаче
Block a user