Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit clang format changes instead of failing the CI when checking? #762

Open
sjalander opened this issue Jan 21, 2025 · 1 comment
Open
Assignees

Comments

@sjalander
Copy link
Collaborator

Should we change the clang-format CI action such that it runs the actual formatting and upon detecting changed files commit these to the local branch?

This avoids failing the CI simply because one have forgotten to run clang-format.

This action seems to have the necessary functionality:
https://github.com/stefanzweifel/git-auto-commit-action

This change to .github/workflows/ClangFormat.yml should achieve it:

jobs:
  CheckFormat:
    runs-on: ubuntu-22.04

    permissions:
      # Give the default GITHUB_TOKEN write permission to commit and push the
      # added or changed files to the repository.
      contents: write

    steps:
      - uses: actions/checkout@v4
      - name: "Install clang format"
        uses: ./.github/actions/InstallPackages
        with:
          install-llvm: true # Needed to configure jlm
          install-clang-format: true
      - name: "Configure jlm with HLS and MLIR enabled"
        run: ./configure.sh --enable-mlir --enable-hls
      - name: "Check format"
        run: make format
      - name: "Commit all changed files back to the repository"
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
        commit_message: Automated clang-format
@phate
Copy link
Owner

phate commented Jan 23, 2025

@sjalander I agree that it is a bit annoying to fix the formatting sometimes and that this could be automated. Thus, I am kind of in favor of this and do not really see a problem. What bothers me a bit though is that we bind ourselves to a third party action with this.

@haved What do you think about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants