Try to fix VS 2019 compilation #210
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
name: basictest_win | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019, windows-2022] | |
#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 | |
#NB: We don't test matplotlib import here in the next step, since we want | |
#to make sure that our CTest infrastructure correctly avoids problems from | |
#"building font cache" printouts on first imports. | |
- name: pip install extra deps | |
shell: cmd | |
run: | | |
python -mpip install numpy matplotlib gemmi spglib ase mpmath | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python -c "import numpy; print('numpy imported ok')" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python -c "import gemmi; print('gemmi imported ok')" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python -c "import spglib; print('spglib imported ok')" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python -c "import ase; print('ase imported ok')" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python -c "import mpmath; print('mpmath imported ok')" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
- name: Monolithic pip install of repo | |
shell: cmd | |
run: python3 -m pip install .\src\ | |
- name: Various commandline tests | |
shell: cmd | |
run: | | |
ncrystal-config --summary | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal-config --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python3 -c "import NCrystal; NCrystal.test()" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python3 -c "import NCrystal as n; mat=n.load('Al_sg225.ncmat;temp=350K'); mat.dump()" | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
nctool --test | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
nctool --dump Al_sg225.ncmat | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python3 -mNCrystal nctool --test | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
python3 ./src/examples/ncrystal_example_py | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_vdos2ncmat --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_cif2ncmat --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_ncmat2cpp --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_hfg2ncmat --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_verifyatompos --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_cif2ncmat codid::9008460 | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_ncmat2hkl --help | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_ncmat2hkl --format=laz 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.laz | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_ncmat2hkl --format=lau 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.lau | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
nctool -d ./test_Al.laz | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
nctool -d ./test_Al.lau | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
ncrystal_ncmat2cpp $(ncrystal-config --show datadir)/Al_sg225.ncmat -o test.cpp | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
cat test.cpp | |
if %errorlevel% neq 0 then exit /b %errorlevel% | |
nctool --pdf Al_sg225.ncmat | |
if %errorlevel% neq 0 then 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: Use cl.exe | |
shell: cmd | |
run: | | |
cl /help |