[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:
zatwierdzone przez
GitHub
rodzic
e28900793b
commit
9df2c1ec68
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user