mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
90 lines
3.7 KiB
YAML
90 lines
3.7 KiB
YAML
name: Checks
|
|
|
|
on: push
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
# Check if the code is formatted according to the .clang-format rules.
|
|
clang-format:
|
|
if: github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'DraftRunCI')
|
|
runs-on: ubuntu-latest
|
|
container: ghcr.io/xrplf/ci/tools-rippled-clang-format
|
|
steps:
|
|
# The $GITHUB_WORKSPACE and ${{ github.workspace }} might not point to the
|
|
# same directory for jobs running in containers. The actions/checkout step
|
|
# is *supposed* to checkout into $GITHUB_WORKSPACE and then add it to
|
|
# safe.directory (see instructions at https://github.com/actions/checkout)
|
|
# but that is apparently not happening for some container images. We
|
|
# therefore preemptively add both directories to safe.directory. See also
|
|
# https://github.com/actions/runner/issues/2058 for more details.
|
|
- name: Configure git safe.directory
|
|
run: |
|
|
git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
git config --global --add safe.directory ${{ github.workspace }}
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
- name: Check version
|
|
run: clang-format --version
|
|
- name: Format code
|
|
run: find include src tests -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format -i {} +
|
|
- name: Check for differences
|
|
env:
|
|
MESSAGE: |
|
|
One or more files did not conform to the formatting specified in
|
|
.clang-format. Maybe you did not run 'git-clang-format' or
|
|
'clang-format' before committing, or your version of clang-format
|
|
has an incompatibility with the one used here (see the "Check
|
|
version" step above).
|
|
|
|
Run 'git-clang-format --extensions cpp,h,hpp,ipp develop' in your
|
|
repo, and then commit and push the changes.
|
|
run: |
|
|
DIFF=$(git status --porcelain)
|
|
if [ -n "${DIFF}" ]; then
|
|
# Print the files that changed to give the contributor a hint about
|
|
# what to expect when running git-clang-format on their own machine.
|
|
git status
|
|
echo "${MESSAGE}"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if the dependencies between the modules are correctly indexed
|
|
levelization:
|
|
if: github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'DraftRunCI')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
- name: Check levelization
|
|
run: Builds/levelization/levelization.sh
|
|
- name: Check for differences
|
|
env:
|
|
MESSAGE: |
|
|
|
|
The dependency relationships between the modules in rippled have
|
|
changed, which may be an improvement or a regression.
|
|
|
|
A rule of thumb is that if your changes caused something to be
|
|
removed from loops.txt, it's probably an improvement, while if
|
|
something was added, it's probably a regression.
|
|
|
|
Run './Builds/levelization/levelization.sh' in your repo, and then
|
|
commit and push the changes. See Builds/levelization/README.md for
|
|
more info.
|
|
run: |
|
|
DIFF=$(git status --porcelain)
|
|
if [ -n "${DIFF}" ]; then
|
|
# Print the differences to give the contributor a hint about what to
|
|
# expect when running levelization on their own machine.
|
|
git diff
|
|
echo "${MESSAGE}"
|
|
exit 1
|
|
fi
|