Skip to content

Geometry tool

Geometry tool #374

Workflow file for this run

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:
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