mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 03:45:50 +00:00 
			
		
		
		
	I started with really simple pre-commit hooks and will add more on top. Important files: - `.pre-commit-config.yaml` - the config for pre-commit - `.github/workflows/pre-commit.yml` - runs pre-commit hooks in branches and `develop` - `.github/workflows/pre-commit-autoupdate.yml` - autoupdates pre-commit hooks once in a month
		
			
				
	
	
		
			73 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: Prepare runner
 | 
						|
description: Install packages, set environment variables, create directories
 | 
						|
inputs:
 | 
						|
  disable_ccache:
 | 
						|
    description: Whether ccache should be disabled
 | 
						|
    required: true
 | 
						|
runs:
 | 
						|
  using: composite
 | 
						|
  steps:
 | 
						|
    - name: Install packages on mac
 | 
						|
      if: ${{ runner.os == 'macOS' }}
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
          brew install llvm@14 pkg-config ninja bison ccache jq gh conan@1 ca-certificates
 | 
						|
          echo "/opt/homebrew/opt/conan@1/bin" >> $GITHUB_PATH
 | 
						|
 | 
						|
    - name: Install CMake 3.31.6 on mac
 | 
						|
      if: ${{ runner.os == 'macOS' }}
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
          # Uninstall any existing cmake
 | 
						|
          brew uninstall cmake --ignore-dependencies || true
 | 
						|
 | 
						|
          # Download specific cmake formula
 | 
						|
          FORMULA_URL="https://raw.githubusercontent.com/Homebrew/homebrew-core/b4e46db74e74a8c1650b38b1da222284ce1ec5ce/Formula/c/cmake.rb"
 | 
						|
          FORMULA_EXPECTED_SHA256="c7ec95d86f0657638835441871e77541165e0a2581b53b3dd657cf13ad4228d4"
 | 
						|
 | 
						|
          mkdir -p /tmp/homebrew-formula
 | 
						|
          curl -s -L $FORMULA_URL -o /tmp/homebrew-formula/cmake.rb
 | 
						|
 | 
						|
          # Verify the downloaded formula
 | 
						|
          ACTUAL_SHA256=$(shasum -a 256 /tmp/homebrew-formula/cmake.rb | cut -d ' ' -f 1)
 | 
						|
          if [ "$ACTUAL_SHA256" != "$FORMULA_EXPECTED_SHA256" ]; then
 | 
						|
            echo "Error: Formula checksum mismatch"
 | 
						|
            echo "Expected: $FORMULA_EXPECTED_SHA256"
 | 
						|
            echo "Actual: $ACTUAL_SHA256"
 | 
						|
            exit 1
 | 
						|
          fi
 | 
						|
 | 
						|
          # Install cmake from the specific formula with force flag
 | 
						|
          brew install --force /tmp/homebrew-formula/cmake.rb
 | 
						|
 | 
						|
    - name: Fix git permissions on Linux
 | 
						|
      if: ${{ runner.os == 'Linux' }}
 | 
						|
      shell: bash
 | 
						|
      run: git config --global --add safe.directory $PWD
 | 
						|
 | 
						|
    - name: Set env variables for macOS
 | 
						|
      if: ${{ runner.os == 'macOS' }}
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
        echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
 | 
						|
        echo "CONAN_USER_HOME=${{ github.workspace }}" >> $GITHUB_ENV
 | 
						|
 | 
						|
    - name: Set env variables for Linux
 | 
						|
      if: ${{ runner.os == 'Linux' }}
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
        echo "CCACHE_DIR=/root/.ccache" >> $GITHUB_ENV
 | 
						|
        echo "CONAN_USER_HOME=/root/" >> $GITHUB_ENV
 | 
						|
 | 
						|
    - name: Set CCACHE_DISABLE=1
 | 
						|
      if: ${{ inputs.disable_ccache == 'true' }}
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
        echo "CCACHE_DISABLE=1" >> $GITHUB_ENV
 | 
						|
 | 
						|
    - name: Create directories
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
        mkdir -p $CCACHE_DIR
 | 
						|
        mkdir -p $CONAN_USER_HOME/.conan
 |