Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Oct 28, 2023
0 parents commit bb8e5a6
Show file tree
Hide file tree
Showing 77 changed files with 2,198 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on: [push, pull_request]

env:
APT_INSTALL: sudo apt install -y --no-install-recommends


jobs:
jammy_test:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- run: make install_deps_apt
- run: make install
- run: make test

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
75 changes: 75 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
PROJECT_NAME=hiearch

APT_INSTALL=sudo apt install -y --no-install-recommends
# DEB_PYTHON_INSTALL_LAYOUT fixes UNKNOWN -> https://github.com/pypa/setuptools/issues/3269
export DEB_PYTHON_INSTALL_LAYOUT=deb_system
export PYTHONDONTWRITEBYTECODE=1

CURRENT_DIR=$(shell pwd)
BUILD_DIR?=${CURRENT_DIR}/build
TEST_DIR?=${CURRENT_DIR}/test
TEST_NOT=
FORMAT=svg

.DEFAULT:
@echo "Testing $@..."
cd ${TEST_DIR}/$@/; ${TEST_NOT} hiearch -f ${FORMAT} -o ${BUILD_DIR}/$@ *.yaml
mkdir -p ${BUILD_DIR}/$@
cp ${TEST_DIR}/$@/icon*.svg ${BUILD_DIR}/$@/ || true
# TODO awkward and fragile
find ${BUILD_DIR}/$@/ -iname '*.gv' | sort | xargs --no-run-if-empty -I {} sh -c "sort {} | md5sum > ${BUILD_DIR}/$@/checksum.build"
find ${TEST_DIR}/$@/ -iname '*.gv' | sort | xargs --no-run-if-empty -I {} sh -c "sort {} | md5sum > ${BUILD_DIR}/$@/checksum.test"
${TEST_NOT} cmp ${BUILD_DIR}/$@/checksum.build ${BUILD_DIR}/$@/checksum.test

venv: builddir
python3 -m venv ${BUILD_DIR}/venv

venv_test: venv
/bin/sh -c ". ${BUILD_DIR}/venv/bin/activate && ${MAKE} reinstall && ${MAKE} test"

test:
@${MAKE} \
01_basic 02_default_view 03_default_view_split 06_multiscope \
07_trivial 08_node_realations 09_tags 10_minimal \
11_neighbors 12_view_style 13_edge_labels 14_edge_style \
15_formatted_labels || (echo "Failure!" && false)
@${MAKE} TEST_NOT=! 04_node_cycle 05_style_cycle || (echo "Failure!" && false)
@echo "Success!"

clean:
rm -Rf .pytest_cache
rm -Rf ${BUILD_DIR}
find ./ -name "__pycache__" | xargs rm -Rf

builddir:
mkdir -p ${BUILD_DIR}

install:
pip install --no-cache-dir ./
#${MAKE} clean

install_edit:
pip install --editable ./
${MAKE} clean

install_deps: builddir
pip-compile --verbose --output-file ./${BUILD_DIR}/requirements.txt pyproject.toml
pip3 install -r ./${BUILD_DIR}/requirements.txt

uninstall: clean
pip uninstall -y ${PROJECT_NAME}

reinstall:
${MAKE} uninstall
${MAKE} install

spell:
hunspell README.md

install_deps_apt:
${APT_INSTALL} graphviz


.PHONY: test

# https://packaging.python.org/en/latest/tutorials/packaging-projects/
Loading

0 comments on commit bb8e5a6

Please sign in to comment.