Skip to content

Commit

Permalink
build: build ROOT from source and cache it
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Mar 4, 2024
1 parent 9cb14c3 commit 3e7b03e
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 13 deletions.
16 changes: 16 additions & 0 deletions .github/install-dependency-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ GENERAL_PACKAGE_LIST_LINUX=(
gcovr # for coverage
python-pygments # for coverage report syntax colors
llvm # for `llvm-symbolizer`, for human-readable sanitizer results
### ROOT dependencies
binutils
libx11
libxpm
libxft
libxext
openssl
gsl
)
IGUANA_PACKAGE_LIST_LINUX=(
fmt
Expand All @@ -32,6 +40,14 @@ GENERAL_PACKAGE_LIST_MACOS=(
tree
ninja
meson
### ROOT dependencies
binutils
libx11
libxpm
libxft
libxext
openssl
gsl
)
IGUANA_PACKAGE_LIST_MACOS=(
fmt
Expand Down
61 changes: 49 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ jobs:
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
outputs:
key: ${{ steps.key.outputs.key }}
steps:
- id: key
run: echo key=hipo-${{ inputs.id }}-${{ env.hipo_version }} >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
id: cache
with:
key: hipo-${{ inputs.id }}-${{ env.hipo_version }}
key: ${{ steps.key.outputs.key }}
path: hipo.tar.zst
lookup-only: true
- name: checkout iguana for dependency installation script
Expand All @@ -113,19 +117,50 @@ jobs:
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
id: cache_save
with:
key: hipo-${{ inputs.id }}-${{ env.hipo_version }}
key: ${{ steps.key.outputs.key }}
path: hipo.tar.zst

test_root:
name: test ROOT
build_root:
name: Build ROOT
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
outputs:
key: ${{ steps.key.outputs.key }}
steps:
- uses: cvmfs-contrib/github-action-cvmfs@v4
- run: ls /cvmfs/sft.cern.ch
- run: ls /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.28.10/x86_64-ubuntu22-gcc114-opt
- run: ls /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.28.10/x86_64-mac127-clang140-opt
- id: key
run: echo key=root-${{ inputs.id }}-$(date +%Y-wk%V) >> $GITHUB_OUTPUT # suffix: <YEAR>-wk<WEEKNUMBER>
- uses: actions/cache/restore@v4
id: cache
with:
key: ${{ steps.key.outputs.key }}
path: root.tar.zst
lookup-only: true
- name: checkout iguana for dependency installation script
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
path: iguana_src
- name: build ROOT
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run:
srcURL=$(iguana_src/meson/minimum-version.sh root src)
echo "[+] DOWNLOADING ROOT SOURCE CODE FROM: $srcURL"
wget -nv --no-check-certificate $srcURL
tar xvf root_*.tar.gz
mv -v $(ls -d root_* | head -n1) root_src
echo "[+] BUILDING ROOT"
cmake -S root_src -B build -G Ninja --install-prefix $(pwd)/root
cmake --build build
cmake --install build
echo "[+] MAKE TARBALL"
tar cavf root{.tar.zst,}
- uses: actions/cache/save@v4
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
id: cache_save
with:
key: ${{ steps.key.outputs.key }}
path: root.tar.zst

# build
#########################################################
Expand Down Expand Up @@ -164,7 +199,7 @@ jobs:
- name: get local dependency `hipo`
uses: actions/cache/restore@v4
with:
key: hipo-${{ inputs.id }}-${{ env.hipo_version }}
key: ${{ needs.build_hipo.outputs.key }}
path: hipo.tar.zst
- name: untar local dependencies
run: ls *.tar.zst | xargs -I{} tar xvf {}
Expand Down Expand Up @@ -276,7 +311,7 @@ jobs:
- name: get local dependency `hipo`
uses: actions/cache/restore@v4
with:
key: hipo-${{ inputs.id }}-${{ env.hipo_version }}
key: ${{ needs.build_hipo.outputs.key }}
path: hipo.tar.zst
- name: untar local dependencies
run: ls *.tar.zst | xargs -I{} tar xvf {}
Expand Down Expand Up @@ -349,6 +384,7 @@ jobs:
name: Test Installed Examples
needs:
- download_test_data
- build_hipo
- build_iguana
runs-on: ${{ inputs.runner }}
container:
Expand All @@ -370,7 +406,7 @@ jobs:
- name: get local dependency `hipo`
uses: actions/cache/restore@v4
with:
key: hipo-${{ inputs.id }}-${{ env.hipo_version }}
key: ${{ needs.build_hipo.outputs.key }}
path: hipo.tar.zst
- name: get iguana build artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -422,6 +458,7 @@ jobs:
name: Test consumer builds
needs:
- download_test_data
- build_hipo
- build_iguana
runs-on: ${{ inputs.runner }}
container:
Expand All @@ -440,7 +477,7 @@ jobs:
- name: get local dependency `hipo`
uses: actions/cache/restore@v4
with:
key: hipo-${{ inputs.id }}-${{ env.hipo_version }}
key: ${{ needs.build_hipo.outputs.key }}
path: hipo.tar.zst
- name: get iguana build artifacts
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ROOT_dep = dependency(
'ROOT',
required: false,
method: 'cmake',
version: '>=6.28'
version: run_command('meson' / 'minimum-version.sh', 'ROOT', check: true).stdout().strip()
)

# list of dependencies
Expand Down
10 changes: 10 additions & 0 deletions meson/minimum-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if [ $# -eq 0 ]; then
ALA return a URL for the Arch Linux Archive (ALA), for CI
https://archive.archlinux.org/
src return a URL of the source code
"""
exit 2
fi
Expand All @@ -22,10 +24,17 @@ case $dep in
fmt)
result_meson='>=9.1.0'
result_ala='https://archive.archlinux.org/packages/f/fmt/fmt-9.1.0-4-x86_64.pkg.tar.zst'
[ "$cmd" = "src" ] && echo "ERROR: command '$cmd' is not used for '$dep'" >&2 && exit 1
;;
yaml-cpp)
result_meson='>=0.7.0'
result_ala='https://archive.archlinux.org/packages/y/yaml-cpp/yaml-cpp-0.7.0-2-x86_64.pkg.tar.zst'
[ "$cmd" = "src" ] && echo "ERROR: command '$cmd' is not used for '$dep'" >&2 && exit 1
;;
root|ROOT)
result_meson='>=6.28'
[ "$cmd" = "ALA" ] && echo "ERROR: command '$cmd' is not used for '$dep'" >&2 && exit 1
result_src='https://root.cern/download/root_v6.28.12.source.tar.gz'
;;
*)
echo "ERROR: dependency '$dep' is unknown" >&2
Expand All @@ -38,6 +47,7 @@ esac
case $cmd in
meson) echo $result_meson ;;
ALA) echo $result_ala ;;
src) echo $result_src ;;
*)
echo "ERROR: command '$cmd' is unknown" >&2
exit 1
Expand Down

0 comments on commit 3e7b03e

Please sign in to comment.