Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/root-ci-config/build_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
die,
github_log_group,
is_macos,
load_config,
print_options_diff,
subprocess_with_capture,
subprocess_with_log,
upload_file,
Expand Down Expand Up @@ -70,11 +70,17 @@ def main():
# Load CMake options from .github/workflows/root-ci-config/buildconfig/[platform].txt
this_script_dir = os.path.dirname(os.path.abspath(__file__))

options_dict = {
**load_config(f'{this_script_dir}/buildconfig/global.txt'),
# file below overwrites values from above
**load_config(f'{this_script_dir}/buildconfig/{args.platform}.txt')
}
options_dict = build_utils.load_config(f"{this_script_dir}/buildconfig/global.txt")
temp = dict(options_dict)
options_dict.update(build_utils.load_config(f"{this_script_dir}/buildconfig/{args.platform}.txt"))
print(f"Build options ({args.platform})")
print_options_diff(options_dict, temp)

print("Build options (CI override):", args.overrides)
if args.overrides is not None:
temp = dict(options_dict)
options_dict.update((arg.split("=") for arg in args.overrides))
print_options_diff(options_dict, temp)

options = build_utils.cmake_options_from_dict(options_dict)

Expand Down Expand Up @@ -193,6 +199,7 @@ def parse_args():
parser.add_argument("--architecture", default=None, help="Windows only, target arch")
parser.add_argument("--repository", default="https://github.com/root-project/root.git",
help="url to repository")
parser.add_argument("--overrides", default=None, help="Override build options with these key-value pairs", nargs="*")

args = parser.parse_args()

Expand Down Expand Up @@ -255,7 +262,7 @@ def git_pull(directory: str, repository: str, branch: str):
returncode = subprocess_with_log(f"""
git clone --branch {branch} --single-branch {repository} "{targetdir}"
""")

if returncode == 0:
return

Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/root-ci-config/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@
def print_error(*values, **kwargs):
print_fancy("Fatal error: ", *values, sgr=31, **kwargs)

def print_options_diff(new, old):
"""Print difference between build option dicts"""

for key in new:
try:
if new[key] != old[key]:
print(f"\t{key}:\t{old[key]} --> {new[key]}")
except:

Check failure on line 118 in .github/workflows/root-ci-config/build_utils.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E722)

.github/workflows/root-ci-config/build_utils.py:118:9: E722 Do not use bare `except`
print(f"\t{key}:\tNone --> {new[key]}")


def subprocess_with_log(command: str) -> int:
"""Runs <command> in shell and appends <command> to log"""
Expand Down Expand Up @@ -316,7 +326,7 @@
extension (str): The regular expression pattern to match filenames against.
"""
print_fancy(f"Removing gcda files from {directory}")
log.add(f"\nfind {directory} -name \*.gcda -exec rm {{}} \;")
log.add(f"\nfind {directory} -name \\*.gcda -exec rm {{}} \;")
pattern = "." + extension
count = 0
for currentdir, _, files in os.walk(directory):
Expand Down
141 changes: 80 additions & 61 deletions .github/workflows/root-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ env:
OS_INTERFACE: 'public'
OS_REGION_NAME: 'cern'
GLOBAL_OVERRIDES: 'asserts=ON LLVM_ENABLE_ASSERTIONS=ON'
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand All @@ -92,6 +94,14 @@ jobs:
permissions:
contents: read

# Use login shells to have brew and java available
defaults:
run:
shell: bash -leo pipefail {0}

env:
VENV_DIR: ${{ github.workspace }}/ROOT_CI_VENV

strategy:
fail-fast: false
matrix:
Expand All @@ -100,88 +110,108 @@ jobs:
# Common configs: {Release,Debug,RelWithDebInfo)
# Build options: https://root.cern/install/build_from_source/#all-build-options
include:
- platform: mac14
arch: X64
overrides: ["CMAKE_CXX_STANDARD=20"]
# - platform: mac14
# arch: X64
# overrides: ["CMAKE_CXX_STANDARD=20"]
- platform: mac15
arch: ARM64
overrides: ["CMAKE_CXX_STANDARD=23"]
- platform: mac26
arch: ARM64
- platform: experimental-brew-ci
# arch: ARM64
overrides: ["CMAKE_CXX_STANDARD=23", "builtin_unuran=On", "tmva-sofie=Off"]
# - platform: mac26
# arch: ARM64
- platform: mac-beta
is_special: true
arch: ARM64

runs-on: # Using '[self-hosted, ..., ...]' does not work for some reason :)
- self-hosted
- macOS
- ${{ matrix.arch }}
- ${{ matrix.arch == null && 'self-hosted' || matrix.arch }}
- ${{ matrix.platform }}

name: |
${{ matrix.platform }} ${{ matrix.arch }}
${{ matrix.platform }} ${{ matrix.arch }}
${{ (github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' && join( matrix.overrides, ', ' )) || '' }}

steps:
- name: Cleanup
run: rm -rf ${{ github.workspace }}/build

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref_name }}
path: src/

- name: Update brew packages
if: ${{ matrix.platform == 'experimental-brew-ci' }}
run: |
brew update
brew install ccache googletest openjdk pyenv
echo "Installing official brew deps: $(brew deps --direct --include-build root)"
brew install $(brew deps --direct --include-build root)
java --version

- name: Set up python venv
if: ${{ matrix.platform == 'experimental-brew-ci' }}
run: |
$(brew --prefix python)/bin/python3 -m venv ${VENV_DIR}
source ${VENV_DIR}/bin/activate
pip install --upgrade pip
cat ${{ github.workspace }}/src/requirements.txt | while read PACKAGE; do
if [ -n "${PACKAGE%%#*}" ]; then
pip install -U "${PACKAGE%%#*}";
fi; done || true
pip install openstacksdk # TODO: Remove?
echo ${VENV_DIR}/bin >> $GITHUB_PATH

- name: Apply option overrides from matrix for this job for non-release builds
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' && matrix.overrides != NaN }}
env:
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/${{ matrix.platform }}.txt'
shell: bash
run: |
set -x

echo '' >> "$CONFIGFILE"

for ENTRY in $GLOBAL_OVERRIDES $OVERRIDES; do
KEY=$( echo "$ENTRY" | cut -d '=' -f 1 )

# Add entry to file if not exists, otherwise replace

if grep -q "$KEY=" "$CONFIGFILE"; then
sed -i "s/$KEY=.*\$/$ENTRY/" "$CONFIGFILE"
else
echo "$ENTRY" >> "$CONFIGFILE"
fi
done

cat "$CONFIGFILE" || true
run: echo "Remember to set the following overrides GLOBAL=$GLOBAL_OVERRIDES LOCAL=$OVERRIDES"

- uses: root-project/gcc-problem-matcher-improved@main
with:
build-directory: /Users/sftnight/ROOT-CI/src/

- name: Set up curl CA bundle for Davix to work with https
run: 'echo SSL_CERT_FILE=/opt/local/share/curl/curl-ca-bundle.crt >> $GITHUB_ENV'

run: |
for cert in /opt/homebrew/opt/ca-certificates/share/ca-certificates/cacert.pem /opt/local/share/curl/curl-ca-bundle.crt; do
if [ -f ${cert} ]; then
echo "SSL_CERT_FILE=${cert}" >> $GITHUB_ENV
fi
done

- name: Pull Request Build
shell: bash -leo pipefail {0}
if: github.event_name == 'pull_request'
env:
HOME: /Users/sftnight
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') && !matrix.platform == 'mac15' && !matrix.platform == 'mac26'}}
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
run: ".github/workflows/root-ci-config/build_root.py
--buildtype RelWithDebInfo
--incremental $INCREMENTAL
--base_ref ${{ github.base_ref }}
--sha ${{ github.sha }}
--pull_repository ${{ github.event.pull_request.head.repo.clone_url }}
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
--head_sha ${{ github.event.pull_request.head.sha }}
--repository ${{ github.server_url }}/${{ github.repository }}
--platform ${{ matrix.platform }}"
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
run: |
echo $PATH
if [ -f ${VENV_DIR}/bin/activate ]; then source ${VENV_DIR}/bin/activate; fi
src/.github/workflows/root-ci-config/build_root.py \
--buildtype RelWithDebInfo \
--incremental $INCREMENTAL \
--base_ref ${{ github.base_ref }} \
--sha ${{ github.sha }} \
--pull_repository ${{ github.event.pull_request.head.repo.clone_url }} \
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }} \
--head_sha ${{ github.event.pull_request.head.sha }} \
--repository ${{ github.server_url }}/${{ github.repository }} \
--platform ${{ matrix.platform == 'experimental-brew-ci' && 'mac15' || matrix.platform }} \
--overrides $GLOBAL_OVERRIDES $OVERRIDES

- name: Workflow dispatch
shell: bash -leo pipefail {0}
if: ${{ github.event_name == 'workflow_dispatch' && !matrix.is_special }}
run: ".github/workflows/root-ci-config/build_root.py
run: ".github/workflows/root-ci-config/build_root.py
--buildtype ${{ inputs.buildtype }}
--platform ${{ matrix.platform }}
--incremental ${{ inputs.incremental }}
Expand All @@ -193,7 +223,7 @@ jobs:
- name: Nightly build
shell: bash -leo pipefail {0}
if: github.event_name == 'schedule'
run: ".github/workflows/root-ci-config/build_root.py
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Release
--platform ${{ matrix.platform }}
--incremental false
Expand All @@ -204,13 +234,16 @@ jobs:
- name: Update build cache after push to release branch
shell: bash -leo pipefail {0}
if: github.event_name == 'push'
run: ".github/workflows/root-ci-config/build_root.py
env:
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
run: ".github/workflows/root-ci-config/build_root.py
--buildtype RelWithDebInfo
--platform ${{ matrix.platform }}
--incremental false
--base_ref ${{ github.ref_name }}
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
--repository ${{ github.server_url }}/${{ github.repository }}"
--repository ${{ github.server_url }}/${{ github.repository }}
--overrides $GLOBAL_OVERRIDES $OVERRIDES"

- name: Upload test results
if: ${{ !cancelled() }}
Expand All @@ -231,13 +264,7 @@ jobs:
build-windows:
# For any event that is not a PR, the CI will always run. In PRs, the CI
# can be skipped if the tag [skip-ci] or [skip ci] is written in the title.
if: |
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
(github.event_name == 'pull_request' && !(
contains(github.event.pull_request.title, '[skip-ci]') ||
contains(github.event.pull_request.title, '[skip ci]') ||
contains(github.event.pull_request.labels.*.name, 'skip ci')
))
if: false

permissions:
contents: read
Expand Down Expand Up @@ -274,9 +301,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref_name }}
uses: actions/checkout@v5

- name: Pull Request Build
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -356,13 +381,7 @@ jobs:
build-linux:
# For any event that is not a PR, the CI will always run. In PRs, the CI
# can be skipped if the tag [skip-ci] or [skip ci] is written in the title.
if: |
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
(github.event_name == 'pull_request' && !(
contains(github.event.pull_request.title, '[skip-ci]') ||
contains(github.event.pull_request.title, '[skip ci]') ||
contains(github.event.pull_request.labels.*.name, 'skip ci')
))
if: false

permissions:
contents: read
Expand Down Expand Up @@ -422,7 +441,7 @@ jobs:
is_special: true
property: "Fedora pydebug"
overrides: ["CMAKE_CXX_STANDARD=23"]
# Disable GPU builds until the DNS problem is solved
# Disable GPU builds until the DNS problem is solved
# - image: ubuntu2404-cuda
# is_special: true
# property: gpu
Expand Down
Loading