formatting #2413
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: rocprofiler-systems Formatting | |
| run-name: formatting | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| paths: | |
| - 'projects/rocprofiler-systems/**' | |
| - '!**/*.md' | |
| - '!**/*.rtf' | |
| - '!**/*.rst' | |
| - '!**/.markdownlint-ci2.yaml' | |
| - '!**/.readthedocs.yaml' | |
| - '!**/.spellcheck.local.yaml' | |
| - '!**/.wordlist.txt' | |
| - '!docs/**' | |
| - '!projects/*/docs/**' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/rocprofiler-systems-formatting.yml' | |
| - 'projects/rocprofiler-systems/**' | |
| - '!**/*.md' | |
| - '!**/*.rtf' | |
| - '!**/*.rst' | |
| - '!**/.markdownlint-ci2.yaml' | |
| - '!**/.readthedocs.yaml' | |
| - '!**/.spellcheck.local.yaml' | |
| - '!**/.wordlist.txt' | |
| - '!docs/**' | |
| - '!projects/*/docs/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint-md: | |
| name: "Markdown" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: projects/rocprofiler-systems | |
| - name: Fetch config | |
| shell: sh | |
| working-directory: projects/rocprofiler-systems/ | |
| run: | | |
| test -f .markdownlint.yaml && echo "Using local config file" || curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/develop/.markdownlint.yaml -O | |
| - name: Use markdownlint-cli2 | |
| uses: DavidAnson/[email protected] | |
| with: | |
| globs: "projects/rocprofiler-systems/**/*.md" | |
| spelling: | |
| name: "Spelling" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: projects/rocprofiler-systems | |
| - name: Fetch config | |
| working-directory: | |
| shell: sh | |
| run: | | |
| cp projects/rocprofiler-systems/.wordlist.txt . | |
| curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/develop/.spellcheck.yaml -o .spellcheck.yaml | |
| curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/develop/.wordlist.txt >> .wordlist.txt | |
| sed -i "s|docs/\*\*/\*.md|projects/rocprofiler-systems/docs/**/*.md|g" .spellcheck.yaml | |
| - name: Run spellcheck | |
| uses: rojopolis/[email protected] | |
| - name: On fail | |
| if: failure() | |
| run: | | |
| echo "Please check for spelling mistakes or add them to '.wordlist.txt' in either the root of this project or in rocm-docs-core." | |
| python: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| python-version: ['3.10'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: projects/rocprofiler-systems | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: black format | |
| run: | | |
| cd projects/rocprofiler-systems | |
| black --diff --check . | |
| cmake: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: projects/rocprofiler-systems | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-pip | |
| python3 -m pip install gersemi==0.23.1 | |
| - name: gersemi | |
| working-directory: projects/rocprofiler-systems/ | |
| run: | | |
| set +e | |
| gersemi -i $(find . -type f ! -path '*/external/*' | grep -E 'CMakeLists.txt|\.cmake$') | |
| if [ $(git diff | wc -l) -gt 0 ]; then | |
| echo -e "\nError! CMake code not formatted. Run gersemi ...\n" | |
| echo -e "\nFiles:\n" | |
| git diff --name-only | |
| echo -e "\nFull diff:\n" | |
| git diff | |
| exit 1 | |
| fi | |
| source: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: projects/rocprofiler-systems | |
| - 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 wget curl clang-format-18 | |
| - name: clang-format | |
| working-directory: projects/rocprofiler-systems/ | |
| run: | | |
| set +e | |
| FILES=$(find source examples tests -type f | egrep '\.(h|hpp|c|cpp)(|\.in)$') | |
| FORMAT_OUT=$(clang-format-18 -output-replacements-xml ${FILES}) | |
| RET=$(echo ${FORMAT_OUT} | grep -c '<replacement ') | |
| if [ "${RET}" -ne 0 ]; then | |
| echo -e "\nError! Code not formatted. Detected ${RET} lines\n" | |
| clang-format-18 -i ${FILES} | |
| git diff | |
| exit ${RET} | |
| fi | |
| includes: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: projects/rocprofiler-systems | |
| - name: check-includes | |
| working-directory: projects/rocprofiler-systems/ | |
| run: | | |
| set +e | |
| FILES=$(find source examples -type f | egrep '\.(hpp|cpp)(|\.in)$') | |
| MATCHES=$(egrep 'include "timemory/|include <bits/' ${FILES}) | |
| if [ -n "${MATCHES}" ]; then | |
| echo -e "\nError! Included timemory header with quotes or bits folder included\n" | |
| echo -e "### MATCHES: ###" | |
| echo -e "${MATCHES}" | |
| echo -e "################" | |
| exit 1 | |
| fi |