Skip to content

Commit

Permalink
Merge branch 'main' into api-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-moreno committed Sep 24, 2024
2 parents b36cd55 + eb0d921 commit d7de931
Show file tree
Hide file tree
Showing 301 changed files with 3,771 additions and 2,683 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ AlignConsecutiveAssignments: true
AlignConsecutiveMacros: true
AccessModifierOffset: -2
SortIncludes: true
IndentPPDirectives: BeforeHash
IncludeBlocks: Regroup
IncludeCategories:
# Rogue Directives.h goes first
Expand Down
148 changes: 32 additions & 116 deletions .github/workflows/rogue_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,26 @@ jobs:
cache: 'pip'
cache-dependency-path: 'pip_requirements.txt'

# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install doxygen doxygen-doc libzmq3-dev libboost-all-dev
pip install -r pip_requirements.txt
# Flake 8 check
- name: Flake8 Tests
# Python Linter
- name: Python Linter
run: |
python -m compileall -f ./python/
flake8 --count ./python/
python -m compileall -f ./tests
flake8 --count ./tests/
# C++ Linter
- name: C++ Linter
run: |
find . -name '*.h' -o -name '*.cpp' | xargs cpplint
# Rogue
- name: Build Rogue
run: |
Expand Down Expand Up @@ -99,6 +105,8 @@ jobs:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: docs/build/html

# ----------------------------------------------------------------------------

small_build_test:
name: Small Build Test
runs-on: ubuntu-20.04
Expand All @@ -122,126 +130,34 @@ jobs:
make -j4 install
# ----------------------------------------------------------------------------

gen_release:
name: Generate Release
runs-on: ubuntu-20.04
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
steps:
uses: slaclab/ruckus/.github/workflows/gen_release.yml@main
with:
version: '1.0.0'
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Get Image Information
id: get_image_info
run: |
echo tag=`git describe --tags` >> ${GITHUB_OUTPUT}
- name: Get Ruckus
run: |
git clone https://github.com/slaclab/ruckus.git
python -m pip install --upgrade pip
pip install -r ruckus/scripts/pip_requirements.txt
- name: Gen Release
env:
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_TAG: ${{ steps.get_image_info.outputs.tag }}
GH_REPO_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
python ruckus/scripts/releaseGen.py
# ----------------------------------------------------------------------------

conda_build:
name: Anaconda Build
conda_build_lib:
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:

# This step checks out a copy of your repository.
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Setup anaconda
run: |
cd ${HOME}
wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash miniconda.sh -b -p ${HOME}/miniconda
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda config --set always_yes yes
conda config --set channel_priority strict
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda install conda-build anaconda-client conda-verify
conda update -q conda conda-build
conda update --all
- name: Get Image Information
id: get_image_info
env:
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }}
run: |
echo token=${CONDA_UPLOAD_TOKEN_TAG} >> ${GITHUB_OUTPUT}
- name: Build
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda build conda-recipe --output-folder bld-dir -c conda-forge
uses: slaclab/ruckus/.github/workflows/conda_build_lib.yml@main
with:
version: '1.0.0'
secrets:
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }}

- name: Upload
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
anaconda -t ${{ steps.get_image_info.outputs.token }} upload --force bld-dir/*/*.tar.bz2
# ----------------------------------------------------------------------------

docker_build:
name: Docker Build
runs-on: ubuntu-20.04
docker_build_lib:
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
steps:

# This step checks out a copy of your repository.
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get Image Information
id: get_image_info
run: |
echo tag=`git describe --tags` >> ${GITHUB_OUTPUT}
echo branch=`echo ${GITHUB_REF} | awk 'BEGIN { FS = "/" } ; { print $3 }'` >> ${GITHUB_OUTPUT}
# Setup docker build environment
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# Login to Dockerhub
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: tidair
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Build and push the docker image
- name: Build and push image to Dockerhub
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: tidair/rogue:${{ steps.get_image_info.outputs.tag }}, tidair/rogue:latest
build-args: branch=${{ steps.get_image_info.outputs.branch }}
uses: slaclab/ruckus/.github/workflows/docker_build_lib.yml@main
with:
version: '1.0.0'
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

# ----------------------------------------------------------------------------
38 changes: 18 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (DEFINED ENV{CONDA_PREFIX})
endif()

# Check cmake version
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)
include(InstallRequiredSystemLibraries)

# Set default release type
Expand All @@ -45,8 +45,10 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
# Boost + Python
#####################################
if ( NOT NO_PYTHON )
find_package(PythonInterp 3 QUIET REQUIRED)
find_package(PythonLibs 3 QUIET REQUIRED)

# Find newest python interpreter first
set(Python3_FIND_STRATEGY "LOCATION")
find_package(Python3 QUIET REQUIRED COMPONENTS Interpreter Development)

# Find Numpy
execute_process(
Expand All @@ -66,21 +68,17 @@ if ( NOT NO_PYTHON )

# Hint for boost on anaconda
if (DEFINED ENV{CONDA_PREFIX})
set(BOOST_ROOT $ENV{CONDA_PREFIX})

# SLAC AFS custom path
elseif (DEFINED ENV{BOOST_PATH})
set(BOOST_ROOT $ENV{BOOST_PATH})
set(Boost_ROOT $ENV{CONDA_PREFIX})
endif()

# libboost_python3.7 style libraries
message("Looking for libboost_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
message("Looking for libboost_python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})

# libboost_python3 style libraries
if (NOT Boost_FOUND)
message("Looking for libboost_python${PYTHON_VERSION_MAJOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python${PYTHON_VERSION_MAJOR})
message("Looking for libboost_python${Python3_VERSION_MAJOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python${Python3_VERSION_MAJOR})
endif()

# libboost_python style libraries
Expand All @@ -91,14 +89,14 @@ if ( NOT NO_PYTHON )

# libboost_python-py37 style libraries
if (NOT Boost_FOUND)
message("Looking for libboost_python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
message("Looking for libboost_python-py${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python-py${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
endif()

# libboost_python3-py37 style libraries
if (NOT Boost_FOUND)
message("Looking for libboost_python3-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python3-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
message("Looking for libboost_python3-py${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
FIND_PACKAGE(Boost 1.58 QUIET COMPONENTS python3-py${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
endif()

# Nothing worked
Expand Down Expand Up @@ -233,7 +231,7 @@ configure_file (
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR})
include_directories(system ${Boost_INCLUDE_DIRS})
include_directories(system ${PYTHON_INCLUDE_DIRS})
include_directories(system ${Python3_INCLUDE_DIRS})
include_directories(system ${Python3_NumPy_INCLUDE_DIRS})
include_directories(system ${ZeroMQ_INCLUDE_DIR})
include_directories(system ${BZIP2_INCLUDE_DIR})
Expand Down Expand Up @@ -267,7 +265,7 @@ TARGET_LINK_LIBRARIES(rogue-core-shared PUBLIC ${BZIP2_LIBRARIES})
if (APPLE)
set_target_properties(rogue-core-shared PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
TARGET_LINK_LIBRARIES(rogue-core-shared PUBLIC ${PYTHON_LIBRARIES})
TARGET_LINK_LIBRARIES(rogue-core-shared PUBLIC ${Python3_LIBRARIES})
TARGET_LINK_LIBRARIES(rogue-core-shared PUBLIC rt)
endif()

Expand All @@ -281,7 +279,7 @@ if(STATIC_LIB)
TARGET_LINK_LIBRARIES(rogue-core-static PUBLIC ${ZeroMQ_LIBRARY})
TARGET_LINK_LIBRARIES(rogue-core-static PUBLIC ${EPICS_LIBRARIES})
TARGET_LINK_LIBRARIES(rogue-core-static PUBLIC ${BZIP2_LIBRARIES})
TARGET_LINK_LIBRARIES(rogue-core-static PUBLIC ${PYTHON_LIBRARIES})
TARGET_LINK_LIBRARIES(rogue-core-static PUBLIC ${Python3_LIBRARIES})
TARGET_LINK_LIBRARIES(rogue-core-static PUBLIC rt)
endif()

Expand Down Expand Up @@ -417,7 +415,7 @@ else()
message("-- Found boost: ${Boost_INCLUDE_DIRS}")
message("-- Found boost: ${Boost_LIBRARIES}")
message("")
message("-- Found python: ${PYTHON_LIBRARIES}")
message("-- Found python: ${Python3_LIBRARIES}")
message("-- Found numpy: ${Python3_NumPy_INCLUDE_DIRS}")
endif()

Expand Down
34 changes: 34 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#######################################################
# CPPLINT.cfg
#######################################################

# Increase the max number of characters on a given line
linelength=250

# List of filters to apply
filter=-legal/copyright

# Suppress the warning for unapproved C++11 headers
# Required for "<thread> is an unapproved C++11 header"
filter=-build/c++11

# Disable the build/include_order check
# Required for #include "rogue/Directives.h" to be at start
filter=-build/include_order

# Disable the build/header_guard check
# Note changing header guard has wrong style
# E.g. from __ROGUE_UTILITIES_FILEIO_MODULE_H__ to INCLUDE_ROGUE_UTILITIES_MODULE_H_
filter=-build/header_guard

# Disable whitespace/indent check
# private/public: indent will be based on .clang-format format"
filter=-whitespace/indent

# Disable runtime/arrays
# TODO: We should fix in the future
filter=-runtime/arrays

# Disable runtime/references
# TODO: We should fix in the future
filter=-runtime/references
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, The Board of Trustees of the Leland Stanford Junior
Copyright (c) 2024, The Board of Trustees of the Leland Stanford Junior
University, through SLAC National Accelerator Laboratory (subject to receipt
of any required approvals from the U.S. Dept. of Energy). All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down
36 changes: 20 additions & 16 deletions buildroot-2019.08-x86_64.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_C_COMPILER_AR /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-ar)
set(CMAKE_ASM_COMPILER /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-gcc)
set(CMAKE_C_COMPILER /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-gcc)
set(CMAKE_CXX_COMPILER /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-g++)
set(CMAKE_LINKER /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-ld)
set(CMAKE_OBJCOPY /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-objcopy)
set(CMAKE_C_COMPILER_RANLIB /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-ranlib)
set(CMAKE_SIZE /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-size)
set(CMAKE_STRIP /afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-strip)
if (NOT DEFINED BUILDROOT_TOP)
set(BUILDROOT_TOP "/sdf/sw/epics/package/linuxRT/buildroot-2019.08")
endif()

set(CMAKE_C_COMPILER_AR "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-ar")
set(CMAKE_ASM_COMPILER "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-gcc")
set(CMAKE_C_COMPILER "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-gcc")
set(CMAKE_CXX_COMPILER "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-g++")
set(CMAKE_LINKER "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-ld")
set(CMAKE_OBJCOPY "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-objcopy")
set(CMAKE_C_COMPILER_RANLIB "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-ranlib")
set(CMAKE_SIZE "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-size")
set(CMAKE_STRIP "${BUILDROOT_TOP}/host/linux-x86_64/x86_64/usr/bin/x86_64-linux-strip")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# Define location of BZIP2 (cross-compiled)
set(BZIP2_LIBRARIES /afs/slac/g/lcls/package/bzip2/1.0.6/buildroot-2019.08-x86_64/lib/libbz2.a)
set(BZIP2_INCLUDE_DIR /afs/slac/g/lcls/package/bzip2/1.0.6/buildroot-2019.08-x86_64/include)
set(BZIP2_LIBRARIES "$ENV{PACKAGE_TOP}/bzip2/1.0.6/buildroot-2019.08-x86_64/lib/libbz2.a")
set(BZIP2_INCLUDE_DIR "$ENV{PACKAGE_TOP}/bzip2/1.0.6/buildroot-2019.08-x86_64/include")

# Define the location of ZMQ (cross-compiled)
set(ZeroMQ_LIBRARY /afs/slac/g/lcls/package/libzmq/zeromq-4.3.4/buildroot-2019.08-x86_64/lib/libzmq.a)
set(ZeroMQ_INCLUDE_DIR /afs/slac/g/lcls/package/libzmq/zeromq-4.3.4/buildroot-2019.08-x86_64/include)
set(ZeroMQ_LIBRARY "$ENV{PACKAGE_TOP}/libzmq/zeromq-4.3.4/buildroot-2019.08-x86_64/lib/libzmq.a")
set(ZeroMQ_INCLUDE_DIR "$ENV{PACKAGE_TOP}/libzmq/zeromq-4.3.4/buildroot-2019.08-x86_64/include")

# Define the location of python3 (cross-compiled)
set(PYTHON_LIBRARY /afs/slac/g/lcls/package/python/3.6.1/buildroot-2019.08-x86_64/lib/libpython3.6m.so)
set(PYTHON_INCLUDE_DIR /afs/slac/g/lcls/package/python/3.6.1/buildroot-2019.08-x86_64/include/python3.6m)
set(Python3_LIBRARY "$ENV{PACKAGE_TOP}/python/3.6.1/buildroot-2019.08-x86_64/lib/libpython3.6m.so")
set(Python3_INCLUDE_DIR "$ENV{PACKAGE_TOP}/python/3.6.1/buildroot-2019.08-x86_64/include/python3.6m")

# Define the location of boost (cross-compiled)
set(BOOST_ROOT /afs/slac/g/lcls/package/boost/1.64.0/buildroot-2019.08-x86_64)
set(BOOST_ROOT "$ENV{PACKAGE_TOP}/boost/1.64.0/buildroot-2019.08-x86_64")
1 change: 1 addition & 0 deletions conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ dependencies:
- matplotlib
- pytest
- pytest-cov
- pyqt=5.12
Loading

0 comments on commit d7de931

Please sign in to comment.