Skip to content

Commit

Permalink
2023 build fixes (#549)
Browse files Browse the repository at this point in the history
Override on testing as we shutdown CircleCI testing in conjunction with this PR.  GitHub actions are passing.

* update libxml requiremnt in cmakelists

* update sqlite requirement in cmakelists

* add Dockerfile and workflows

* delete circle.yml

* convert from nose to pytest

* change names in workflow to be more descriptive

* resolve docker config errors in workflows

squash 10 debugging commits

* full testing matrix

* less ambigous find command

* use fixture in test_run_inputs.py
  • Loading branch information
bennibbelink authored Nov 13, 2023
1 parent f097146 commit 038239e
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 391 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build/Test for PR and collaborator push

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
paths-ignore:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'
- 'doc/**'
push:
paths-ignore:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'
- 'doc/**'

jobs:
build-and-test:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ubuntu_versions : [
20.04,
22.04,
]
pkg_mgr : [
apt,
conda,
]
cyclus_tag: [
latest,
]

container:
image: ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{matrix.cyclus_tag}}

steps:
- name: Checkout Cycamore
uses: actions/checkout@v3

- name: Build Cycamore
run: |
python install.py --prefix=/root/.local --cyclus-root=/root/.local -j 2 --build-type=Release --core-version 99999.99999
- name: Cycamore Unit Tests
run: |
cycamore_unit_tests
- name: Cycamore Python Tests
run: |
export PYTHONPATH=$(find /root/.local/lib -type d -name 'cyclus-*-*.egg' -print -quit)
cd tests && python -m pytest
63 changes: 63 additions & 0 deletions .github/workflows/build_test_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and Publish Cycamore Images

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'
push:
branches:
- main
paths:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'

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

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

name: Installing Dependencies, Building Cycamore 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 == 'cyclus' && github.ref == 'refs/heads/main' }}
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: Multi-Stage Build Action
uses: firehed/multistage-docker-build-action@v1
with:
repository: ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}
stages: cycamore
server-stage: cycamore-test
quiet: false
parallel: true
tag-latest-on-default: ${{ env.tag-latest-on-default }}
dockerfile: docker/Dockerfile
build-args: pkg_mgr=${{ matrix.pkg_mgr }}, ubuntu_version=${{ matrix.ubuntu_versions }}
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ IF(NOT CYCLUS_DOC_ONLY)
MESSAGE("-- Dependency Library Hints (DEPS_LIB_HINTS): ${DEPS_LIB_HINTS}")
MESSAGE("-- Dependency Include Hints (DEPS_INCLUDE_HINTS): ${DEPS_INCLUDE_HINTS}")

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

# Find cyclus
FIND_PACKAGE(Cyclus REQUIRED)
SET(
Expand All @@ -115,15 +118,13 @@ IF(NOT CYCLUS_DOC_ONLY)
INCLUDE(UseCyclus)

# Find LibXML++ and dependencies
FIND_PACKAGE(LibXML++)
IF(NOT LibXML++_LIBRARIES)
FIND_LIBRARY(LibXML++ REQUIRED ${DEPS_HINTS})
ENDIF()
SET(CYCAMORE_INCLUDE_DIRS ${CYCAMORE_INCLUDE_DIRS} ${LibXML++_INCLUDE_DIR} ${Glibmm_INCLUDE_DIRS} ${LibXML++Config_INCLUDE_DIR})
SET(LIBS ${LIBS} ${LibXML++_LIBRARIES})
MESSAGE("-- LIBS: ${LIBS}")

MESSAGE("-- LD_LIBRARY_PATH: $ENV{LD_LIBRARY_PATH}")
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}")

# Include the boost header files and the program_options library
# Please be sure to use Boost rather than BOOST.
Expand Down Expand Up @@ -181,11 +182,12 @@ IF(NOT CYCLUS_DOC_ONLY)
MESSAGE("-- COIN Include directories: ${COIN_INCLUDE_DIRS}")
MESSAGE("-- COIN Libraries: ${COIN_LIBRARIES}")

FIND_PACKAGE( Sqlite3 REQUIRED )
SET(CYCAMORE_INCLUDE_DIRS ${CYCAMORE_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIR})
SET(LIBS ${LIBS} ${SQLITE3_LIBRARIES})
MESSAGE("-- SQLITE3 Include directories: ${SQLITE3_INCLUDE_DIR}")
MESSAGE("-- SQLITE3 Libraries: ${SQLITE3_LIBRARIES}")
# find SQLite
FIND_PACKAGE( SQLite3 REQUIRED )
SET(CYCAMORE_INCLUDE_DIRS ${CYCAMORE_INCLUDE_DIRS} ${SQLite3_INCLUDE_DIR})
SET(LIBS ${LIBS} ${SQLite3_LIBRARIES})
MESSAGE("-- SQLite3 Include directories: ${SQLite3_INCLUDE_DIR}")
MESSAGE("-- SQLite3 Libraries: ${SQLite_LIBRARIES}")

#
# Some optional libraries to link in, as availble. Required for conda.
Expand Down
166 changes: 0 additions & 166 deletions circle.yml

This file was deleted.

16 changes: 16 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG pkg_mgr=apt
ARG ubuntu_version=22.04

FROM ghcr.io/cyclus/cyclus_${ubuntu_version}_${pkg_mgr}/cyclus as cycamore
ARG make_cores=2

COPY . /cycamore
WORKDIR /cycamore

RUN python install.py -j ${make_cores} --build-type=Release --core-version 99999.99999

FROM cycamore as cycamore-test
RUN cycamore_unit_tests

FROM cycamore as cycamore-pytest
RUN cd tests && python -m pytest
4 changes: 1 addition & 3 deletions tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import sys
from hashlib import sha1
import numpy as np
import tables
from nose.tools import assert_equal


CYCLUS_HAS_COIN = None
Expand Down Expand Up @@ -85,7 +83,7 @@ def check_cmd(args, cwd, holdsrtn):
f.seek(0)
print("STDOUT + STDERR:\n\n" + f.read().decode())
holdsrtn[0] = rtn
assert_equal(rtn, 0)
assert rtn == 0


def cyclus_has_coin():
Expand Down
Loading

0 comments on commit 038239e

Please sign in to comment.