Compare commits

..

3 Commits

Author SHA1 Message Date
Bart Thomee
3d6cc7dc91 Restore CI env vars 2025-10-20 12:11:03 -04:00
Bart Thomee
3711d40901 Restore CMAKE_UNITY_BUILD_BATCH_SIZE 2025-10-20 11:49:41 -04:00
Bart Thomee
26acbaed64 chore: Set CMake CI variable but reduce its effects 2025-10-20 11:47:59 -04:00
6 changed files with 19 additions and 263 deletions

View File

@@ -1,8 +1,13 @@
# This workflow runs all workflows to check, build and test the project on
# various Linux flavors, as well as on MacOS and Windows, for various PR events.
# 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:
merge_group:
types:
- checks_requested
pull_request:
types:
- opened
@@ -20,18 +25,10 @@ defaults:
jobs:
# This job determines whether the rest of the workflow should run. It runs
# when the PR is not a draft or has the 'DraftRunCI' label and does NOT have
# the 'SkipRunCI' and 'MergeQueueCI' labels. The former two labels will result
# in the PR not being allowed to be merged, whereas the latter label will
# allow it to be merged without running the full CI suite, because the merge
# queue will verify that the code builds and passes tests before the PR is
# actually merged.
# when the PR is not a draft (which should also cover merge-group) or
# has the 'DraftRunCI' label.
should-run:
if: ${{
(!github.event.pull_request.draft || contains(github.event.pull_request.labels.*.name, 'DraftRunCI')) &&
!contains(github.event.pull_request.labels.*.name, 'SkipRunCI') &&
!contains(github.event.pull_request.labels.*.name, 'MergeQueueCI')
}}
if: ${{ !github.event.pull_request.draft || contains(github.event.pull_request.labels.*.name, 'DraftRunCI') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
@@ -78,20 +75,20 @@ jobs:
conanfile.py
conan.lock
- name: Check whether to run
# This step determines whether the rest of the workflow should run. If
# it runs and all jobs complete successfully, then the 'passed' job is
# marked as 'skipped' and, because its direct dependencies ran, the PR
# is allowed to be merged. This workflow will run when at least one of
# the following is true:
# * Any of the files checked in the `changes` step were modified.
# * The PR is NOT a draft and is labeled 'Ready to merge'.
# This step determines whether the rest of the workflow should
# run. The rest of the workflow will run if this job runs AND at
# least one of:
# * Any of the files checked in the `changes` step were modified
# * The PR is NOT a draft and is labeled "Ready to merge"
# * The workflow is running from the merge queue
id: go
env:
FILES: ${{ steps.changes.outputs.any_changed }}
DRAFT: ${{ github.event.pull_request.draft }}
READY: ${{ contains(github.event.pull_request.labels.*.name, 'Ready to merge') }}
MERGE: ${{ github.event_name == 'merge_group' }}
run: |
echo "go=${{ (env.DRAFT != 'true' && env.READY == 'true') || env.FILES == 'true' }}" >> "${GITHUB_OUTPUT}"
echo "go=${{ (env.DRAFT != 'true' && env.READY == 'true') || env.FILES == 'true' || env.MERGE == 'true' }}" >> "${GITHUB_OUTPUT}"
cat "${GITHUB_OUTPUT}"
outputs:
go: ${{ steps.go.outputs.go == 'true' }}
@@ -126,7 +123,7 @@ jobs:
conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
passed:
if: ${{ failure() || cancelled() }}
if: failure() || cancelled()
needs:
- build-test
- check-levelization

View File

@@ -1,35 +0,0 @@
# This workflow runs all workflows to check, build and test the project on
# various Linux flavors, as well as on MacOS and Windows, when a PR is added to
# the merge queue.
name: Merge Queue
on:
merge_group:
types:
- checks_requested
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
check-commit-message:
uses: ./.github/workflows/reusable-check-commit-message.yml
check-levelization:
uses: ./.github/workflows/reusable-check-levelization.yml
build-test:
uses: ./.github/workflows/reusable-build-test.yml
strategy:
fail-fast: false
matrix:
os: [linux, macos, windows]
with:
os: ${{ matrix.os }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -1,72 +0,0 @@
# This workflow checks that the commit message follows our expected format.
name: Check commit message
# This workflow can only be triggered by other workflows.
on: workflow_call
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-single-commit
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
fetch-depth: 0
- name: Check commit message
env:
MESSAGE: |
If you are reading this, then the commit message does not match our
expected format. See CONTRIBUTING.md for instructions.
It is further possible that you did not run the script in
`bin/git/squash-commits.sh` before clicking the 'Merge when ready'
button in GitHub's UI.
run: |
set -o pipefail
COMMIT_MSG='${{ github.event.head_commit.message }}'
echo "Commit message: ${COMMIT_MSG}"
# If the commit title contains a prefix then it must be one we permit.
COMMIT_TITLE=$(echo "${COMMIT_MSG}" | head -n1)
echo "Commit title: '${COMMIT_TITLE}'"
if [[ "${COMMIT_TITLE}" =~ ^[^:]+:[^:]+ ]]; then
if ! [[ "${COMMIT_TITLE}" =~ ^(build|chore|docs|fix|perf|refactor|test):[^:]+ ]]; then
echo "Commit title prefix is not permitted."
echo "${MESSAGE}"
exit 1
fi
fi
# The commit description may not only contain a list of commits, which
# is what happens if a PR containing multiple commits is squashed and
# merged by GitHub.
COMMIT_DESC=$(echo "${COMMIT_MSG}" | tail -n+3)
echo "Commit description: '${COMMIT_DESC}'"
while IFS=$'\n' read -r LINE; do
echo "Processing: ${LINE}"
# Check for lines starting with '-' or '*' followed by a space.
if ! [[ "${LINE}" =~ ^[[:space:]]*[-*][[:space:]]+.* ]]; then
exit 0
fi
# Check if the next line is empty.
IFS=$'\n' read -r LINE
if [ -n "${LINE}" ]; then
exit 0
fi
done <<< "${COMMIT_DESC}"
echo "Commit description is not permitted."
echo "${MESSAGE}"
exit 1

View File

@@ -1,130 +0,0 @@
#!/bin/bash
if [[ $# -ne 3 || "$1" == "--help" || "$1" = "-h" ]]
then
name=$( basename $0 )
cat <<- USAGE
Usage: $name pr "title" "description"
* All commits in the specified PR will be squashed and a new commit prepared
with the provided title and description as commit message.
* This script will not push the new commit. You will need to do so yourself
by force-pushing, since you will be rewriting history. You must be the
author of the PR or a maintainer of the repository in order to perform this
operation.
* The 'gh' CLI tool must be installed and authenticated.
* To write a multiline description, you can use "\$(cat <<EOF
line 1
line 2
EOF
)" to pass it as a single argument.
* If you get a '[rejected]' error when updating the target branch and then
locally merging the changes into the source branch, it is likely because the
source branch already exists on your machine (e.g. you ran this script
multiple times). In that case, you can delete the local source branch
(e.g. 'git branch -D [source]') and try again.
USAGE
exit 0
fi
pr="$1"
shift
title=$1
shift
description=$1
shift
set -e
echo "Checking workspace."
diff=$(git status --porcelain)
if [ -n "${diff}" ]; then
echo "Error: Workspace is not clean. Please commit or stash your changes."
exit 1
fi
echo "Checking out PR ${pr}."
gh pr checkout "${pr}"
echo "Getting the target branch of the PR."
target=$(gh pr view --json "baseRefName" --jq '.baseRefName')
if [ -z "${target}" ]; then
echo "Error: Could not determine target branch of PR ${pr}."
exit 1
fi
echo "Getting the source branch of the PR."
source=$(git branch --show-current)
echo "Ensuring the PR source branch '${source}' is up to date with the target branch '${target}'."
git checkout ${target}
git pull --rebase
gh pr checkout "${pr}"
git merge ${target} --no-edit
# TODO: check for conflicts and abort if there are any.
echo "Squashing commits in the PR."
git reset --soft $(git merge-base ${target} HEAD)
git commit -S -m "${title}" -m "${description}"
# We assume that external contributors will create a fork in their personal
# repository, i.e. the repo owner matches the currently logged in user. In that
# case they can push directly to their branch. If the owner is 'XRPLF', we also
# push directly to the branch, as we assume that the user running this script
# will be a maintainer.
echo "Gathering user details."
owner=$(gh pr view --json "headRepositoryOwner" --jq '.headRepositoryOwner.login')
user=$(gh api user --jq '.login')
echo "The PR is owned by '${owner}'. The current user is '${user}'."
if [ "${owner}" = 'XRPLF' ] || [ "${owner}" = "${user}" ]; then
remote="$(git remote -v | grep ":${owner}/rippled.git (push)" | head -1 | cut -f1)"
else
remote="${owner}"
fi
if [ "${remote}" = "origin" ]; then
cat << EOF
----------------------------------------------------------------------
This script will not push. Verify everything is correct, then force
push to the source branch using the following commands:
gh pr edit ${pr} --add-label 'MergeQueueCI'
git push --force-with-lease origin ${source}
The first command adds a label to the PR to skip running CI on the new
commit. As we are using a merge queue, CI will be run when the PR is added to
the queue, which is required to pass before the changes are merged.
Remember to navigate back to your previous branch after pushing. You
may also want to delete the branch after the commit has been pushed.
git branch -D ${source}
----------------------------------------------------------------------
EOF
else
cat << EOF
----------------------------------------------------------------------
This script will not push. Verify everything is correct, then force
push to the fork using the following commands:
gh pr edit ${pr} --add-label 'MergeQueueCI'
git remote add ${remote} git@github.com:${remote}/rippled.git
git fetch ${remote}
git push --force-with-lease ${remote} ${source}
git remote remove ${remote}
The first command adds a label to the PR to skip running CI on the new
commit. As we are using a merge queue, CI will be run when the PR is added to
the queue, which is required to pass before the changes are merged.
Remember to navigate back to your previous branch after pushing. You
may also want to delete the branch after the commit has been pushed.
git branch -D ${source}
----------------------------------------------------------------------
EOF
fi

View File

@@ -181,11 +181,6 @@ if(xrpld)
xrpl.libxrpl
)
exclude_if_included(rippled)
# define a macro for tests that might need to
# be exluded or run differently in CI environment
if(is_ci)
target_compile_definitions(rippled PRIVATE RIPPLED_RUNNING_IN_CI)
endif ()
if(voidstar)
target_compile_options(rippled

View File

@@ -43,6 +43,7 @@ else ()
set (is_linux FALSE)
endif ()
# The CI environment variable is set by GitHub Actions.
if ("$ENV{CI}" STREQUAL "true" OR "$ENV{CONTINUOUS_INTEGRATION}" STREQUAL "true")
set (is_ci TRUE)
else ()