Files
rippled/.github/workflows/on-pr.yml
Bart c14ce956ad chore: Update clang-format and prettier with pre-commit (#5709)
The change updates how clang-format is called in CI and locally, and adds prettier to the pre-commit hook. Proto files are now also formatted, while external files are excluded.
2025-08-22 17:37:11 +00:00

119 lines
4.0 KiB
YAML

# This workflow runs all workflows to check, build and test the project on
# various Linux flavors, as well as on MacOS and Windows, on every push to a
# user branch. However, it will not run if the pull request is a draft unless it
# has the 'DraftRunCI' label.
name: PR
on:
pull_request:
paths:
- ".github/actions/build-deps/**"
- ".github/actions/build-test/**"
- ".github/scripts/levelization/**"
- ".github/scripts/strategy-matrix/**"
- ".github/workflows/build-test.yml"
- ".github/workflows/check-format.yml"
- ".github/workflows/check-levelization.yml"
- ".github/workflows/notify-clio.yml"
- ".github/workflows/on-pr.yml"
# Keep the list of paths below in sync with those in the `on-trigger.yml`
# file.
- "cmake/**"
- "conan/**"
- "external/**"
- "include/**"
- "src/**"
- "tests/**"
- ".clang-format"
- ".codecov.yml"
- ".pre-commit-config.yaml"
- "CMakeLists.txt"
- "conanfile.py"
types:
- opened
- synchronize
- labeled
- unlabeled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CONAN_REMOTE_NAME: xrplf
CONAN_REMOTE_URL: https://conan.ripplex.io
jobs:
# This job determines whether the workflow should run. It runs when:
# * Opened as a non-draft PR.
# * A commit is added to a non-draft PR or the PR has the 'DraftRunCI' label.
# * A draft PR has the 'DraftRunCI' label added.
# * A non-draft PR has the 'DraftRunCI' label removed.
# These checks are in part to ensure the workflow won't run needlessly while
# also allowing it to be triggered without having to add a no-op commit. A new
# workflow execution can be triggered by adding and then removing the label on
# a non-draft PR, or conversely by removing it and then adding it back on a
# draft PR; this can be useful in certain cases.
should-run:
if: >-
${{
(github.event.action == 'opened' && !github.event.pull_request.draft) ||
(github.event.action == 'synchronize' && (!github.event.pull_request.draft || contains(github.event.pull_request.labels.*.name, 'DraftRunCI'))) ||
(github.event.action == 'labeled' && github.event.pull_request.draft && github.event.label.name == 'DraftRunCI') ||
(github.event.action == 'unlabeled' && !github.event.pull_request.draft && github.event.label.name == 'DraftRunCI')
}}
runs-on: ubuntu-latest
steps:
- name: No-op
run: true
check-format:
needs: should-run
uses: ./.github/workflows/check-format.yml
check-levelization:
needs: should-run
uses: ./.github/workflows/check-levelization.yml
# This job works around the limitation that GitHub Actions does not support
# using environment variables as inputs for reusable workflows.
generate-outputs:
needs: should-run
runs-on: ubuntu-latest
steps:
- name: No-op
run: true
outputs:
conan_remote_name: ${{ env.CONAN_REMOTE_NAME }}
conan_remote_url: ${{ env.CONAN_REMOTE_URL }}
build-test:
needs: generate-outputs
uses: ./.github/workflows/build-test.yml
strategy:
matrix:
os: [linux, macos, windows]
with:
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
os: ${{ matrix.os }}
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
notify-clio:
needs:
- generate-outputs
- build-test
uses: ./.github/workflows/notify-clio.yml
with:
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
secrets:
clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}