Skip to content

Commit

Permalink
Test github action
Browse files Browse the repository at this point in the history
  • Loading branch information
jolly-chen committed Apr 23, 2024
1 parent 3288493 commit 80b464c
Show file tree
Hide file tree
Showing 3 changed files with 351 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/root-ci-config/build_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def main():

options = build_utils.cmake_options_from_dict(options_dict)

if args.documentation:
options = "-Ddocu=ON " + options

if WINDOWS:
options = "-Thost=x64 " + options

Expand Down Expand Up @@ -195,6 +198,7 @@ def parse_args():
parser.add_argument("--head_ref", default=None, help="Ref to feature branch; it may contain a :<dst> part")
parser.add_argument("--head_sha", default=None, help="Sha of commit that triggered the event")
parser.add_argument("--binaries", default="false", help="Whether to create binary artifacts")
parser.add_argument("--documentation", default="false", help="Whether to generate Doxygen documentation")
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 @@ -205,6 +209,7 @@ def parse_args():
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')
args.documentation = args.documentation.lower() in ('yes', 'true', '1', 'on')

if not args.base_ref:
die(os.EX_USAGE, "base_ref not specified")
Expand Down Expand Up @@ -564,6 +569,5 @@ def create_coverage_xml() -> None:
if result != 0:
die(result, "Failed to create test coverage")


if __name__ == "__main__":
main()
13 changes: 13 additions & 0 deletions .github/workflows/root-ci-config/buildconfig/minimal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
clad=off
tmva=off
webgui=off
dataframe=off
fail-on-missing=off
roofit=off
pyroot=off
roofit_multiprocess=off
opengl=off
root7=off
davix=off
fitsio=off

333 changes: 333 additions & 0 deletions .github/workflows/root-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
name: 'Generate Doxygen Documentation'

on:
# https://github.com/root-project/root/pull/12112#issuecomment-1411004278
pull_request:
branches:
- '**'
paths-ignore:
- 'doc/**'
- 'documentation/**'

push:
# branches:
# - 'master'
# - 'v*-*-*-patches'

# Allows nightly builds to trigger one run for each branch easily, by
# providing the relevant branch as "default" value here:
workflow_call:
inputs:
head_ref:
type: string
default: master
base_ref:
type: string
default: master
ref_name:
type: string
default: master

workflow_dispatch:
inputs:
head_ref:
description: rebase from ...
type: string
required: true
default: master
base_ref:
description: ... to ... (can have same value)
type: string
required: true
default: master
incremental:
description: 'Do incremental build'
type: boolean
required: true
default: true
binaries:
description: Create binary packages and upload them as artifacts
type: boolean
required: true
default: false
overrides:
type: string
default: "DOCU_INPUT=\"./mainpage.md;../../core;../../tutorials;\""
# DOXYGEN_EXECUTABLE=/home/runner/work/root/root/doxygen/install/bin/doxygen"
required: true
# platform:
# type: string
# default: $platform
# required: true


jobs:
gen-docs:
runs-on:
- self-hosted
- linux
- x64

env:
platform: alma9

permissions:
contents: read

container:
image: registry.cern.ch/root-ci/$platform:buildready # ALSO UPDATE BELOW!
options: '--security-opt label=disable --rm' # ALSO UPDATE BELOW!
env:
OS_APPLICATION_CREDENTIAL_ID: '7f5b64a265244623a3a933308569bdba'
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
OS_AUTH_TYPE: 'v3applicationcredential'
OS_AUTH_URL: 'https://keystone.cern.ch/v3'
OS_IDENTITY_API_VERSION: 3
OS_INTERFACE: 'public'
OS_REGION_NAME: 'cern'
PYTHONUNBUFFERED: true

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# - name: Set up Python
# uses: actions/setup-python@master
# with:
# python-version: "3.10-dev"
# architecture: x64
# platform: linux
# cache: 'pip' # caching pip dependencies
# run: |
# python3 -m pip install --upgrade pip setuptools
# python3 -m pip install python-openstackclient

# - name: Install required packages
# run: |
# apt update -y && apt install -y sudo
# sudo apt update -y
# sudo apt upgrade -y
# sudo apt-get install -y terminfo gfortran libpostgresql-ocaml-dev libtbb-dev libgl2ps-dev lzma-dev libgsl0-dev \
# libldap2-dev graphviz-dev libmysqlclient-dev python3.10-dev libxrootd-dev \
# libxrootd-client-dev xrootd-client libopengl-dev qhelpgenerator-qt5 xlibmesa-glu-dev

# - uses: tecolicom/actions-use-apt-tools@main
# with:
# tools: curl wget git ninja-build gcc g++ make binutils cmake dpkg-dev
# libssl-dev git libx11-dev libxext-dev libxft-dev libxpm-dev
# libpcre3-dev libglew-dev libftgl-dev
# libfftw3-dev libcfitsio-dev libavahi-compat-libdnssd-dev
# python3-dev python3-numpy libxml2-dev libkrb5-dev
# qtwebengine5-dev nlohmann-json3-dev
# liblzma-dev xxhash libxxhash-dev libzstd-dev zstd liblz4-dev lz4
# davix-dev libfreetype6-dev
# libprotobuf-dev protobuf-compiler protobuf-c-compiler libblas-dev java-common
# libsqlite3-dev libgif-dev libtiff-dev libjpeg-dev
# libedit-dev googletest-tools graphviz
# run: |
# apt update -y && apt install -y sudo
# sudo apt update -y
# sudo apt upgrade -y
# sudo apt-get install -y curl wget python3
# sudo apt-get install -y git ninja-build gcc g++ make binutils cmake dpkg-dev
# libssl-dev git libx11-dev libxext-dev libxft-dev libxpm-dev \
# gfortran libpcre3-dev xlibmesa-glu-dev libglew-dev libftgl-dev \
# libmysqlclient-dev libfftw3-dev libcfitsio-dev \
# graphviz-dev libavahi-compat-libdnssd-dev \
# libldap2-dev python3-dev python3-numpy libxml2-dev libkrb5-dev \
# libgsl0-dev qtwebengine5-dev nlohmann-json3-dev \
# lzma-dev liblzma-dev xxhash libxxhash-dev libzstd-dev zstd liblz4-dev lz4 \
# libgl2ps-dev davix-dev libfreetype6-dev libxrootd-dev libxrootd-client-dev xrootd-client \
# libtbb-dev libprotobuf-dev protobuf-compiler protobuf-c-compiler libblas-dev java-common \
# libpostgrcesql-ocaml-dev libsqlite3-dev libgif-dev libtiff-dev libjpeg-dev libopengl-dev \
# terminfo libedit-dev googletest-tools
# sudo apt-get install -y graphviz qhelpgenerator-qt5

- name: Set up Python Virtual Env
# if the `if` expr is false, `if` still has exit code 0.
# if the `if` block is entered, the block's exit code becomes the exit
# code of the `if`.
run: 'if [ -d /py-venv/ROOT-CI/bin/ ]; then . /py-venv/ROOT-CI/bin/activate && echo PATH=$PATH >> $GITHUB_ENV; fi'

- name: Install required packages
run: |
dnf update -y && dnf install -y sudo
sudo dnf update -y
sudo dnf upgrade -y
sudo dnf install -y flex bison
# - name: Install Python modules (for local testing only?)
# run: |
# sudo apt-get install python3-pip -y
# python3 -m pip install --upgrade pip setuptools
# python3 -m pip install python-openstackclient pytest pyspark distributed

# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v1.14
# with:
# cmake-version: '3.29.x'

# - name: cache doxygen for faster debugging
# uses: actions/cache@v4
# id: cache-doxygen
# with:
# path: ${{ github.workspace }}/doxygen
# key: ${{ runner.os }}-doxygen

- name: Build Doxygen
# if: steps.cache-doxygen.outputs.cache-hit != 'true'
run: |
git clone https://github.com/doxygen/doxygen.git --depth 1
cd doxygen
mkdir build && cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/doxygen/install
make -j $(nproc)
make install -j $(nproc)
# - name: Install Doxygen
# run : |
# wget https://github.com/doxygen/doxygen/releases/download/Release_1_10_0/doxygen-1.10.0.linux.bin.tar.gz
# mkdir doxygen
# tar -xvf doxygen-1.10.0.linux.bin.tar.gz -C doxygen

- name: Apply option overrides
if: ${{ github.event_name != 'schedule' }}
env:
OVERRIDES: "DOXYGEN_EXECUTABLE=${{ github.workspace }}/doxygen/install/bin/doxygen"
# ${{ inputs.overrides }}
# DOXYGEN_GENERATE_QHP=on DOCU_QHG_LOCATION=qhelpgenerator"
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/minimal.txt'
shell: bash
run: |
set -x
echo '' >> "$CONFIGFILE"
for ENTRY in $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
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"

- name: Print debug info
run: |
printf "%s@%s\\n" "$(whoami)" "$(hostname)"
ls -la
ls /usr/bin/
env
# - name: cache root for faster debugging
# uses: actions/cache@v4
# id: cache-root
# with:
# path: |
# ${{ github.workspace }}/ROOT-CI/build/interpreter
# ${{ github.workspace }}/ROOT-CI/build/include
# key: ${{ runner.os }}-root-1

# - name: Download ROOT binary
# uses: actions/download-artifact@v4
# with:
# name: Binaries $platform
# path: /github/home/ROOT-CI/packages/root_v*
# if-no-files-found: error

- name: Pull Request Build
if: github.event_name == 'pull_request'
env:
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Release
--platform $platform
--image registry.cern.ch/root-ci/$platform:buildready
--dockeropts '--security-opt label=disable --rm'
--incremental true
--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 }}
--documentation false
--binaries false
"

- name: Pull Request Build ROOT with documentation
if: github.event_name == 'pull_request'
env:
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Release
--platform $platform
--image registry.cern.ch/root-ci/$platform:buildready
--dockeropts '--security-opt label=disable --rm'
--incremental true
--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 }}
--documentation true
--binaries false
"

- name: Build ROOT with documentation
if: github.event_name == 'push'
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Release
--platform $platform
--incremental true
--base_ref ${{ github.ref_name }}
--binaries false
--documentation true
--repository ${{ github.server_url }}/${{ github.repository }}
"

- name: Build ROOT with documentation
if: github.event_name == 'workflow_dispatch'
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Release
--platform $platform
--incremental true
--base_ref ${{ inputs.base_ref }}
--head_ref ${{ inputs.head_ref }}
--binaries false
--documentation true
--repository ${{ github.server_url }}/${{ github.repository }}
"

# # For faster testing
# - name: Restore cached ROOT
# id: cache-deps-restore
# uses: actions/cache/restore@v3
# with:
# path: ~/root
# key: ${{ runner.os }}-deps

# - name: Check out ROOT
# uses: actions/checkout@v4
# with:
# repository: jolly-chen/root
# ref: 'gen_docs_ci'
# token: ${{ secrets.GITHUB_TOKEN }}
# path: root

# - name: Save deps
# id: cache-deps-save
# uses: actions/cache/save@v3
# with:
# path: ~/root
# key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}

# - name: ls
# run: |
# ls

0 comments on commit 80b464c

Please sign in to comment.