Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100
AllowShortFunctionsOnASingleLine: Empty
DerivePointerAlignment: false
PointerAlignment: Left
ReflowComments: true
73 changes: 73 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "Pre-commit Format & Lint"
on:
pull_request:
branches:
- develop
- staging

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:

- name: Checkout code (initial)
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
sparse-checkout: .github
sparse-checkout-cone-mode: true
token: ${{ secrets.ROCM_SV_TOKEN }}

- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydantic requests pre-commit
sudo apt-get update
sudo apt-get install -y clang-format

- name: Configure Git
run: |
git config user.name "assistant-librarian[bot]"
git config user.email "assistant-librarian[bot]@users.noreply.github.com"

- name: Detect changed subtrees
id: detect
env:
GH_TOKEN: ${{ secrets.ROCM_SV_TOKEN }}
run: |
python .github/scripts/pr_detect_changed_subtrees.py \
--repo "${{ github.repository }}" \
--pr "${{ github.event.pull_request.number }}" \
--config ".github/repos-config.json" \
--require-fanout

- name: Checkout full repo with changed subtrees
if: steps.detect.outputs.subtrees
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
sparse-checkout: |
.github
${{ steps.detect.outputs.subtrees }}
fetch-depth: 0
token: ${{ secrets.ROCM_SV_TOKEN }}

- name: Get list of changed files
id: changed-files
uses: tj-actions/changed-files@v34

- name: Run pre-commit hooks
run: |
CHANGED="${{ steps.changed-files.outputs.all_modified_files }}"
if [ -z "$CHANGED" ]; then
echo "No files changed, skipping pre-commit."
exit 0
fi
echo "Running pre-commit on these files:"
echo "$CHANGED"
pre-commit run --files $CHANGED --show-diff-on-failure
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
exclude: |
third_party/

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.4
hooks:
- id: clang-format
name: clang-format (C/C++/ObjC)
entry: clang-format -i -style=file
files: '\.(c|cpp|cc|h|hpp|m|mm)$'
2 changes: 1 addition & 1 deletion projects/hipcub/hipcub/include/hipcub/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef HIPCUB_TUPLE_HPP_
#ifndef HIPCUB_TUPLE_HPP_
#define HIPCUB_TUPLE_HPP_

#include "config.hpp"
Expand Down
Loading