-
Notifications
You must be signed in to change notification settings - Fork 18
217 lines (189 loc) · 8.14 KB
/
basictest_win.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: basictest_win
on:
push:
pull_request:
jobs:
ncdevtool_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src
- name: Pip install packages for ncdevtool
run: pip install -r ./src/devel/reqs/requirements_devel.txt
- name: ncdevtool checks
run: ./src/devel/bin/ncdevtool check -n "fix""me"
build:
needs: [ ncdevtool_check ]
strategy:
matrix:
os: [windows-2019, windows-2022]
winexportall: [ "ON", "OFF" ]
name: ${{ matrix.os }}.winexportall=${{ matrix.winexportall }}
runs-on: ${{ matrix.os }}
#windows-latest is windows-2022 (Nov 2024)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Monolithic pip install of repo
shell: cmd
run: python3 -m pip install --config-settings=cmake.define.NCRYSTAL_WINEXPORTALL=${{ matrix.winexportall }} .\src\
- name: ncrystal-config summary
shell: cmd
run: ncrystal-config --summary
- name: tree ncrystalcoremonopkg
shell: cmd
run: |
tree /F /A C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\_ncrystal_core_monolithic
echo Tree done
- name: pip install extra deps
shell: cmd
run: |
python -mpip install -r .\src\devel\reqs\requirements_all_and_devel.txt
if %errorlevel% neq 0 exit /b %errorlevel%
python -c "import numpy; print('numpy imported ok')"
if %errorlevel% neq 0 exit /b %errorlevel%
python -c "import gemmi; print('gemmi imported ok')"
if %errorlevel% neq 0 exit /b %errorlevel%
python -c "import spglib; print('spglib imported ok')"
if %errorlevel% neq 0 exit /b %errorlevel%
python -c "import ase; print('ase imported ok')"
if %errorlevel% neq 0 exit /b %errorlevel%
python -c "import mpmath; print('mpmath imported ok')"
if %errorlevel% neq 0 exit /b %errorlevel%
python -c "import matplotlib.pyplot; print('matplotlib imported ok')"
if %errorlevel% neq 0 exit /b %errorlevel%
- name: Various commandline tests
shell: cmd
run: |
ncrystal-config --summary
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal-config --help
if %errorlevel% neq 0 exit /b %errorlevel%
python3 -c "import NCrystal; NCrystal.test()"
if %errorlevel% neq 0 exit /b %errorlevel%
python3 -c "import NCrystal as n; mat=n.load('Al_sg225.ncmat;temp=350K'); mat.dump()"
if %errorlevel% neq 0 exit /b %errorlevel%
nctool --test
if %errorlevel% neq 0 exit /b %errorlevel%
nctool --dump Al_sg225.ncmat
if %errorlevel% neq 0 exit /b %errorlevel%
python3 -mNCrystal nctool --test
if %errorlevel% neq 0 exit /b %errorlevel%
python3 ./src/examples/ncrystal_example_py
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_vdos2ncmat --help
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_cif2ncmat --help
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_ncmat2cpp --help
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_hfg2ncmat --help
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_verifyatompos --help
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_cif2ncmat codid::9008460
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_ncmat2hkl --help
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_ncmat2hkl --format=laz "Al_sg225.ncmat;temp=250K;dcutoff=0.75" -o test_Al.laz
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_ncmat2hkl --format=lau "Al_sg225.ncmat;temp=250K;dcutoff=0.75" -o test_Al.lau
if %errorlevel% neq 0 exit /b %errorlevel%
nctool -d ./test_Al.laz
if %errorlevel% neq 0 exit /b %errorlevel%
nctool -d ./test_Al.lau
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal_ncmat2cpp stdlib::Al_sg225.ncmat -o test.cpp
if %errorlevel% neq 0 exit /b %errorlevel%
cat test.cpp
if %errorlevel% neq 0 exit /b %errorlevel%
nctool --pdf Al_sg225.ncmat
if %errorlevel% neq 0 exit /b %errorlevel%
#Two ways of enabling cl.exe and other tools. One is via an external action...:
- name: Setup VS in shell
uses: ilammy/msvc-dev-cmd@v1
#...but a simpler one might be to simply invoke the correct vcvars64.bat
#file first, like...:
#
# - name: whatever
# shell: cmd
# run: |
# call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
# cl /help
#
#...but since we also want to support VS 2019, we use the above action for now
- name: Test downstream compilation and build flags
shell: cmd
run: |
echo "Set BUILDFLAGS variable via ncrystal-config --show buildflags"
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal-config --show buildflags > buildflags.txt
if %errorlevel% neq 0 exit /b %errorlevel%
set /p BUILDFLAGS=<buildflags.txt
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Got:" %BUILDFLAGS%
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Copying C and C++ examples"
if %errorlevel% neq 0 exit /b %errorlevel%
copy .\src\examples\ncrystal_example_cpp.cc my_cpp_code.cpp
if %errorlevel% neq 0 exit /b %errorlevel%
copy .\src\examples\ncrystal_example_c.c my_c_code.c
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Compiling C code"
cl my_c_code.c %BUILDFLAGS%
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C code succeeded"
echo "Compiling C++ code"
cl my_cpp_code.cpp %BUILDFLAGS% /EHsc
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C++ code succeeded"
echo "Set NCSHLIBDIR variable via ncrystal-config --show shlibdir"
if %errorlevel% neq 0 exit /b %errorlevel%
ncrystal-config --show shlibdir > ncshlibdir.txt
if %errorlevel% neq 0 exit /b %errorlevel%
set /p NCSHLIBDIR=<ncshlibdir.txt
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Got:" NCSHLIBDIR
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Running C app"
my_c_code.exe
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Running C++ app"
my_cpp_code.exe
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Compiling C code again (c11)"
cl my_c_code.c %BUILDFLAGS% /std:c11
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C code succeeded"
echo "Compiling C code again (c17)"
cl my_c_code.c %BUILDFLAGS% /std:c17
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C code succeeded"
echo "Compiling C code again (clatest)"
cl my_c_code.c %BUILDFLAGS% /std:c17
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C code succeeded"
echo "Compiling C++ code again (c++14)"
cl my_cpp_code.cpp %BUILDFLAGS% /std:c++14 /EHsc
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C++ code succeeded"
echo "Compiling C++ code again (c++17)"
cl my_cpp_code.cpp %BUILDFLAGS% /std:c++17 /EHsc
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C++ code succeeded"
echo "Compiling C++ code again (c++20)"
cl my_cpp_code.cpp %BUILDFLAGS% /std:c++20 /EHsc
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C++ code succeeded"
echo "Compiling C++ code again (c++latest)"
cl my_cpp_code.cpp %BUILDFLAGS% /std:c++20 /EHsc
if %errorlevel% neq 0 exit /b %errorlevel%
echo "Custom compilation of downstream C++ code succeeded"