mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 20:05:51 +00:00
ci: Use XRPLF/get-nproc (#2727)
This commit is contained in:
14
.github/actions/build-clio/action.yml
vendored
14
.github/actions/build-clio/action.yml
vendored
@@ -5,19 +5,19 @@ inputs:
|
|||||||
targets:
|
targets:
|
||||||
description: Space-separated build target names
|
description: Space-separated build target names
|
||||||
default: all
|
default: all
|
||||||
subtract_threads:
|
nproc_subtract:
|
||||||
description: An option for the action get-threads-number.
|
description: The number of processors to subtract when calculating parallelism.
|
||||||
required: true
|
required: true
|
||||||
default: "0"
|
default: "0"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Get number of threads
|
- name: Get number of processors
|
||||||
uses: ./.github/actions/get-threads-number
|
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
||||||
id: number_of_threads
|
id: nproc
|
||||||
with:
|
with:
|
||||||
subtract_threads: ${{ inputs.subtract_threads }}
|
subtract: ${{ inputs.nproc_subtract }}
|
||||||
|
|
||||||
- name: Build targets
|
- name: Build targets
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -27,5 +27,5 @@ runs:
|
|||||||
cd build
|
cd build
|
||||||
cmake \
|
cmake \
|
||||||
--build . \
|
--build . \
|
||||||
--parallel "${{ steps.number_of_threads.outputs.threads_number }}" \
|
--parallel "${{ steps.nproc.outputs.nproc }}" \
|
||||||
--target ${CMAKE_TARGETS}
|
--target ${CMAKE_TARGETS}
|
||||||
|
|||||||
38
.github/actions/get-threads-number/action.yml
vendored
38
.github/actions/get-threads-number/action.yml
vendored
@@ -1,38 +0,0 @@
|
|||||||
name: Get number of threads
|
|
||||||
description: Determines number of threads to use on macOS and Linux
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
subtract_threads:
|
|
||||||
description: How many threads to subtract 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
|
|
||||||
env:
|
|
||||||
SUBTRACT_THREADS: ${{ inputs.subtract_threads }}
|
|
||||||
run: |
|
|
||||||
num_of_threads="${{ steps.mac_threads.outputs.num || steps.linux_threads.outputs.num }}"
|
|
||||||
shift_by="${SUBTRACT_THREADS}"
|
|
||||||
shifted="$((num_of_threads - shift_by))"
|
|
||||||
echo "num=$(( shifted > 1 ? shifted : 1 ))" >> $GITHUB_OUTPUT
|
|
||||||
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
@@ -91,19 +91,6 @@ updates:
|
|||||||
prefix: "ci: [DEPENDABOT] "
|
prefix: "ci: [DEPENDABOT] "
|
||||||
target-branch: develop
|
target-branch: develop
|
||||||
|
|
||||||
- package-ecosystem: github-actions
|
|
||||||
directory: .github/actions/get-threads-number/
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
day: monday
|
|
||||||
time: "04:00"
|
|
||||||
timezone: Etc/GMT
|
|
||||||
reviewers:
|
|
||||||
- XRPLF/clio-dev-team
|
|
||||||
commit-message:
|
|
||||||
prefix: "ci: [DEPENDABOT] "
|
|
||||||
target-branch: develop
|
|
||||||
|
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: .github/actions/git-common-ancestor/
|
directory: .github/actions/git-common-ancestor/
|
||||||
schedule:
|
schedule:
|
||||||
|
|||||||
8
.github/workflows/clang-tidy.yml
vendored
8
.github/workflows/clang-tidy.yml
vendored
@@ -61,16 +61,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
conan_profile: ${{ env.CONAN_PROFILE }}
|
conan_profile: ${{ env.CONAN_PROFILE }}
|
||||||
|
|
||||||
- name: Get number of threads
|
- name: Get number of processors
|
||||||
uses: ./.github/actions/get-threads-number
|
uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a
|
||||||
id: number_of_threads
|
id: nproc
|
||||||
|
|
||||||
- name: Run clang-tidy
|
- name: Run clang-tidy
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
shell: bash
|
shell: bash
|
||||||
id: run_clang_tidy
|
id: run_clang_tidy
|
||||||
run: |
|
run: |
|
||||||
run-clang-tidy-${{ env.LLVM_TOOLS_VERSION }} -p build -j "${{ steps.number_of_threads.outputs.threads_number }}" -fix -quiet 1>output.txt
|
run-clang-tidy-${{ env.LLVM_TOOLS_VERSION }} -p build -j "${{ steps.nproc.outputs.nproc }}" -fix -quiet 1>output.txt
|
||||||
|
|
||||||
- name: Fix local includes and clang-format style
|
- name: Fix local includes and clang-format style
|
||||||
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
if: ${{ steps.run_clang_tidy.outcome != 'success' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user