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
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: Get number of threads
 | 
						|
description: Determines number of threads to use on macOS and Linux
 | 
						|
inputs:
 | 
						|
  substract_threads:
 | 
						|
    description: How many threads to substract from the calculated number
 | 
						|
    required: true
 | 
						|
    default: "0"
 | 
						|
outputs:
 | 
						|
  threads_number:
 | 
						|
    description: Number of threads to use
 | 
						|
    value: ${{ steps.number_of_threads_export.outputs.num }}
 | 
						|
runs:
 | 
						|
  using: composite
 | 
						|
  steps:
 | 
						|
    - name: Get number of threads on mac
 | 
						|
      id: mac_threads
 | 
						|
      if: ${{ runner.os == 'macOS' }}
 | 
						|
      shell: bash
 | 
						|
      run: echo "num=$(($(sysctl -n hw.logicalcpu) - 2))" >> $GITHUB_OUTPUT
 | 
						|
 | 
						|
    - name: Get number of threads on Linux
 | 
						|
      id: linux_threads
 | 
						|
      if: ${{ runner.os == 'Linux' }}
 | 
						|
      shell: bash
 | 
						|
      run: echo "num=$(($(nproc) - 2))" >> $GITHUB_OUTPUT
 | 
						|
 | 
						|
    - name: Shift and export number of threads
 | 
						|
      id: number_of_threads_export
 | 
						|
      shell: bash
 | 
						|
      run: |
 | 
						|
        num_of_threads=${{ steps.mac_threads.outputs.num || steps.linux_threads.outputs.num }}
 | 
						|
        shift_by=${{ inputs.substract_threads }}
 | 
						|
        shifted=$((num_of_threads - shift_by))
 | 
						|
        echo "num=$(( shifted > 1 ? shifted : 1 ))" >> $GITHUB_OUTPUT
 |