Skip to content

Commit

Permalink
[ci] Add generation of binary package artifacts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-Naumann committed Sep 22, 2023
1 parent f4f8133 commit 8730c47
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/root-ci-config/build_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def main():
**load_config(f'{this_script_dir}/buildconfig/{args.platform}.txt')
}

if args.binaries:
options_dict = remove_gpl_options(options_dict)

options = build_utils.cmake_options_from_dict(options_dict)

if WINDOWS:
Expand Down Expand Up @@ -113,6 +116,9 @@ def main():
if not pull_request and not args.incremental and not args.coverage:
archive_and_upload(yyyy_mm_dd, obj_prefix)

if args.binaries:
create_binaries(args.buildtype)

testing: bool = options_dict['testing'].lower() == "on" and options_dict['roottest'].lower() == "on"

if testing:
Expand Down Expand Up @@ -158,6 +164,7 @@ def parse_args():
parser.add_argument("--coverage", default="false", help="Create Coverage report in XML")
parser.add_argument("--base_ref", default=None, help="Ref to target branch")
parser.add_argument("--head_ref", default=None, help="Ref to feature branch; it may contain a :<dst> part")
parser.add_argument("--binaries", default="false", help="Whether to create binary artifacts")
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")
Expand All @@ -167,6 +174,7 @@ def parse_args():
# Set argument to True if matched
args.incremental = args.incremental.lower() in ('yes', 'true', '1', 'on')
args.coverage = args.coverage.lower() in ('yes', 'true', '1', 'on')
args.binaries = args.binaries.lower() in ('yes', 'true', '1', 'on')

if not args.base_ref:
die(os.EX_USAGE, "base_ref not specified")
Expand All @@ -177,6 +185,13 @@ def parse_args():
def print_trace():
build_utils.log.print()

def remove_gpl_options(options_dict: dict):
gpl_options = ['fftw3', 'mathmore', 'pythia6', 'pythia8', 'unuran']
for opt in gpl_options:
options_dict[opt] = 'off'
return options_dict


@github_log_group("Clean up from previous runs")
def cleanup_previous_build():
# runners should never have root permissions but be on the safe side
Expand Down Expand Up @@ -348,6 +363,17 @@ def build(options, buildtype):

cmake_build(buildtype)


@github_log_group("Create binary packages")
def create_binaries(buildtype):
result = subprocess_with_log(f"""
cd '{WORKDIR}/build' && cpack --verbose -C ${buildtype}
""")

if result != 0:
die(result, "Failed to generate binary package")


@github_log_group("Rebase")
def rebase(base_ref, head_ref) -> None:
head_ref_src, _, head_ref_dst = head_ref.partition(":")
Expand Down
48 changes: 45 additions & 3 deletions .github/workflows/root-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ on:
required: true
default: master
incremental:
type: boolean
required: true
default: false
binaries:
type: boolean
required: true
default: true
Expand All @@ -52,6 +56,10 @@ on:
type: boolean
required: true
default: true
binaries:
type: boolean
required: true
default: false

env:
PYTHONUNBUFFERED: true
Expand Down Expand Up @@ -111,6 +119,7 @@ jobs:
--incremental ${{ inputs.incremental }}
--base_ref ${{ inputs.base_ref }}
--head_ref ${{ inputs.head_ref }}
--binaries ${{ inputs.binaries }}
--repository ${{ github.server_url }}/${{ github.repository }}"

- name: Nightly build
Expand All @@ -120,6 +129,7 @@ jobs:
--platform ${{ matrix.platform }}
--incremental false
--base_ref ${{ github.ref_name }}
--binaries true
--repository ${{ github.server_url }}/${{ github.repository }}"

- name: Update artifacts after push to release branch
Expand All @@ -129,15 +139,31 @@ jobs:
--platform ${{ matrix.platform }}
--incremental false
--base_ref ${{ github.ref_name }}
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
--repository ${{ github.server_url }}/${{ github.repository }}"

- name: Upload test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: Test Results ${{ matrix.platform }} ${{ matrix.arch }} ${{ matrix.config }}
name: Test Results ${{ matrix.platform }} ${{ matrix.arch }} ${{ matrix.config }}
path: /Users/sftnight/ROOT-CI/build/TestResults.xml

- name: Upload build artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: Test Results ${{ matrix.platform }} ${{ matrix.arch }} ${{ matrix.config }}
path: /Users/sftnight/ROOT-CI/build/TestResults.xml

- name: Upload binaries
if: ${{ !cancelled() && (inputs.binaries || github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3
with:
name: Binaries ${{ matrix.platform }} ${{ matrix.arch }} ${{ matrix.config }}
path: /Users/sftnight/ROOT-CI/root_v*
if-no-files-found: error


build-windows:
if: github.repository_owner == 'root-project' || github.event_name == 'pull_request'
Expand Down Expand Up @@ -232,9 +258,17 @@ jobs:
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: Test Results Windows ${{ matrix.target_arch }} ${{ matrix.config }}
name: Test Results Windows ${{ matrix.target_arch }} ${{ matrix.config }}
path: C:/ROOT-CI/build/TestResults.xml

- name: Upload binaries
if: ${{ !cancelled() && (inputs.binaries || github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3
with:
name: Binaries ${{ matrix.target_arch }} ${{ matrix.config }}
path: C:/ROOT-CI/root_v*
if-no-files-found: error


build-linux:
if: github.repository_owner == 'root-project' || github.event_name == 'pull_request'
Expand Down Expand Up @@ -393,9 +427,17 @@ jobs:
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: Test Results ${{ matrix.image }} ${{ matrix.config }}
name: Test Results ${{ matrix.image }} ${{ matrix.config }}
path: /github/home/ROOT-CI/build/TestResults.xml

- name: Upload binaries
if: ${{ !cancelled() && (inputs.binaries || github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')) }}
uses: actions/upload-artifact@v3
with:
name: Binaries ${{ matrix.image }} ${{ matrix.config }}
path: /github/home/ROOT-CI/ROOT-CI/root_v*
if-no-files-found: error

event_file:
if: github.repository_owner == 'root-project' || github.event_name == 'pull_request'
name: "Upload Event Payload"
Expand Down

0 comments on commit 8730c47

Please sign in to comment.