-
Notifications
You must be signed in to change notification settings - Fork 18
204 lines (185 loc) · 7.82 KB
/
basictest_ubuntulatestclang.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
name: basictest_ubuntulatestclang
on:
push:
pull_request:
schedule:
- cron: '30 18 * * 0' # 18:30 every Sunday
workflow_dispatch:
inputs:
manual-debugging:
type: boolean
description: Launch manual debugging tmate session on failure
default: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
matrix:
include:
#Note: Python 3.13 works (Aug 2024) because of the
#"allow-prereleases: true" below.
# - { os: ubuntu-20.04, CC: gcc-10, CXX: g++-10, python: '3.8' }
#TMP- { os: ubuntu-22.04, CC: gcc, CXX: g++, python: '3.9' }
#TMP- { os: ubuntu-latest, CC: gcc, CXX: g++, python: '3.10' }
- { os: ubuntu-latest, CC: clang, CXX: clang++, python: '3.12' }
# - { os: ubuntu-latest, CC: gcc-12, CXX: g++-12, python: '3.12' }
#TMP- { os: ubuntu-latest, CC: gcc, CXX: g++, python: '3.13' }
# - { os: macos-latest, CC: clang, CXX: clang++, python: "3.12" }
# - { os: macos-12, CC: clang, CXX: clang++, python: "3.10" }
#TMP- { os: macos-13, CC: clang, CXX: clang++, python: "3.11" }
name: ${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
# SHELL: /bin/bash
#name: Ubuntu with Python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true #Needed (Aug 2024) for Python 3.13.
- name: Pip install
run: |
set -eux
python3 -m pip install numpy gemmi spglib ase mpmath matplotlib
#python3 -m pip install pymatgen
- name: Check versions
run: |
set -eux
which python3
python3 --version
which cmake
cmake --version
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake
-S ${{github.workspace}}/src
-B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
-DNCRYSTAL_ENABLE_EXAMPLES=ON
-DNCRYSTAL_BUILD_STRICT=ON
-DNCRYSTAL_ENABLE_SETUPSH=ON
-DNCRYSTAL_ENABLE_TESTING=ON
- name: Build
run: >
cmake
--build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}}
- name: CTest
run: ( cd ${{github.workspace}}/build && ctest --output-on-failure --test-output-size-failed 100000 --test-output-truncation middle )
- name: Install
run: cmake --install ${{github.workspace}}/build
- name: Look around
run: ls -l ${{github.workspace}}
- name: Tests without environment setup
run: |
set -eux
${{github.workspace}}/install/bin/ncrystal-config --summary
${{github.workspace}}/install/bin/nctool --test
${{github.workspace}}/install/bin/ncrystal_example_c
${{github.workspace}}/install/bin/ncrystal_example_cpp
${{github.workspace}}/install/bin/nctool --dump 'Al_sg225.ncmat;dcutoff=1.5'
- name: Tests with eval ncrystal-config setup
run: |
set -eux
eval $(${{github.workspace}}/install/bin/ncrystal-config --setup)
ncrystal-config --summary
nctool --test
ncrystal-config --help
ncrystal_example_c
ncrystal_example_cpp
ncrystal_example_py
nctool --help
nctool --dump 'Al_sg225.ncmat;dcutoff=1.5'
python3 -c 'import NCrystal; NCrystal.test()'
ncrystal_vdos2ncmat --help
ncrystal_cif2ncmat --help
ncrystal_ncmat2cpp --help
ncrystal_hfg2ncmat --help
ncrystal_verifyatompos --help
ncrystal_cif2ncmat codid::9008460
ncrystal_ncmat2hkl --help
ncrystal_ncmat2hkl --format=laz 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.laz
ncrystal_ncmat2hkl --format=lau 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.lau
nctool -d ./test_Al.laz
nctool -d ./test_Al.lau
ncrystal_ncmat2cpp $(ncrystal-config --show=datadir)/Al_sg225.ncmat -o test.cpp
cat test.cpp
#NEEDS MATPLOTLIB: nctool --pdf Al_sg225.ncmat
#Examples from README:
cp ./src/examples/ncrystal_example_cpp.cc ./my_cpp_code.cpp
cp ./src/examples/ncrystal_example_c.c ./my_c_code.c
export LDFLAGS="${LDFLAGS:-} -Wl,-rpath,$(ncrystal-config --show libdir) $(ncrystal-config --show libpath)" &&
export CFLAGS="${CFLAGS:-} -I$(ncrystal-config --show includedir)" &&
export CXXFLAGS="${CXXFLAGS:-} -I$(ncrystal-config --show includedir)" &&
cc -std=c11 ${LDFLAGS} ${CFLAGS} my_c_code.c -o my_c_app &&
./my_c_app &&
c++ -std=c++17 ${LDFLAGS} ${CXXFLAGS} my_cpp_code.cpp -o my_cpp_app &&
./my_cpp_app &&
echo "Custom compilation of downstream C/C++ code succeeded"
eval $(ncrystal-config --unsetup)
- name: Tests with ncrystal_setup.sh
run: |
set -eux
. ${{github.workspace}}/install/ncrystal_setup.sh
ncrystal-config --summary
nctool --test
ncrystal_vdos2ncmat --help
ncrystal_cif2ncmat --help
ncrystal_ncmat2hkl --help
ncrystal_ncmat2hkl --format=laz 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test2_Al.laz
ncrystal_ncmat2hkl --format=lau 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test2_Al.lau
nctool -d ./test2_Al.laz
nctool -d ./test2_Al.lau
ncrystal_ncmat2cpp --help
ncrystal_hfg2ncmat --help
ncrystal_verifyatompos --help
ncrystal_example_c
ncrystal_example_cpp
ncrystal_example_py
python3 -m NCrystal.test
python3 -c 'import NCrystal; NCrystal.test()'
. ${{github.workspace}}/install/ncrystal_unsetup.sh
#TMP DISABLE - name: Checkout ncrystal-notebooks
#TMP DISABLE if: matrix.python != '3.7' && matrix.python != '3.8'
#TMP DISABLE uses: actions/checkout@v4
#TMP DISABLE with:
#TMP DISABLE repository: mctools/ncrystal-notebooks
#TMP DISABLE path: src_notebooks
#TMP DISABLE
#TMP DISABLE - name: Extra pip install for notebooks
#TMP DISABLE if: matrix.python != '3.7' && matrix.python != '3.8'
#TMP DISABLE run: |
#TMP DISABLE set -eu
#TMP DISABLE python3 -m pip install numpy matplotlib spglib ase gemmi jupyterlab ipympl
#TMP DISABLE
#TMP DISABLE - name: Test notebooks
#TMP DISABLE if: matrix.python != '3.7' && matrix.python != '3.8'
#TMP DISABLE run: |
#TMP DISABLE set -eu
#TMP DISABLE eval $(${{github.workspace}}/install/bin/ncrystal-config --setup)
#TMP DISABLE ./src_notebooks/.github/resources/run_notebooks.x
#Final step, so tmate step can check if we got this far.
- name: Final
id: final-step
run: echo "All steps fine"
- name: Setup tmate session for manual debugging
uses: mxschmitt/action-tmate@v3
if: always() && inputs.manual-debugging == true && (steps.final-step != 'success')
with:
limit-access-to-actor: true