-
Notifications
You must be signed in to change notification settings - Fork 12
175 lines (145 loc) · 5.09 KB
/
gmy-tool.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
name: Geometry tool
on:
push:
branches:
- main
paths:
- '.github/workflows/gmy-*'
- 'geometry-tool/**'
- Code/util/Vector3D.cc
- Code/geometry/SiteDataBare.cc
- Code/lb/lattices/D3Q27.cc
- Code/io/formats/geometry.cc
- Code/io/writers/xdr/XdrFileWriter.cc
- Code/io/writers/xdr/XdrMemWriter.cc
- Code/io/writers/xdr/XdrWriter.cc
- Code/io/writers/Writer.cc
pull_request:
schedule:
# Run every Monday 0700 UTC
- cron: '0 7 * * 1'
jobs:
lint-python:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run black to check Python formatting
working-directory: geometry-tool
run: pip install black~=22.0 && black --check .
lint-cpp:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run clang-format
working-directory: geometry-tool/HlbGmyTool/Model/Generation
run: ${{ github.workspace }}/.github/workflows/run-clang-format.py --style file -r .
gmy-tool:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
env:
VMTK_VERSION: 1.5.0
VMTK_DIR: /opt/vmtk
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: APT packages
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libboost-dev \
libcgal-dev \
ninja-build \
libopengl0 libglx0 libxt6
- name: pip cache
uses: actions/cache@v3
env:
# Increase this value to reset cache
CACHE_NUMBER: 0
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('geometry-tool/pyproject.toml', 'geometry-tool/setup.py') }}
- name: ensure pip is up-to-date
run: pip install --upgrade pip
- name: Get and install VMTK from our builder
run: |
wget -nv -O vmtk.tar.gz https://github.com/hemelb-codes/vmtk-build/releases/download/v${VMTK_VERSION}/all-${VMTK_VERSION}-ubuntu-py${{ matrix.python-version }}.tar.gz
mkdir -p $VMTK_DIR
tar -xzf vmtk.tar.gz -C $VMTK_DIR
echo "PATH=$VMTK_DIR/bin:$PATH" >> $GITHUB_ENV
echo "PYTHONPATH=$VMTK_DIR/lib/python${{ matrix.python-version }}/site-packages:$PYTHONPATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$VMTK_DIR:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
- name: Check setuptools sees VMTK
run: |
pip list
pip list --format json | jq -e '.[] | select(.name == "vmtk")'
- name: Store VMTK dir on error
if: failure()
uses: actions/upload-artifact@v3
with:
name: failed-vmtk-tree
path: ${{ env.VMTK_DIR }}
- name: Build and install the app
working-directory: geometry-tool
run: pip install .
- name: Store build tree on error
if: failure()
uses: actions/upload-artifact@v3
with:
name: failed-build-tree
path: geometry-tool/_skbuild
- name: Install test dependencies
working-directory: python-tools
run: pip install pytest 'cython~=0.29' && python setup.py install
- name: Run the tests
working-directory: geometry-tool/tests
run: py.test
- name: Tar failed install
if: failure()
run: tar -czf fail-${{ matrix.python-version }}.tar.gz $pythonLocation
- name: Store failed install
if: failure()
uses: actions/upload-artifact@v3
with:
name: failed-python-${{ matrix.python-version }}
path: fail-${{ matrix.python-version }}.tar.gz
- name: Get hemelb-tests repo
uses: ./.github/actions/get-tests-repo
with:
path: hemelb-tests
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Smoketest the update tool
working-directory: hemelb-tests/diffTest
run: hlb-config2gmy cyl.pro tmp.pr2
- name: Decompress input mesh
working-directory: hemelb-tests/diffTest
run: gunzip cyl.stl.gz
- name: Run the gmy tool without GUI
working-directory: hemelb-tests/diffTest
run: |
mkdir test
hlb-gmy-cli --xml test/config.xml --geometry test/config.gmy cyl.pr2
- name: Run the self-consistency checker
working-directory: hemelb-tests/diffTest/test
run: hlb-gmy-selfconsistent config.xml
- name: Count the sites
working-directory: hemelb-tests/diffTest/test
run: "[[ $(hlb-gmy-countsites config.gmy) == 44250 ]]"
- name: Compare XML
working-directory: hemelb-tests/diffTest
run: python compare_xml.py config.xml test/config.xml
- name: Compare GMY
working-directory: hemelb-tests/diffTest
run: python compare_gmy.py config.gmy test/config.gmy