-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from fusion-energy/examples_with_ga
Added new workflow to test examples
- Loading branch information
Showing
6 changed files
with
74 additions
and
56 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
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,42 @@ | ||
name: Test demos | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/fusion-energy/paramak:dependencies | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup paramak | ||
run: | | ||
python3 setup.py develop | ||
- name: Run the notebooks shapes | ||
run: | | ||
python3 tests/test_example_shapes.py | ||
- name: Run the notebooks components | ||
run: | | ||
python3 tests/test_example_components.py | ||
- name: Run the notebooks reactors | ||
run: | | ||
python3 tests/test_example_reactors.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
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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
|
||
import os | ||
import sys | ||
import unittest | ||
from pathlib import Path | ||
|
||
from .notebook_testing import notebook_run | ||
from notebook_testing import notebook_run | ||
|
||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'examples')) | ||
|
||
|
||
class TestExampleComponents(unittest.TestCase): | ||
|
||
def test_jupyter_notebooks_example_parametric_components(self): | ||
for notebook in Path().rglob("examples/example_parametric_components/*.ipynb"): | ||
print(notebook) | ||
errors = notebook_run(notebook) | ||
assert errors == [] | ||
def main(): | ||
for notebook in Path().rglob("examples/example_parametric_components/*.ipynb"): | ||
print(notebook) | ||
errors = notebook_run(notebook) | ||
assert errors == [] | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
main() |
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 |
---|---|---|
@@ -1,34 +1,31 @@ | ||
|
||
import os | ||
import sys | ||
import unittest | ||
from pathlib import Path | ||
import time | ||
from .notebook_testing import notebook_run | ||
from notebook_testing import notebook_run | ||
|
||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'examples')) | ||
|
||
|
||
class TestExampleReactors(unittest.TestCase): | ||
def main(): | ||
timings = [] | ||
for notebook in Path().rglob("examples/example_parametric_reactors/*.ipynb"): | ||
start = time.time() | ||
|
||
def test_jupyter_notebooks_example_parametric_reactors(self): | ||
timings = [] | ||
for notebook in Path().rglob("examples/example_parametric_reactors/*.ipynb"): | ||
start = time.time() | ||
print(notebook) | ||
errors = notebook_run(notebook) | ||
assert errors == [] | ||
|
||
print(notebook) | ||
errors = notebook_run(notebook) | ||
assert errors == [] | ||
stop = time.time() | ||
duration = stop - start | ||
|
||
stop = time.time() | ||
duration = stop - start | ||
print((notebook, duration)) | ||
timings.append((notebook, duration)) | ||
|
||
print((notebook, duration)) | ||
timings.append((notebook, duration)) | ||
|
||
# to see timings run with pytest --capture=tee-sys | ||
print(timings) | ||
# to see timings run with pytest --capture=tee-sys | ||
print(timings) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
main() |
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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
|
||
import os | ||
import sys | ||
import unittest | ||
from pathlib import Path | ||
|
||
from .notebook_testing import notebook_run | ||
from notebook_testing import notebook_run | ||
|
||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'examples')) | ||
|
||
|
||
class TestExampleShapes(unittest.TestCase): | ||
|
||
def test_jupyter_notebooks_example_parametric_shapes(self): | ||
for notebook in Path().rglob("examples/example_parametric_shapes/*.ipynb"): | ||
print(notebook) | ||
errors = notebook_run(notebook) | ||
assert errors == [] | ||
def main(): | ||
for notebook in Path().rglob("examples/example_parametric_shapes/*.ipynb"): | ||
print(notebook) | ||
errors = notebook_run(notebook) | ||
assert errors == [] | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
main() |