From c316428dac8af28e6bac8b208897fc67611aba49 Mon Sep 17 00:00:00 2001 From: abachmann Date: Mon, 6 May 2024 16:06:23 -0500 Subject: [PATCH 01/13] add test for if changelog is updated --- .github/workflows/changelog_test.yml | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/changelog_test.yml diff --git a/.github/workflows/changelog_test.yml b/.github/workflows/changelog_test.yml new file mode 100644 index 0000000..5564566 --- /dev/null +++ b/.github/workflows/changelog_test.yml @@ -0,0 +1,38 @@ +name: Changelog check + +on: + # allows us to run workflows manually + workflow_dispatch: + pull_request: + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + changelog_update: + runs-on: ubuntu-latest + container: + image: alpine:3.14 + + name: Is Changelog up-to-date ? + steps: + - name: Install latest git + run: | + apk add --no-cache bash git openssh + git --version + + - name: Checkout repository + uses: actions/checkout@v4 + + - run: | + git config --global --add safe.directory ${GITHUB_WORKSPACE} + cd $GITHUB_WORKSPACE + git remote add arfc https://github.com/arfc/openmcyclus.git + git fetch arfc + change=`git diff arfc/main -- CHANGELOG.rst | wc -l` + git remote remove arfc + if [ $change -eq 0 ]; then + echo "CHANGELOG.rst has not been updated" + exit 1 + fi + From 33172ea166933a466ffed5d06804095fa225d268 Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 24 May 2024 09:03:55 -0500 Subject: [PATCH 02/13] simplify dependency installations, change cyclus to conda install --- .github/workflows/test-openmcyclus.yml | 24 ++++++------------------ .github/workflows/unit-test.yml | 3 +-- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test-openmcyclus.yml b/.github/workflows/test-openmcyclus.yml index fdcbd3b..a5d07cc 100644 --- a/.github/workflows/test-openmcyclus.yml +++ b/.github/workflows/test-openmcyclus.yml @@ -1,11 +1,9 @@ name: test-openmcyclus -on: [pull_request] +on: [pull_request, push] jobs: build-and-test: runs-on: ubuntu-latest - container: - image: cyclus/cycamore defaults: run: shell: bash -l {0} @@ -18,35 +16,25 @@ jobs: miniforge-variant: Mambaforge miniforge-version: latest activate-environment: openmcyclus-env - environment-file: environment.yml use-mamba: true - name: Conda config run: | conda config --env --set pip_interop_enabled True - - name: Update Environment + - name: Install dependencies run: | - pip install pytest - mamba env update -n openmcyclus-env -f environment.yml + mamba install -y cycamore openmc scipy=1.11 pytest - name: Install OpenMC cross section library - run: $GITHUB_WORKSPACE/openmc-xs.bash - - - name: Install OpenMC from Mamba - run: mamba install openmc - - - name: Install OpenMC cross section library - run: echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV + run: | + $GITHUB_WORKSPACE/openmc-xs.bash + echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV - name: Install OpenMCyclus run: | pip install . -# - name: Check environment -# run: | -# pip install pytest - # - name: Run Tests # run: | # pytest tests/integration_tests/test_depletereactor.py diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 3a9e8f3..525822b 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -16,7 +16,6 @@ jobs: miniforge-variant: Mambaforge miniforge-version: latest activate-environment: openmcyclus-env - environment-file: environment.yml use-mamba: true - name: Conda config @@ -25,7 +24,7 @@ jobs: - name: Install OpenMC from Mamba run: - mamba install openmc scipy=1.11 + mamba install openmc scipy=1.11 pytest - name: Install OpenMC cross section library run: | From 420acc420bd258591c5df5f9bcbe57e5b627e5a1 Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 24 May 2024 09:05:21 -0500 Subject: [PATCH 03/13] fix syntax error --- .github/workflows/test-openmcyclus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-openmcyclus.yml b/.github/workflows/test-openmcyclus.yml index a5d07cc..fc76402 100644 --- a/.github/workflows/test-openmcyclus.yml +++ b/.github/workflows/test-openmcyclus.yml @@ -28,8 +28,8 @@ jobs: - name: Install OpenMC cross section library run: | - $GITHUB_WORKSPACE/openmc-xs.bash - echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV + $GITHUB_WORKSPACE/openmc-xs.bash + echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV - name: Install OpenMCyclus run: | From 560c32bf7ec7eb72754edd83b58b3aefb0d39a0b Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 24 May 2024 09:11:48 -0500 Subject: [PATCH 04/13] remove unused files, previously used for testing environment --- build-cyclus.sh | 7 ------- build-openmc.sh | 11 ----------- environment.yml | 50 ------------------------------------------------ requirements.txt | 45 ------------------------------------------- 4 files changed, 113 deletions(-) delete mode 100755 build-cyclus.sh delete mode 100755 build-openmc.sh delete mode 100644 environment.yml delete mode 100644 requirements.txt diff --git a/build-cyclus.sh b/build-cyclus.sh deleted file mode 100755 index 0cd819c..0000000 --- a/build-cyclus.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Build cyclus -cd cyclus -conda activate openmcyclus-env -python install.py -cd ../ \ No newline at end of file diff --git a/build-openmc.sh b/build-openmc.sh deleted file mode 100755 index da52fc9..0000000 --- a/build-openmc.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -ex - -# Build openmc -cd openmc -./tools/ci/gha-install-mcpl.sh -python tools/ci/gha-install.py - -# Install the OpenMC python API -pip install . -cd ../ diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 8faf219..0000000 --- a/environment.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: openmcyclus-env -channels: - - conda-forge - - defaults -dependencies: - - openssh - - pytest - - gxx_linux-64==12.2 - - gcc_linux-64==12.2 - - cmake - - make - - docker-pycreds - - git - - xo - - python-json-logger - - glib - - libxml2 - - libxmlpp - - libblas - - libcblas - - liblapack - - pkg-config - - coincbc - - boost-cpp - - sqlite - - pcre - - gettext - - bzip2 - - xz - - setuptools - - pytables - - pandas - - jinja2 - - cython - - websockets - - pprintpp - - hdf5==1.12.2 - - notebook - - nb_conda_kernels - - requests - - entrypoints - - pyyaml - - vtk - - coverage - - pytest-cov - - colorama - - libpng - - uncertainties - - lxml - - scipy diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 10f3f59..0000000 --- a/requirements.txt +++ /dev/null @@ -1,45 +0,0 @@ -pytest -openssh -gxx_linux-64==12.2 -gcc_linux-64==12.2 -cmake -make -docker-pycreds -git -xo -python-json-logger -glib -libxml2 -libxmlpp -libblas -libcblas -liblapack -pkg-config -coincbc -boost-cpp -sqlite -pcre -gettext -bzip2 -xz -setuptools -pytables -pandas -jinja2 -cython -websockets -pprintpp -hdf5==1.12.2 -notebook -nb_conda_kernels -requests -entrypoints -pyyaml -vtk -coverage -pytest-cov -colorama -libpng -uncertainties -lxml -scipy \ No newline at end of file From 38c8707169c09fc8edee794116315e6af82bd255 Mon Sep 17 00:00:00 2001 From: abachmann Date: Thu, 6 Jun 2024 13:33:23 -0500 Subject: [PATCH 05/13] update CHANGELOG for PR 21 --- CHANGELOG.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8fda6d3..6a98ad2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,15 +13,21 @@ Since last release: * Add input parameters to `DepleteReactor` for the thermal power (instead of just using `power_cap`) and flux (required input for running OpenMC with new version) (#18) +* Add CI test for if CHANGELOG has been updated (#21) **Changed:** * Change OpenMC dependency to v0.14.0, which includes adding parameters for using `DepleteReactor` (#18) +* Simplifiy CI build environment, using conda builds instead of + building from source (#21) + **Removed:** * Remove `check_existing_recipes` method in `DepleteReactor` (#18) +* Remove various files in repo that are no longer used for building + CI enviroment (#21) **Fixed:** From ff69a7fd6f3f487ada52833d663eae5c8b32bc9a Mon Sep 17 00:00:00 2001 From: abachmann Date: Thu, 6 Jun 2024 13:40:22 -0500 Subject: [PATCH 06/13] pep8 fixes --- tests/unit_tests/test_depletion.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/test_depletion.py b/tests/unit_tests/test_depletion.py index 7917703..be33ef1 100644 --- a/tests/unit_tests/test_depletion.py +++ b/tests/unit_tests/test_depletion.py @@ -19,7 +19,8 @@ def setUp(self): 10, 100e-6, "./examples/") - self.materials = openmc.Materials().from_xml("./examples/materials.xml") + self.materials = openmc.Materials().from_xml( + "./examples/materials.xml") self.micro_xs = od.MicroXS.from_csv("./examples/micro_xs.csv") def run_depletion(self, flux): From 52f460d4f28e53660d90bfdccfd4c98d5b1ef943 Mon Sep 17 00:00:00 2001 From: abachmann Date: Tue, 25 Jun 2024 11:07:16 -0500 Subject: [PATCH 07/13] make revisions requested by @yardasol --- .github/workflows/changelog_test.yml | 6 +++--- CHANGELOG.rst | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/changelog_test.yml b/.github/workflows/changelog_test.yml index 5564566..20e33c4 100644 --- a/.github/workflows/changelog_test.yml +++ b/.github/workflows/changelog_test.yml @@ -1,4 +1,4 @@ -name: Changelog check +name: Changelog update check on: # allows us to run workflows manually @@ -9,12 +9,12 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - changelog_update: + check_changelog_update: runs-on: ubuntu-latest container: image: alpine:3.14 - name: Is Changelog up-to-date ? + name: Check if Changelog has been updated steps: - name: Install latest git run: | diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6a98ad2..e3b0987 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,13 +13,13 @@ Since last release: * Add input parameters to `DepleteReactor` for the thermal power (instead of just using `power_cap`) and flux (required input for running OpenMC with new version) (#18) -* Add CI test for if CHANGELOG has been updated (#21) +* Add CI test to check if CHANGELOG has been updated (#21) **Changed:** * Change OpenMC dependency to v0.14.0, which includes adding parameters for using `DepleteReactor` (#18) -* Simplifiy CI build environment, using conda builds instead of +* Simplify CI build environment, using conda builds instead of building from source (#21) @@ -27,7 +27,7 @@ Since last release: * Remove `check_existing_recipes` method in `DepleteReactor` (#18) * Remove various files in repo that are no longer used for building - CI enviroment (#21) + CI environment (#21) **Fixed:** From d960b14e17aa13890efa1e77d82cbe53e2a5d04a Mon Sep 17 00:00:00 2001 From: abachmann Date: Tue, 25 Jun 2024 11:55:41 -0500 Subject: [PATCH 08/13] remove container item --- .github/workflows/changelog_test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/changelog_test.yml b/.github/workflows/changelog_test.yml index 20e33c4..d1c63e7 100644 --- a/.github/workflows/changelog_test.yml +++ b/.github/workflows/changelog_test.yml @@ -11,8 +11,6 @@ env: jobs: check_changelog_update: runs-on: ubuntu-latest - container: - image: alpine:3.14 name: Check if Changelog has been updated steps: From c84d3444074a81318b1f2979ce58918f4b73d768 Mon Sep 17 00:00:00 2001 From: abachmann Date: Tue, 25 Jun 2024 11:57:01 -0500 Subject: [PATCH 09/13] add container image back in The alpine 3.14 docker container is needed to run the ``apk`` command to install the latest version of git --- .github/workflows/changelog_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/changelog_test.yml b/.github/workflows/changelog_test.yml index d1c63e7..20e33c4 100644 --- a/.github/workflows/changelog_test.yml +++ b/.github/workflows/changelog_test.yml @@ -11,6 +11,8 @@ env: jobs: check_changelog_update: runs-on: ubuntu-latest + container: + image: alpine:3.14 name: Check if Changelog has been updated steps: From 5f5105b547c7175b98e327437258a95a4a75fd94 Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 28 Jun 2024 11:11:50 -0500 Subject: [PATCH 10/13] run tests to see if archetype is found --- .github/workflows/test-openmcyclus.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-openmcyclus.yml b/.github/workflows/test-openmcyclus.yml index fc76402..8857764 100644 --- a/.github/workflows/test-openmcyclus.yml +++ b/.github/workflows/test-openmcyclus.yml @@ -35,6 +35,6 @@ jobs: run: | pip install . -# - name: Run Tests -# run: | -# pytest tests/integration_tests/test_depletereactor.py + - name: Run Tests + run: | + pytest tests/integration_tests/test_depletereactor.py From 174b2aae6048e628e04c297217d707a91fd1c3c2 Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 28 Jun 2024 11:18:29 -0500 Subject: [PATCH 11/13] update job names to be more descriptive --- .github/workflows/test-openmcyclus.yml | 8 ++++---- .github/workflows/unit-test.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-openmcyclus.yml b/.github/workflows/test-openmcyclus.yml index 8857764..d35c567 100644 --- a/.github/workflows/test-openmcyclus.yml +++ b/.github/workflows/test-openmcyclus.yml @@ -2,7 +2,7 @@ name: test-openmcyclus on: [pull_request, push] jobs: - build-and-test: + integration-tests: runs-on: ubuntu-latest defaults: run: @@ -35,6 +35,6 @@ jobs: run: | pip install . - - name: Run Tests - run: | - pytest tests/integration_tests/test_depletereactor.py +# - name: Run Tests +# run: | +# pytest tests/integration_tests/test_depletereactor.py diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 525822b..86ed0d0 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -2,7 +2,7 @@ name: unit-tests on: [pull_request, push] jobs: - build-and-unit-test: + unit-test: runs-on: ubuntu-latest defaults: run: From 6eebe3d4556d28636a95b8c1fba1711d0fe6a926 Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 28 Jun 2024 14:50:23 -0500 Subject: [PATCH 12/13] add pytest.approx for concentrations Adding this function makes the tests more sustaiable, as the cross section data stored in the ANL link may change slightly with time --- tests/unit_tests/test_depletion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests/test_depletion.py b/tests/unit_tests/test_depletion.py index be33ef1..a5aa602 100644 --- a/tests/unit_tests/test_depletion.py +++ b/tests/unit_tests/test_depletion.py @@ -97,5 +97,5 @@ def test_get_spent_comps(self): assert 551370000 in spent_comps[0].keys() assert 922350000 in spent_comps[0].keys() assert 932410000 not in spent_comps[0].keys() - assert spent_comps[0][922350000] == 10.650004036820036 - assert spent_comps[0][942390000] == 0.22663550016678385 + assert spent_comps[0][922350000] == pytest.approx(10.650004036820036, rel=1e-5) + assert spent_comps[0][942390000] == pytest.approx(0.22663550016678385, rel=1e-5) From 7b365207253f9c43e92b842b55d1194a996f3755 Mon Sep 17 00:00:00 2001 From: abachmann Date: Fri, 28 Jun 2024 14:57:38 -0500 Subject: [PATCH 13/13] pep8 fixes --- tests/unit_tests/test_depletion.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/unit_tests/test_depletion.py b/tests/unit_tests/test_depletion.py index a5aa602..0c083fc 100644 --- a/tests/unit_tests/test_depletion.py +++ b/tests/unit_tests/test_depletion.py @@ -67,11 +67,11 @@ def test_update_materials(self): openmc.material.NuclideTuple('U235', 0.05, 'wo'), openmc.material.NuclideTuple('U238', 0.95, 'wo')] assert materials[1].nuclides == [ - openmc.material.NuclideTuple('Cs137', 0.1, 'wo'), - openmc.material.NuclideTuple('Kr85', 0.80, 'wo'), + openmc.material.NuclideTuple('Cs137', 0.1, 'wo'), + openmc.material.NuclideTuple('Kr85', 0.80, 'wo'), openmc.material.NuclideTuple('Xe135', 0.10, 'wo')] assert materials[2].nuclides == [ - openmc.material.NuclideTuple('Pu239', 0.10, 'wo'), + openmc.material.NuclideTuple('Pu239', 0.10, 'wo'), openmc.material.NuclideTuple('Pu241', 0.90, 'wo')] assert material_ids == [5, 6, 7] @@ -97,5 +97,7 @@ def test_get_spent_comps(self): assert 551370000 in spent_comps[0].keys() assert 922350000 in spent_comps[0].keys() assert 932410000 not in spent_comps[0].keys() - assert spent_comps[0][922350000] == pytest.approx(10.650004036820036, rel=1e-5) - assert spent_comps[0][942390000] == pytest.approx(0.22663550016678385, rel=1e-5) + assert spent_comps[0][922350000] == pytest.approx( + 10.650004036820036, rel=1e-5) + assert spent_comps[0][942390000] == pytest.approx( + 0.22663550016678385, rel=1e-5)