mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 03:45:50 +00:00 
			
		
		
		
	There are 2 things to know about prettier: - it's quite pretty most of the time - it's not configurable
		
			
				
	
	
		
			120 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			120 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: Clang-tidy check
 | 
						|
on:
 | 
						|
  schedule:
 | 
						|
    - cron: "0 9 * * 1-5"
 | 
						|
  workflow_dispatch:
 | 
						|
  pull_request:
 | 
						|
    branches: [develop]
 | 
						|
    paths:
 | 
						|
      - .clang_tidy
 | 
						|
      - .github/workflows/clang-tidy.yml
 | 
						|
  workflow_call:
 | 
						|
 | 
						|
jobs:
 | 
						|
  clang_tidy:
 | 
						|
    runs-on: heavy
 | 
						|
    container:
 | 
						|
      image: rippleci/clio_ci:latest
 | 
						|
    permissions:
 | 
						|
      contents: write
 | 
						|
      issues: write
 | 
						|
      pull-requests: write
 | 
						|
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v4
 | 
						|
        with:
 | 
						|
          fetch-depth: 0
 | 
						|
 | 
						|
      - name: Prepare runner
 | 
						|
        uses: ./.github/actions/prepare_runner
 | 
						|
        with:
 | 
						|
          disable_ccache: true
 | 
						|
 | 
						|
      - name: Setup conan
 | 
						|
        uses: ./.github/actions/setup_conan
 | 
						|
        id: conan
 | 
						|
        with:
 | 
						|
          conan_profile: clang
 | 
						|
 | 
						|
      - name: Restore cache
 | 
						|
        uses: ./.github/actions/restore_cache
 | 
						|
        id: restore_cache
 | 
						|
        with:
 | 
						|
          conan_dir: ${{ env.CONAN_USER_HOME }}/.conan
 | 
						|
          ccache_dir: ${{ env.CCACHE_DIR }}
 | 
						|
          conan_profile: ${{ steps.conan.outputs.conan_profile }}
 | 
						|
 | 
						|
      - name: Run conan and cmake
 | 
						|
        uses: ./.github/actions/generate
 | 
						|
        with:
 | 
						|
          conan_profile: ${{ steps.conan.outputs.conan_profile }}
 | 
						|
          conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
 | 
						|
          build_type: Release
 | 
						|
 | 
						|
      - name: Get number of threads
 | 
						|
        uses: ./.github/actions/get_number_of_threads
 | 
						|
        id: number_of_threads
 | 
						|
 | 
						|
      - name: Run clang-tidy
 | 
						|
        continue-on-error: true
 | 
						|
        shell: bash
 | 
						|
        id: run_clang_tidy
 | 
						|
        run: |
 | 
						|
          run-clang-tidy-19 -p build -j ${{ steps.number_of_threads.outputs.threads_number }} -fix -quiet 1>output.txt
 | 
						|
 | 
						|
      - name: Check format
 | 
						|
        if: ${{ steps.run_clang_tidy.outcome != 'success' }}
 | 
						|
        continue-on-error: true
 | 
						|
        shell: bash
 | 
						|
        run: ./.githooks/check-format
 | 
						|
 | 
						|
      - name: Print issues found
 | 
						|
        if: ${{ steps.run_clang_tidy.outcome != 'success' }}
 | 
						|
        shell: bash
 | 
						|
        run: |
 | 
						|
          sed -i '/error\||/!d' ./output.txt
 | 
						|
          cat output.txt
 | 
						|
          rm output.txt
 | 
						|
 | 
						|
      - name: Create an issue
 | 
						|
        if: ${{ steps.run_clang_tidy.outcome != 'success' }}
 | 
						|
        id: create_issue
 | 
						|
        uses: ./.github/actions/create_issue
 | 
						|
        env:
 | 
						|
          GH_TOKEN: ${{ github.token }}
 | 
						|
        with:
 | 
						|
          title: "Clang-tidy found bugs in code 🐛"
 | 
						|
          body: >
 | 
						|
            Clang-tidy found issues in the code:
 | 
						|
 | 
						|
            List of the issues found: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/
 | 
						|
 | 
						|
      - uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec #v6.3.0
 | 
						|
        if: ${{ steps.run_clang_tidy.outcome != 'success' }}
 | 
						|
        with:
 | 
						|
          gpg_private_key: ${{ secrets.ACTIONS_GPG_PRIVATE_KEY }}
 | 
						|
          passphrase: ${{ secrets.ACTIONS_GPG_PASSPHRASE }}
 | 
						|
          git_user_signingkey: true
 | 
						|
          git_commit_gpgsign: true
 | 
						|
 | 
						|
      - name: Create PR with fixes
 | 
						|
        if: ${{ steps.run_clang_tidy.outcome != 'success' }}
 | 
						|
        uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e #v7.0.8
 | 
						|
        env:
 | 
						|
          GH_REPO: ${{ github.repository }}
 | 
						|
          GH_TOKEN: ${{ github.token }}
 | 
						|
        with:
 | 
						|
          commit-message: "[CI] clang-tidy auto fixes"
 | 
						|
          committer: Clio CI <skuznetsov@ripple.com>
 | 
						|
          branch: "clang_tidy/autofix"
 | 
						|
          branch-suffix: timestamp
 | 
						|
          delete-branch: true
 | 
						|
          title: "style: clang-tidy auto fixes"
 | 
						|
          body: "Fixes #${{ steps.create_issue.outputs.created_issue_id }}. Please review and commit clang-tidy fixes."
 | 
						|
          reviewers: "godexsoft,kuznetsss,PeterChen13579"
 | 
						|
 | 
						|
      - name: Fail the job
 | 
						|
        if: ${{ steps.run_clang_tidy.outcome != 'success' }}
 | 
						|
        shell: bash
 | 
						|
        run: exit 1
 |