[rocprofiler-sdk] Fix formatting, linting, and CI workflows (#345)
* [rocprofiler-sdk] Fix formatting and lint workflows - several formatting workflows were silently failing when listing files * format metrics_test.h * Improve formatting job robustness * Source formatting workflow does not use container * Use PyPi clang-format * Format rocpd/source/csv.cpp source * Fix rocprofiler-sdk CI workflow - fix invalid context access * Update run-ci.py - fix ctest_update * Update run-ci.py - handle old checkout in ROCm/rocprofiler-sdk
This commit is contained in:
کامیت شده توسط
GitHub
والد
e28900793b
کامیت
9df2c1ec68
@@ -101,7 +101,7 @@ jobs:
|
||||
ls -la
|
||||
|
||||
- name: Enable PC Sampling
|
||||
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
|
||||
if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }}
|
||||
shell: bash
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run:
|
||||
@@ -113,41 +113,40 @@ jobs:
|
||||
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 }}-core
|
||||
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core
|
||||
--build-jobs 16
|
||||
--site ${RUNNER_HOSTNAME}
|
||||
--gpu-targets ${{ env.GPU_TARGETS }}
|
||||
--run-attempt ${{ github.run_attempt }}
|
||||
${{ matrix.system.ci-flags }}
|
||||
--
|
||||
-DROCPROFILER_DEP_ROCMCORE=ON
|
||||
-DROCPROFILER_BUILD_DOCS=OFF
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk
|
||||
-DCPACK_GENERATOR='DEB;RPM;TGZ'
|
||||
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
||||
--
|
||||
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
|
||||
-LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}"
|
||||
-E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}"
|
||||
|
||||
- name: Install
|
||||
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 10
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run:
|
||||
cmake --build build --target install --parallel 16
|
||||
|
||||
- name: Build Packaging
|
||||
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 10
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run:
|
||||
cmake --build build --target package --parallel 16
|
||||
|
||||
- name: Test Install Build
|
||||
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 20
|
||||
shell: bash
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
@@ -157,11 +156,11 @@ jobs:
|
||||
export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH}
|
||||
cmake --build build-samples --target all --parallel 16
|
||||
cmake --build build-tests --target all --parallel 16
|
||||
ctest --test-dir build-samples -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-tests -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-samples -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-tests -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
|
||||
- name: Install Packages
|
||||
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 5
|
||||
shell: bash
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
@@ -174,7 +173,7 @@ jobs:
|
||||
for i in $(ls -S ./build/rocprofiler-sdk*.deb | egrep -v 'roctx|rocpd'); do dpkg --force-all -i ${i}; done;
|
||||
|
||||
- name: Test Installed Packages
|
||||
if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
|
||||
if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
timeout-minutes: 20
|
||||
shell: bash
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
@@ -183,11 +182,11 @@ jobs:
|
||||
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb -DGPU_TARGETS="gfx942" /opt/rocm/share/rocprofiler-sdk/tests
|
||||
cmake --build build-samples-deb --target all --parallel 16
|
||||
cmake --build build-tests-deb --target all --parallel 16
|
||||
ctest --test-dir build-samples-deb -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-tests-deb -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-samples-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
ctest --test-dir build-tests-deb -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" --output-on-failure
|
||||
|
||||
- name: Archive production artifacts
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }}
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && contains(matrix.runner, env.CORE_EXT_RUNNER) }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installers-deb
|
||||
|
||||
@@ -34,15 +34,20 @@ jobs:
|
||||
id: extract_branch
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip
|
||||
python3 -m pip install -U cmake-format
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
- name: Run cmake-format
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
FORMAT_FILES=$(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
|
||||
command -v cmake-format
|
||||
cmake-format --version
|
||||
set +e
|
||||
cmake-format -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
|
||||
cmake-format -i ${FORMAT_FILES}
|
||||
if [ $(git diff | wc -l) -ne 0 ]; then
|
||||
echo -e "\nError! CMake code not formatted. Run cmake-format...\n"
|
||||
echo -e "\nFiles:\n"
|
||||
@@ -53,8 +58,7 @@ jobs:
|
||||
fi
|
||||
|
||||
source:
|
||||
runs-on: ubuntu-latest
|
||||
container: rocm/dev-ubuntu-22.04:latest
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -63,24 +67,31 @@ jobs:
|
||||
with:
|
||||
sparse-checkout: projects/rocprofiler-sdk
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}')
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y software-properties-common python3 python3-pip build-essential
|
||||
sudo apt install -y wget curl clang-format-11
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Run clang-format
|
||||
- name: Install dependencies
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}')
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y software-properties-common python3 python3-pip
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
- name: Run clang-format
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
FORMAT_FILES=$(find samples source tests benchmark -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
|
||||
command -v git
|
||||
command -v clang-format
|
||||
git --version
|
||||
clang-format --version
|
||||
set +e
|
||||
FILES=$(find samples source tests benchmark -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
|
||||
FORMAT_OUT=$(clang-format-11 -i ${FILES})
|
||||
FORMAT_OUT=$(clang-format -i ${FORMAT_FILES})
|
||||
git status
|
||||
if [ $(git diff | wc -l) -ne 0 ]; then
|
||||
echo -e "\nError! Code not formatted. Run clang-format (version 11)...\n"
|
||||
echo -e "\nFiles:\n"
|
||||
@@ -115,13 +126,14 @@ jobs:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install black
|
||||
python -m pip install -r requirements.txt
|
||||
|
||||
- name: black format
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
cd projects/rocprofiler-sdk
|
||||
black .
|
||||
if [ $(git diff | wc -l) -ne 0 ]; then
|
||||
echo -e "\nError! Python code not formatted. Run black...\n"
|
||||
@@ -140,8 +152,15 @@ jobs:
|
||||
with:
|
||||
sparse-checkout: projects/rocprofiler-sdk
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: |
|
||||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Find missing new line
|
||||
shell: bash
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
OUTFILE=missing_newline.txt
|
||||
for i in $(find source tests samples benchmark docker cmake -type f | egrep -v '\.(bin|png|csv)$|source/docs/_(build|doxygen)'); do VAL=$(tail -c 1 ${i}); if [ -n "${VAL}" ]; then echo "- ${i}" >> ${OUTFILE}; fi; done
|
||||
|
||||
@@ -31,13 +31,13 @@ jobs:
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
cd projects/rocprofiler-sdk
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
- name: Lint with flake8
|
||||
working-directory: projects/rocprofiler-sdk
|
||||
run: |
|
||||
cd projects/rocprofiler-sdk
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 source --count --show-source --statistics --select=E9,F63,F7,F82
|
||||
# flake8 options are defined in .flake8
|
||||
|
||||
مرجع در شماره جدید
Block a user