Skip to content

Commit 3723a28

Browse files
authored
Merge pull request arfc#21 from abachma2/tests
2 parents 1ad3ae1 + 7b36520 commit 3723a28

9 files changed

+62
-141
lines changed

.github/workflows/changelog_test.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Changelog update check
2+
3+
on:
4+
# allows us to run workflows manually
5+
workflow_dispatch:
6+
pull_request:
7+
8+
env:
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
11+
jobs:
12+
check_changelog_update:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: alpine:3.14
16+
17+
name: Check if Changelog has been updated
18+
steps:
19+
- name: Install latest git
20+
run: |
21+
apk add --no-cache bash git openssh
22+
git --version
23+
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- run: |
28+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
29+
cd $GITHUB_WORKSPACE
30+
git remote add arfc https://github.com/arfc/openmcyclus.git
31+
git fetch arfc
32+
change=`git diff arfc/main -- CHANGELOG.rst | wc -l`
33+
git remote remove arfc
34+
if [ $change -eq 0 ]; then
35+
echo "CHANGELOG.rst has not been updated"
36+
exit 1
37+
fi
38+
+7-19
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: test-openmcyclus
2-
on: [pull_request]
2+
on: [pull_request, push]
33

44
jobs:
5-
build-and-test:
5+
integration-tests:
66
runs-on: ubuntu-latest
7-
container:
8-
image: cyclus/cycamore
97
defaults:
108
run:
119
shell: bash -l {0}
@@ -18,35 +16,25 @@ jobs:
1816
miniforge-variant: Mambaforge
1917
miniforge-version: latest
2018
activate-environment: openmcyclus-env
21-
environment-file: environment.yml
2219
use-mamba: true
2320

2421
- name: Conda config
2522
run: |
2623
conda config --env --set pip_interop_enabled True
2724
28-
- name: Update Environment
25+
- name: Install dependencies
2926
run: |
30-
pip install pytest
31-
mamba env update -n openmcyclus-env -f environment.yml
27+
mamba install -y cycamore openmc scipy=1.11 pytest
3228
3329
- name: Install OpenMC cross section library
34-
run: $GITHUB_WORKSPACE/openmc-xs.bash
35-
36-
- name: Install OpenMC from Mamba
37-
run: mamba install openmc
38-
39-
- name: Install OpenMC cross section library
40-
run: echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV
30+
run: |
31+
$GITHUB_WORKSPACE/openmc-xs.bash
32+
echo "OPENMC_CROSS_SECTIONS=cross_sections.xml" >> $GITHUB_ENV
4133
4234
- name: Install OpenMCyclus
4335
run: |
4436
pip install .
4537
46-
# - name: Check environment
47-
# run: |
48-
# pip install pytest
49-
5038
# - name: Run Tests
5139
# run: |
5240
# pytest tests/integration_tests/test_depletereactor.py

.github/workflows/unit-test.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: unit-tests
22
on: [pull_request, push]
33

44
jobs:
5-
build-and-unit-test:
5+
unit-test:
66
runs-on: ubuntu-latest
77
defaults:
88
run:
@@ -16,7 +16,6 @@ jobs:
1616
miniforge-variant: Mambaforge
1717
miniforge-version: latest
1818
activate-environment: openmcyclus-env
19-
environment-file: environment.yml
2019
use-mamba: true
2120

2221
- name: Conda config
@@ -25,7 +24,7 @@ jobs:
2524
2625
- name: Install OpenMC from Mamba
2726
run:
28-
mamba install openmc scipy=1.11
27+
mamba install openmc scipy=1.11 pytest
2928

3029
- name: Install OpenMC cross section library
3130
run: |

CHANGELOG.rst

+6
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@ Since last release:
1313
* Add input parameters to `DepleteReactor` for the thermal
1414
power (instead of just using `power_cap`) and flux
1515
(required input for running OpenMC with new version) (#18)
16+
* Add CI test to check if CHANGELOG has been updated (#21)
1617

1718
**Changed:**
1819

1920
* Change OpenMC dependency to v0.14.0, which includes adding
2021
parameters for using `DepleteReactor` (#18)
22+
* Simplify CI build environment, using conda builds instead of
23+
building from source (#21)
24+
2125

2226
**Removed:**
2327

2428
* Remove `check_existing_recipes` method in `DepleteReactor` (#18)
29+
* Remove various files in repo that are no longer used for building
30+
CI environment (#21)
2531

2632
**Fixed:**
2733

build-cyclus.sh

-7
This file was deleted.

build-openmc.sh

-11
This file was deleted.

environment.yml

-50
This file was deleted.

requirements.txt

-45
This file was deleted.

tests/unit_tests/test_depletion.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def setUp(self):
1919
10,
2020
100e-6,
2121
"./examples/")
22-
self.materials = openmc.Materials().from_xml("./examples/materials.xml")
22+
self.materials = openmc.Materials().from_xml(
23+
"./examples/materials.xml")
2324
self.micro_xs = od.MicroXS.from_csv("./examples/micro_xs.csv")
2425

2526
def run_depletion(self, flux):
@@ -66,11 +67,11 @@ def test_update_materials(self):
6667
openmc.material.NuclideTuple('U235', 0.05, 'wo'),
6768
openmc.material.NuclideTuple('U238', 0.95, 'wo')]
6869
assert materials[1].nuclides == [
69-
openmc.material.NuclideTuple('Cs137', 0.1, 'wo'),
70-
openmc.material.NuclideTuple('Kr85', 0.80, 'wo'),
70+
openmc.material.NuclideTuple('Cs137', 0.1, 'wo'),
71+
openmc.material.NuclideTuple('Kr85', 0.80, 'wo'),
7172
openmc.material.NuclideTuple('Xe135', 0.10, 'wo')]
7273
assert materials[2].nuclides == [
73-
openmc.material.NuclideTuple('Pu239', 0.10, 'wo'),
74+
openmc.material.NuclideTuple('Pu239', 0.10, 'wo'),
7475
openmc.material.NuclideTuple('Pu241', 0.90, 'wo')]
7576
assert material_ids == [5, 6, 7]
7677

@@ -96,5 +97,7 @@ def test_get_spent_comps(self):
9697
assert 551370000 in spent_comps[0].keys()
9798
assert 922350000 in spent_comps[0].keys()
9899
assert 932410000 not in spent_comps[0].keys()
99-
assert spent_comps[0][922350000] == 10.650004036820036
100-
assert spent_comps[0][942390000] == 0.22663550016678385
100+
assert spent_comps[0][922350000] == pytest.approx(
101+
10.650004036820036, rel=1e-5)
102+
assert spent_comps[0][942390000] == pytest.approx(
103+
0.22663550016678385, rel=1e-5)

0 commit comments

Comments
 (0)