Skip to content

Commit a36b321

Browse files
committed
Merge branch 'win-self-test-sandbox-1'
2 parents 777645e + c59e61f commit a36b321

File tree

4 files changed

+166
-4
lines changed

4 files changed

+166
-4
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: GSAS-II self-tests on Windows via gitstrap
2+
3+
on:
4+
workflow_dispatch: # Allows running this workflow manually
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches-ignore:
8+
- master
9+
# branches: ['main']
10+
# pull_request:
11+
# branches: ['main']
12+
13+
14+
jobs:
15+
test-GSAS-II:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.12", "3.13"]
20+
# python-version: ["3.11", "3.12", "3.13"]
21+
# python-version: ["3.13"]
22+
runs-on: 'windows-latest'
23+
steps:
24+
- uses: conda-incubator/setup-miniconda@v3
25+
with:
26+
auto-update-conda: true
27+
python-version: ${{ matrix.python-version }}
28+
- name: Conda install
29+
shell: bash -el {0}
30+
run: |
31+
# tailor the numpy version to match the GSAS-II binaries
32+
if [ "${{ matrix.python-version }}" == "3.13" ]; then
33+
npver="2.2 python-gil"
34+
elif [ "${{ matrix.python-version }}" == "3.12" ]; then
35+
npver=2.2
36+
elif [ "${{ matrix.python-version }}" == "3.11" ]; then
37+
npver=1.26
38+
fi
39+
conda install python=${{ matrix.python-version }} numpy=${npver} scipy requests pytest git gitpython pycifrw -c conda-forge --override-channels --quiet
40+
#conda info
41+
#conda list
42+
- name: GSAS-II install
43+
shell: bash -el {0}
44+
run: |
45+
curl -L -O https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/raw/main/install/gitstrap.py
46+
python gitstrap.py --nocheck --noshortcut --branch=main
47+
48+
- name: GSAS-II all tests
49+
shell: bash -el {0}
50+
run: |
51+
cd GSAS-II
52+
python -m pytest

.github/workflows/win_test.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: debug self-tests on Windows w/3.11
2+
3+
on:
4+
workflow_dispatch: # Allows running this workflow manually
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches-ignore:
8+
- master
9+
# branches: ['main']
10+
# pull_request:
11+
# branches: ['main']
12+
13+
14+
jobs:
15+
test-GSAS-II:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# python-version: ["3.11", "3.12", "3.13"]
20+
python-version: ["3.11"]
21+
# python-version: ["3.12"]
22+
runs-on: 'windows-latest'
23+
steps:
24+
- uses: conda-incubator/setup-miniconda@v3
25+
with:
26+
auto-update-conda: true
27+
python-version: ${{ matrix.python-version }}
28+
- name: Conda install
29+
shell: bash -el {0}
30+
run: |
31+
# tailor the numpy version to match the GSAS-II binaries
32+
if [ "${{ matrix.python-version }}" == "3.13" ]; then
33+
npver="2.2 python-gil"
34+
elif [ "${{ matrix.python-version }}" == "3.12" ]; then
35+
npver=2.2
36+
elif [ "${{ matrix.python-version }}" == "3.11" ]; then
37+
npver=1.26
38+
fi
39+
#conda list
40+
#conda info
41+
conda install python=${{ matrix.python-version }} numpy=${npver} scipy requests pytest git gitpython pycifrw -c conda-forge --override-channels --quiet
42+
#conda install --quiet numpy=${npver} requests pytest briantoby::gsas2pkg -c conda-forge
43+
conda info
44+
conda list
45+
- name: GSAS-II install
46+
shell: bash -el {0}
47+
run: |
48+
#mkdir G2
49+
#cd G2
50+
curl -L -O https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/raw/main/install/gitstrap.py
51+
python gitstrap.py --nocheck --noshortcut --branch=main
52+
53+
- name: find files
54+
shell: bash -el {0}
55+
run: |
56+
ls -l GSAS-II/GSASII-bin/win_64_p3.11_n1.26
57+
#ls -l GSAS-II/GSASII-bin/win_64_p3.12_n2.2
58+
ls -l GSAS-II/tests
59+
60+
- name: GSAS-II single test
61+
if: always()
62+
shell: bash -el {0}
63+
run: |
64+
cd GSAS-II
65+
python tests/test_elm.py
66+
python tests/test_spg.py
67+
68+
# - name: GSAS-II all tests
69+
# if: always()
70+
# shell: bash -el {0}
71+
# run: |
72+
# cd GSAS-II
73+
# ls
74+
# python -m pytest
75+
76+
- name: try pyspg
77+
if: always()
78+
shell: bash -el {0}
79+
run: |
80+
cd GSAS-II/GSASII-bin/win_64_p3.11_n1.26
81+
#cd GSAS-II/GSASII-bin/win_64_p3.12_n2.2
82+
python -VV
83+
#python -v -c "import sys; print(sys.path)"
84+
python -c "import pyspg"
85+
86+
- name: try ldd
87+
if: always()
88+
shell: bash -el {0}
89+
run: |
90+
#conda create -n ntldd python=3.12 numpy=2.2 m2w64-ntldd-git
91+
conda create -n ntldd python=3.11 numpy=1.26 m2w64-ntldd-git
92+
conda activate ntldd
93+
cd GSAS-II/GSASII-bin/win_64_p3.11_n1.26
94+
#cd GSAS-II/GSASII-bin/win_64_p3.12_n2.2
95+
ls
96+
ntldd *.pyd
97+
python -c "import pyspg"

GSASII/GSASIIscriptable.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ def SetPrintLevel(level):
7777
if mode in level.lower():
7878
printLevel = mode
7979
return
80+
def SetDebugMode(mode):
81+
'''Set the debug configuration mode on (mode=True) or off (mode=False).
82+
This will provide some additional output that may help with
83+
tracking down problems in the code.
84+
'''
85+
GSASIIpath.SetConfigValue({'debug':bool(mode)})
8086

8187
def installScriptingShortcut():
8288
'''Creates a file named G2script in the current Python site-packages directory.
@@ -429,7 +435,7 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,
429435
elif flag:
430436
primaryReaders.append(reader)
431437
if not secondaryReaders and not primaryReaders:
432-
raise G2ImportException("Could not read file: ", filename)
438+
raise G2ImportException(f"Could not read file: {filename}")
433439

434440
with open(filename, 'r'):
435441
rd_list = []
@@ -486,7 +492,7 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,
486492
G2fil.G2Print("{} block # {} read by Reader {}"
487493
.format(filename,bank,rd.formatName))
488494
return rd_list
489-
raise G2ImportException("No reader could read file: " + filename)
495+
raise G2ImportException(f"No reader could read file: {filename}")
490496

491497

492498
def load_iprms(instfile, reader, bank=None):
@@ -533,8 +539,7 @@ def load_iprms(instfile, reader, bank=None):
533539
elif ibanks == 1:
534540
reader.instbank = 1
535541
else:
536-
raise G2ImportException("Instrument parameter file has {} banks, select one with instbank param."
537-
.format(ibanks))
542+
raise G2ImportException(f"Instrument parameter file has {ibanks} banks, select one with instbank param.")
538543
reader.powderentry[2] = 1
539544
reader.instfile = instfile
540545
reader.instmsg = '{} bank {}'.format(instfile,reader.instbank)

GSASII/inputs/BinariesCache.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
linux_64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_64_p3.11_n1.26.tgz
2+
linux_64_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_64_p3.12_n2.2.tgz
3+
linux_64_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_64_p3.13_n2.2.tgz
24
linux_arm32_p3.11_n1.24 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_arm32_p3.11_n1.24.tgz
35
linux_arm64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/linux_arm64_p3.11_n1.26.tgz
46
mac_64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_64_p3.11_n1.26.tgz
7+
mac_64_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_64_p3.12_n2.2.tgz
8+
mac_64_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_64_p3.13_n2.2.tgz
59
mac_arm_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.11_n1.26.tgz
10+
mac_arm_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.12_n2.2.tgz
11+
mac_arm_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/mac_arm_p3.13_n2.2.tgz
612
win_64_p3.11_n1.26 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/win_64_p3.11_n1.26.tgz
13+
win_64_p3.12_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/win_64_p3.12_n2.2.tgz
14+
win_64_p3.13_n2.2 : https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/win_64_p3.13_n2.2.tgz

0 commit comments

Comments
 (0)