Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023 maintenance update #1587

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2b64704
Update CMake version
gonuke May 17, 2022
f0016c3
update CMakeLists and move unused Find* out of the way
gonuke May 17, 2022
7224478
slightly further along
nuclearkatie May 17, 2022
786db84
Move target creation to facilitate CMake changes
gonuke May 17, 2022
3eb7dc7
update for Python 3
gonuke May 17, 2022
928e5e0
Update deps dockerfile to modern ubuntu and conda-installed packages
gonuke Mar 13, 2023
a972f2b
force libsqlite reinstall (why?)
gonuke Mar 13, 2023
cd15181
temporarily use cyclus-local image for deps
gonuke Mar 13, 2023
d882265
update xml++ version and trying to find SQLite3
gonuke Mar 13, 2023
f1f7b16
a little cleanup but no substantive changes
gonuke Mar 14, 2023
462481e
introduce custom target to pass along dependency on custom command
gonuke Mar 14, 2023
a9a7f28
update for XML++ 4.0
gonuke Mar 14, 2023
6651f34
update for xml++ 4.0
gonuke Mar 14, 2023
fe4364c
require C++ 14
gonuke Mar 14, 2023
5f2d4da
fix case on SQLite3 variables
gonuke Mar 15, 2023
0112f7b
add numpy includ dirs
gonuke Mar 15, 2023
fb817ab
revert to original test building pattern (with failures)
gonuke Mar 15, 2023
eca26f5
revert to custom FindCOIN methods to ensure all libraries are include…
gonuke Mar 15, 2023
d6a6cf0
convert custom command to custom target
gonuke Mar 15, 2023
de32221
replace nose.tools asserts except yields
gonuke Mar 17, 2023
71026ac
address more complex nose to pytest cases
gonuke Mar 17, 2023
71a3367
fix collections in cython
gonuke Mar 17, 2023
f654029
advanced pytest conversion
gonuke Mar 17, 2023
40675f5
additional test in JsonPyRoundTrip
gonuke Mar 17, 2023
d346adb
constrain cython to avoid incompatibility
gonuke Aug 31, 2023
37b2730
handle different APIs for libxml++
gonuke Sep 7, 2023
8118a7e
multistage build for apt and conda
gonuke Sep 7, 2023
1560087
improve libxml++ flexibility
gonuke Sep 7, 2023
69cecd6
single dockerfile with conda vs apt option
gonuke Sep 8, 2023
6206b63
cleanup libxml++ options
gonuke Sep 8, 2023
ede3724
first attempt at docker file prep for CI
gonuke Sep 8, 2023
969bb47
add make core arg
gonuke Sep 8, 2023
20ef6eb
indentation fix
gonuke Sep 8, 2023
dc51cc8
add muiltstage based build test
gonuke Sep 8, 2023
cb8a022
dumb typo
gonuke Sep 8, 2023
4aba0f8
change name of build test action
gonuke Sep 8, 2023
2f11458
update Json CustomWriter to match contemporary python format
gonuke Sep 8, 2023
5a65d54
add simplified changelog test
gonuke Sep 8, 2023
2e272cf
another dumb typo
gonuke Sep 8, 2023
82f660c
updated changelog
gonuke Sep 8, 2023
2d443c2
add trigger for testing
gonuke Sep 8, 2023
6027a64
add testing to docker image build
gonuke Sep 8, 2023
ec9218a
update path in apt version
gonuke Sep 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 35 additions & 37 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,48 @@
name: Standard Build and Test
name: Build & Test PR

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
branches:
- master
paths-ignore:
- '.github/workflows/docker_publish.yml'

push:
branches:
- master
pull_request:
paths-ignore:
- 'docker/Dockerfile'
- '.github/workflows/docker_publish.yml'


jobs:
BuildTest:
runs-on: ubuntu-latest
build-dependency-and-test-img:
runs-on: ubuntu-latest

strategy:
matrix:
ubuntu_versions : [
22.04,
]
pkg_mgr : [
apt,
conda,
]

container:
image: cyclus/cyclus-deps

name: Installing Dependencies, Building cyclus and running tests
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: setup
run: |
echo "HOME=/github/home/" >> $GITHUB_ENV
echo "PATH=$PATH:${HOME}/.local/bin" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/.local/lib" >> $GITHUB_ENV
- name: Building Cyclus
run: |
mkdir -p ${HOME}/.local/lib/python3.7/site-packages/
cd ${GITHUB_WORKSPACE}
python install.py -j 2 \
--build-type=Release --core-version 999999.999999 \
-DBLAS_LIBRARIES="/opt/conda/lib/libblas.so" \
-DLAPACK_LIBRARIES="/opt/conda/lib/liblapack.so"
- name: Checkout repository
uses: actions/checkout@v3

- name: Unit Test
run: |
cyclus_unit_tests; exit $?

- name: Nosetest
run: |
nosetests -w ${GITHUB_WORKSPACE}/tests; exit $?
- name: Installing Dependencies in Docker image
uses: firehed/multistage-docker-build-action@v1
with:
repository: ghcr.io/${{ github.repository_owner }}/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}
stages: ${{ matrix.pkg_mgr }}-deps, cyclus
server-stage: cyclus-test
quiet: false
parallel: true
tag-latest-on-default: false
dockerfile: docker/Dockerfile
build-args: pkg_mgr=${{ matrix.pkg_mgr }}
18 changes: 12 additions & 6 deletions .github/workflows/changelog_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:

jobs:
changelog_update:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
container:
image: alpine:3.14
Expand All @@ -23,10 +22,17 @@ jobs:
git --version

- name: Checkout repository
uses: actions/checkout@v2
- name: Housekeeping
run: |
uses: actions/checkout@v3

- run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
cd $GITHUB_WORKSPACE
housekeeping_script/changelog_test.sh
git remote add cyclus https://github.com/cyclus/cyclus.git
git fetch cyclus
change=`git diff cyclus/master -- CHANGELOG.rst | wc -l`
git remote remove cyclus
if [ $change -eq 0 ]; then
echo "CHANGELOG.rst has not been updated"
exit 1
fi

100 changes: 100 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build & Publish docker image for CI

on:
# allows us to run workflows manually
workflow_dispatch:
push:
paths:
- 'docker/Dockerfile'
- '.github/workflows/docker_publish.yml'

jobs:
build-dependency-and-test-img:
runs-on: ubuntu-latest

strategy:
matrix:
ubuntu_versions : [
22.04,
]
pkg_mgr : [
apt,
conda,
]

name: Installing Dependencies, Building cyclus and running tests
steps:
- name: default environment
run: |
echo "tag-latest-on-default=false" >> "$GITHUB_ENV"

- name: condition on trigger parameters
if: ${{ github.repository_owner == 'svalinn' && github.ref == 'refs/heads/develop' }}
run: |
echo "tag-latest-on-default=true" >> "$GITHUB_ENV"

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v3

- name: Installing Dependencies in Docker image
uses: firehed/multistage-docker-build-action@v1
with:
repository: ghcr.io/${{ github.repository_owner }}/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}
stages: ${{ matrix.pkg_mgr }}-deps, cyclus
server-stage: cyclus-test
quiet: false
parallel: true
tag-latest-on-default: ${{ env.tag-latest-on-default }}
dockerfile: docker/Dockerfile
build-args: pkg_mgr=${{ matrix.pkg_mgr }}


push_stable_ci_img:
needs: [build-dependency-and-test-img]
runs-on: ubuntu-latest

strategy:
matrix:
ubuntu_versions : [
22.04,
]
pkg_mgr : [
apt,
conda,
]

name: Pushing final images
steps:
- name: Log in to the Container registry
if: ${{ github.repository_owner == 'cyclus' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Store image name
if: ${{ github.repository_owner == 'cyclus' }}
run: |
echo "image_base_tag=ghcr.io/${{ github.repository_owner }}/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}" >> "$GITHUB_ENV"

- name: Push Image as latest img
if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/develop' }}
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ${{ env.image_base_tag }}/cyclus:latest
dst: ${{ env.image_base_tag }}:latest

- name: Push Image as latest img
if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/develop' }}
uses: akhilerm/tag-push-action@v2.1.0
with:
src: ${{ env.image_base_tag }}:latest
dst: ${{ env.image_base_tag }}:stable
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Since last release
**Changed:**

* Moved to unified CHANGELOG Entry and check them with GithubAction (#1571)

* Major update and modernization of build (#1587)
* Changed Json formatting for compatibility with current python standards (#1587)

**Removed:**

Expand Down
72 changes: 37 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
#taken from http://geant4.cern.ch/support/source/geant4/CMakeLists.txt
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Cyclus requires an out-of-source build.")
Expand All @@ -10,20 +10,16 @@ IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "in-source build detected")
ENDIF()

# Set some policies
cmake_policy(SET CMP0040 OLD)
cmake_policy(SET CMP0042 OLD)

# This project name is cyclus.
PROJECT(CYCLUS)

# check for and enable c++11 support (required for cyclus)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
IF(COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
ELSE()
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
ENDIF()

# enable assembly
Expand Down Expand Up @@ -108,8 +104,10 @@ IF(NOT CYCLUS_DOC_ONLY)
endif()

# Tell CMake where the modules are
LIST(APPEND CMAKE_MODULE_PATH
"${CMAKE_DIR}/share/cmake-2.8/Modules" "${PROJECT_SOURCE_DIR}/cmake")
MESSAGE("-- CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
# "/opt/conda/share/cmake-3.25/Modules"
"${PROJECT_SOURCE_DIR}/cmake")

# Include macros
INCLUDE(CopyWhenDiffMacro)
Expand Down Expand Up @@ -162,24 +160,29 @@ IF(NOT CYCLUS_DOC_ONLY)
MESSAGE("-- Dependency Binary Hints (DEPS_BIN_HINTS): ${DEPS_BIN_HINTS}")
MESSAGE("-- Dependency Library Hints (DEPS_LIB_HINTS): ${DEPS_LIB_HINTS}")
MESSAGE("-- Dependency Include Hints (DEPS_INCLUDE_HINTS): ${DEPS_INCLUDE_HINTS}")
MESSAGE("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")

# Search pkg-config utility first
find_package(PkgConfig REQUIRED)


# Debian installs useful LibXML2 files to /usr/include/libxml2/libxml
# libxml2 is required for relaxng schema validation
FIND_PACKAGE(LibXml2 ${DEPS_HINTS})
IF(NOT LIBXML2_LIBRARIES)
FIND_LIBRARY(LibXml2 REQUIRED ${DEPS_HINTS})
ENDIF()

FIND_PACKAGE(LibXml2 REQUIRED)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
SET(LIBS ${LIBS} ${LIBXML2_LIBRARIES})

# Find LibXML++ and dependencies
FIND_PACKAGE(LibXML++)
IF(NOT LibXML++_LIBRARIES)
FIND_LIBRARY(LibXML++ REQUIRED ${DEPS_HINTS})
ENDIF()
SET(LIBS ${LIBS} ${LibXML++_LIBRARIES})
message("-- LibXML++ Include Dir: ${LibXML++_INCLUDE_DIR}")

message("-- LibXML2 Include Dir: ${LIBXML2_INCLUDE_DIR}")

# Then use pkg-config for locate specific package
pkg_check_modules(LIBXMLXX IMPORTED_TARGET libxml++-4.0)
IF ( NOT LIBXMLXX_LIBRARIES )
pkg_check_modules(LIBXMLXX REQUIRED IMPORTED_TARGET libxml++-2.6)
ENDIF ( NOT LIBXMLXX_LIBRARIES )
SET(LIBS ${LIBS} ${LIBXMLXX_LIBRARIES})
message("-- LibXML++ Include Dir: ${LIBXMLXX_INCLUDE_DIRS}")
message("-- LibXML++ Librarires: ${LIBXMLXX_LIBRARIES}")

# find lapack and link to it
FIND_PACKAGE(LAPACK REQUIRED)
set(LIBS ${LIBS} ${LAPACK_LIBRARIES})
Expand All @@ -188,8 +191,9 @@ IF(NOT CYCLUS_DOC_ONLY)
MESSAGE("-- Found BLAS Libraries: ${BLAS_LIBRARIES}")

# Find Sqlite3
FIND_PACKAGE(Sqlite3 REQUIRED)
SET(LIBS ${LIBS} ${SQLITE3_LIBRARIES})
FIND_PACKAGE(SQLite3 REQUIRED)
SET(LIBS ${LIBS} ${SQLite3_LIBRARIES})
MESSAGE("-- Found SQLite3 Libraries: ${SQLite3_LIBRARIES}")

# Find HDF5
FIND_PACKAGE(HDF5 REQUIRED COMPONENTS HL)
Expand Down Expand Up @@ -300,8 +304,8 @@ IF(NOT CYCLUS_DOC_ONLY)
# Cython & Python Bindings
#
# Use new Python library finder
find_package(PythonInterp)
find_package(PythonLibs)
find_package (Python3 COMPONENTS Interpreter Development NumPy)

execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
"import site; print(site.getsitepackages(['${CMAKE_INSTALL_PREFIX}'])[0])"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
Expand All @@ -321,7 +325,6 @@ IF(NOT CYCLUS_DOC_ONLY)
endif()
include(UseCython)

find_package(Numpy REQUIRED)
find_package(Jinja2 REQUIRED)
find_package(Pandas REQUIRED)

Expand Down Expand Up @@ -362,10 +365,10 @@ IF(NOT CYCLUS_DOC_ONLY)
# ${Glibmm_INCLUDE_DIRS} breaks Ubuntu 12.04
set(inc_dirs
"${LIBXML2_INCLUDE_DIR}"
"${LibXML++_INCLUDE_DIR}"
"${LIBXMLXX_INCLUDE_DIRS}"
"${Glibmm_INCLUDE_DIRS}"
"${LibXML++Config_INCLUDE_DIR}"
"${SQLITE3_INCLUDE_DIR}"
"${LIBXMLXXConfig_INCLUDE_DIR}"
"${SQLite3_INCLUDE_DIR}"
"${HDF5_INCLUDE_DIRS}"
"${Boost_INCLUDE_DIR}"
"${COIN_INCLUDE_DIRS}")
Expand All @@ -376,8 +379,7 @@ IF(NOT CYCLUS_DOC_ONLY)


if(Cython_FOUND)
INCLUDE_DIRECTORIES(AFTER "${PYTHON_INCLUDE_DIRS}"
"${NUMPY_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(AFTER "${PYTHON_INCLUDE_DIRS}" "${_Python3_NumPy_INCLUDE_DIR}")
endif(Cython_FOUND)
# set core version, one way or the other
IF(NOT "${CORE_VERSION}" STREQUAL "")
Expand All @@ -403,7 +405,7 @@ IF(NOT CYCLUS_DOC_ONLY)
if(Cython_FOUND)
ADD_SUBDIRECTORY("${CYCLUS_PYSOURCE_DIR}")
endif(Cython_FOUND)

##############################################################################################
####################################### end includes #########################################
##############################################################################################
Expand Down Expand Up @@ -489,7 +491,7 @@ IF(NOT CYCLUS_DOC_ONLY)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libboost-program-options-dev (>= 1.54.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libboost-serialization-dev (>= 1.54.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libhdf5-dev (>= 1.8.11)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libxml++2.6-dev (>= 2.36.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libxml++4.0-dev (>= 4.0.0)")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, coinor-libcbc-dev (>= 2.8.7)")
MESSAGE("CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}")

Expand Down