Skip to content

Commit

Permalink
Merge pull request #1691 from cyclus/rhel-ci-new
Browse files Browse the repository at this point in the history
CI Support for RHEL (new)
  • Loading branch information
gonuke committed Mar 12, 2024
2 parents 551535a + 250337f commit befdee2
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 10 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
- '.github/workflows/code_coverage.yml'
- '.github/workflows/rocky_build_test.yml'
- 'doc/**'
- 'CHANGELOG.rst'
push:
Expand All @@ -17,11 +18,12 @@ on:
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
- '.github/workflows/code_coverage.yml'
- '.github/workflows/rocky_build_test.yml'
- 'doc/**'
- 'CHANGELOG.rst'

jobs:
build-test-cyclus:
build-test-ubuntu:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -149,4 +151,31 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number
path: pr_number

build-test-rocky:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
rocky_versions : [
8,
9,
]

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Checkout Cyclus
uses: actions/checkout@v4

- name: Build and Test Cyclus
id: build-cyclus
uses: docker/build-push-action@v5
with:
file: docker/Rocky.dockerfile
cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:ci-layer-cache
build-args: |
rocky_version=${{ matrix.rocky_versions }}
1 change: 1 addition & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- '.github/workflows/publish_latest.yml'
- '.github/workflows/publish_release.yml'
- '.github/workflows/changelog_test.yml'
- '.github/workflows/rocky_build_test.yml'
- 'doc/**'
- 'CHANGELOG.rst'
push:
Expand Down
55 changes: 52 additions & 3 deletions .github/workflows/publish_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

jobs:
build-dependency-img:
build-ubuntu-img:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -28,7 +28,7 @@ jobs:
conda,
]

name: Build, Test, Publish
name: Publish Ubuntu Latest
steps:
- name: Tag as ci-image-cache
run: |
Expand Down Expand Up @@ -104,4 +104,53 @@ jobs:
build-args: |
pkg_mgr=${{ matrix.pkg_mgr }}
ubuntu_version=${{ matrix.ubuntu_versions }}
cycamore_tag=${{ env.tag }}@${{ steps.build-cycamore.outputs.digest }}
cycamore_tag=${{ env.tag }}@${{ steps.build-cycamore.outputs.digest }}
build-rocky-img:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
matrix:
rocky_versions : [
8,
9,
]

name: Publish Rocky Latest
steps:
- name: Tag as ci-image-cache
run: |
echo "tag=ci-image-cache" >> "$GITHUB_ENV"
- name: Tag as latest
if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/main' }}
run: |
echo "tag=latest" >> "$GITHUB_ENV"
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout Cyclus
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build, Test, and Push Cyclus
id: build-cyclus
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:ci-layer-cache
cache-to: type=registry,ref=ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:ci-layer-cache,mode=max
file: docker/Rocky.dockerfile
push: true
tags: ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.tag }}
build-args: |
rocky_version=${{ matrix.rocky_versions }}
55 changes: 53 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [released]

jobs:
build-and-test-for-release:
build-and-test-ubuntu-release:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -26,7 +26,7 @@ jobs:
conda
]

name: Build, Test, Publish
name: Publish Ubuntu Release
steps:
- name: Tag as ci-image-cache
run: |
Expand Down Expand Up @@ -85,3 +85,54 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["cyclus*.deb"]'
build-and-test-rocky-release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
rocky_versions : [
8,
9,
]

name: Publish Rocky Release
steps:
- name: Tag as ci-image-cache
run: |
echo "version_tag=ci-image-cache" >> "$GITHUB_ENV"
echo "stable_tag=ci-image-cache" >> "$GITHUB_ENV"
- name: Tag as stable
if: ${{ github.repository_owner == 'cyclus' && github.event_name == 'release' }}
run: |
echo "version_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV"
echo "stable_tag=stable" >> "$GITHUB_ENV"
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout Cyclus
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build, Test, and Push Cyclus
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:ci-layer-cache
file: docker/Rocky.dockerfile
push: true
tags: |
ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.version_tag }}
ghcr.io/cyclus/cyclus_rocky_${{ matrix.rocky_versions }}/cyclus:${{ env.stable_tag }}
build-args: |
rocky_version=${{ matrix.rocky_versions }}
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Since last release
* Adds TotalInvTracker, which allows an inventory cap to be set for multiple resource buffers, and is now required for material buy policy (#1646)
* AddMutalReqs and AddReciepe functions and exclusive bids in python API of DRE (#1584)
* Created Package class and optional declaration of packages in input files (#1673), package id is a member of resources (materials/products) (#1675)
* CI support for Rocky Linux (#1691)

**Changed:**

Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,3 @@ RUN cyclus_unit_tests
FROM cyclus-test as cyclus-pytest

RUN cd tests && python -m pytest

89 changes: 89 additions & 0 deletions docker/Rocky.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
ARG rocky_version=9
FROM rockylinux:${rocky_version} as common-base

ENV TZ=America/Chicago
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN dnf update -y && \
dnf install -y 'dnf-command(config-manager)' && \
dnf install -y python3.11 epel-release

FROM common-base as rocky-8-config
RUN alternatives --set python /usr/bin/python3.11 && \
alternatives --set python3 /usr/bin/python3.11 && \
dnf config-manager --set-enabled powertools

FROM common-base as rocky-9-config
RUN alternatives --install /usr/bin/python python /bin/python3.11 10 && \
alternatives --install /usr/bin/python3 python3 /bin/python3.11 10 && \
dnf config-manager --set-enabled crb

FROM rocky-${rocky_version}-config as dnf-deps
RUN dnf install -y \
wget \
which \
git \
gcc \
gcc-c++ \
make \
cmake \
hdf5-devel \
libxml2-devel \
boost-devel \
blas-devel \
lapack-devel \
sqlite-devel \
gettext \
xz \
python3.11-devel \
python3.11-setuptools \
python3.11-pip \
python3.11-pytest \
&& dnf clean all

RUN mkdir -p $(python -m site --user-site) && python -m pip install pandas tables cython jinja2

FROM dnf-deps as libxmlpp
RUN dnf install -y m4 doxygen perl-open perl-XML-Parser diffutils pcre-cpp pcre-devel && \
python -m pip install meson ninja packaging && \
wget https://github.com/libxmlplusplus/libxmlplusplus/releases/download/4.0.3/libxml++-4.0.3.tar.xz && \
tar xf libxml++-4.0.3.tar.xz && \
cd libxml++-4.0.3 && \
meson setup --prefix /usr --libdir lib64 \
--buildtype=release \
-Dbuild-documentation=false\
-Dbuild-manual=false \
-Dmm-common:use-network=true \
-Dglibmm-2.68:build-documentation=false \
-Dglibmm-2.68:build-examples=false \
-Dsigc++-3.0:build-documentation=false \
-Dsigc++-3.0:build-examples=false \
-Dsigc++-3.0:build-manual=false \
build_dir . && \
cd build_dir && \
ninja && \
ninja install

FROM libxmlpp as cyclus
ARG make_cores=2

COPY . /cyclus
WORKDIR /cyclus

# Uncomment the following line to run cmake in verbose mode.
# This is sometimes useful for debugging.
#ENV VERBOSE=1

# You may add the option "--cmake-debug" to the following command
# for further CMake debugging.
RUN python install.py -j ${make_cores} --build-type=Release --core-version 999999.999999 -D Python3_EXECUTABLE=/usr/bin/python3.11
ENV PATH /root/.local/bin:$PATH
ENV LD_LIBRARY_PATH /root/.local/lib:/root/.local/lib/cyclus

FROM cyclus as cyclus-test

RUN cyclus_unit_tests

FROM cyclus-test as cyclus-pytest

RUN cd tests && python -m pytest

4 changes: 2 additions & 2 deletions src/env.cc.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const std::string Env::GetInstallPath() {
std::string instdir;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("which cyclus", "r"), pclose);
if (!pipe) {
throw std::runtime_error("popen() failed!");
throw std::runtime_error("popen() failed!");
}
while (fgets(buffer.data(), static_cast<int>(buffer.size()), pipe.get()) != nullptr) {
instdir += buffer.data();
instdir += buffer.data();
}
if (instdir.length() <= 0)
instdir = "@cyclus_install_dir@";
Expand Down

0 comments on commit befdee2

Please sign in to comment.