-
Notifications
You must be signed in to change notification settings - Fork 3
190 lines (164 loc) · 5.65 KB
/
pythonpackage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
[push, pull_request]
concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
pytest:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest
run: |
pip install pytest
pytest
integrated-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
if: always()
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Integrated tests
run: |
pip install pytest xarray
cd integrated_tests/
./test_suite.py
examples:
runs-on: ubuntu-latest
timeout-minutes: 30
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install sympy
pip install -e .
- name: Examples
run: |
cd examples/tokamak
./tokamak_example.py --no-plot lsn
./tokamak_example.py --no-plot usn
./tokamak_example.py --no-plot cdn
./tokamak_example.py --no-plot ldn
./tokamak_example.py --no-plot udn
./tokamak_example.py --no-plot udn2
cd ../torpex-xpoint
hypnotoad-torpex --noplot torpex-coils.yaml
hypnotoad-torpex --noplot torpex-coils-nonorth.yaml
utilities:
# Check that various command line utilities provided by hypnotoad keep
# running without errors. Correctness of output is not tested!
runs-on: ubuntu-latest
timeout-minutes: 30
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install xbout
pip install -e .
- name: Utilities
run: |
cd integrated_tests/grid_files
hypnotoad-plot-equilibrium --no-show --output test-single-null.pdf test_single-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_single-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_connected-double-null.eqdsk
hypnotoad-plot-equilibrium --no-show --wall --separatrix --psi-labels --color-contours --highlight-region 0.99 1.01 --highlight-color blue test_disconnected-double-null.eqdsk
echo "psinorm_core: 0.99" > test.yml
echo "psinorm_sol: 1.01" >> test.yml
hypnotoad-get-flux-surfaces test_single-null.eqdsk test.yml
hypnotoad-get-flux-surfaces --output test1.nc --save-plot test.png test_single-null.eqdsk test.yml
hypnotoad-get-flux-surfaces --output test2.nc --save-plot test.pdf test_connected-double-null.eqdsk test.yml
# modify input file so that we actually detect the disconnection within the grid
echo "nx_inter_sep: 2" >> test.yml
hypnotoad-get-flux-surfaces --output test3.nc --save-plot test.pdf test_disconnected-double-null.eqdsk test.yml
cd ../connected_doublenull_orthogonal
hypnotoad-plot-grid-cells --no-show --save-as test.svg expected_orthogonal.grd.nc
hypnotoad-plot-grid-cells --no-show --mxg 3 --branch-cuts --separatrix --targets expected_orthogonal.grd.nc
hypnotoad-recreate-inputs -g test1.eqdsk expected_orthogonal.grd.nc
hypnotoad-recreate-inputs -g test2.eqdsk -y test.yml expected_orthogonal.grd.nc
flake8:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8
black:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check formatting with black
run: |
pip install black
black --check --diff --color .