-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-activate-base: true | ||
activate-environment: "" | ||
|
||
- name: Install OpenMC | ||
shell: bash | ||
run: | | ||
conda config --add channels conda-forge | ||
conda install -c conda_forge openmc==0.15.0 | ||
- name: Clone OpenMC | ||
run: | | ||
git clone https://github.com/openmc-dev/openmc --branch v0.15.0 $HOME | ||
- name: Test examples | ||
run: | | ||
OPENMC_EXAMPLES_DIR=$HOME/openmc/examples pytest -v ./test/test_examples.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from openmc_cad_adapter import to_cubit_journal | ||
import openmc | ||
|
||
|
||
examples = ["pincell/build_xml.py", | ||
"lattice/hexagonal/build_xml.py", | ||
"assembly/assembly.py"] | ||
|
||
if 'OPENMC_EXAMPLES_DIR' not in os.environ: | ||
raise EnvironmentError('Variable OPENMC_EXAMPLES_DIR is required') | ||
|
||
OPENMC_EXAMPLES_DIR = Path(os.environ['OPENMC_EXAMPLES_DIR']).resolve() | ||
|
||
def example_name(example): | ||
return '-'.join(example.split('/')[:-1]) | ||
|
||
@pytest.mark.parametrize("example", examples, ids=example_name) | ||
def test_example(example): | ||
|
||
openmc.reset_auto_ids() | ||
exec(open(OPENMC_EXAMPLES_DIR / example).read()) | ||
|
||
openmc.reset_auto_ids() | ||
model = openmc.Model.from_xml() | ||
|
||
world = [500, 500, 500] | ||
to_cubit_journal(model.geometry, world=world, filename=example_name(example)) |