diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 850821aa..2ec8436d 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -29,6 +29,33 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 + conda-build: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v3 + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + mamba-version: "*" + environment-file: environment.yml + - name: Build python wheel + run: | + conda activate shiver + python -m build --wheel --no-isolation + check-wheel-contents dist/shiver-*.whl + - name: Build conda library + shell: bash -l {0} + run: | + # set up environment + cd conda.recipe + echo "versioningit $(versioningit ../)" + # build the package + VERSION=$(versioningit ../) conda mambabuild --output-folder . . + conda verify noarch/shiver*.tar.bz2 + trigger-deploy: runs-on: ubuntu-22.04 needs: [tests] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 90dc8484..8d213471 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -exclude: "DGS_SC_scripts/.*|.*\\.mat$" +exclude: "setup.*|DGS_SC_scripts/.*|.*\\.mat$" ci: skip: [pylint] diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml new file mode 100644 index 00000000..e46ebf8b --- /dev/null +++ b/conda.recipe/meta.yaml @@ -0,0 +1,45 @@ +# load information from setup.cfg/setup.py +{% set data = load_setup_py_data() %} +{% set license = data.get('license') %} +{% set description = data.get('description') %} +{% set url = data.get('url') %} +# this will get the version set by environment variable +{% set version = environ.get('VERSION') %} +{% set version_number = environ.get('GIT_DESCRIBE_NUMBER', '0') | string %} + + +package: + name: shiver + version: {{ version_number }} + +source: + path: .. + +build: + noarch: python + linux-64: python + number: {{ version_number }} + string: py{{py}} + script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv + +requirements: + host: + - python + - versioningit + + build: + - setuptools + - versioningit + - mantidworkbench + - qtpy + - pytest + + run: + - mantidworkbench + +about: + home: {{ url }} + license: {{ license }} + license_family: GPL + license_file: ../LICENSE + summary: {{ description }} diff --git a/environment.yml b/environment.yml index 80a479a6..65f40d6f 100644 --- a/environment.yml +++ b/environment.yml @@ -3,6 +3,8 @@ channels: - conda-forge - mantid/label/nightly dependencies: + - boa + - conda-build - mantidworkbench - pre-commit - versioningit @@ -10,6 +12,9 @@ dependencies: - pytest=7.2.1 - pytest-qt=4.2.0 - pytest-cov=4.0.0 + - python-build - pip - pip: + - check-wheel-contents + - setuptools==47.0.0 - https://oncat.ornl.gov/packages/pyoncat-1.4.1-py3-none-any.whl diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..4875c611 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,75 @@ +[metadata] +name = shiver +version = 0.0.1 +distance = 0 +description = Spectroscopy Histogram Visualizer for Event Reduction +long_description = file: README.md, LICENSE +long_description_content_type = text/markdown +url = https://github.com/neutrons/Shiver/ +license = GPL3.0 + +[options] +package_dir = + =src +include_package_data = True +packages = find: +python_requires >= 3.8 +install_requires = + mantidworkbench + pyoncat == 1.4.1 + qtpy +tests_require = + pylint + flake8 + black + mypy + pytest + mock + +[options.entry_points] +console_scripts = + shiver = shiver.__init__:main + +[options.packages.find] +where = + src +exclude = + tests* + DGS_SC_scripts* + +[options.package_data] +* = + *.txt + *.yml + *.yaml + *.ini + +[options.extras_require] +dev = + versioningit +tests = pytest + +[flake8] +max-line-length = 120 +ignore = E203, W503 +exclude = conda.recipe/meta.yml + +[versioning] +source-version-file = shiver/_version.py +version-pattern = {tag} +commit-message-pattern = {raw} +tag-message-pattern = {raw} + +[coverage:run] +source = src/shiver +omit = + */tests/* + conda.recipe/* + docs/* + DGS_SC_scripts/* + +[coverage:report] + # temp set low until project is more developed, default 60 +fail_under = 1 +exclude_lines = + if __name__ == "__main__": diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..789e35d1 --- /dev/null +++ b/setup.py @@ -0,0 +1,6 @@ +# this file is necessary so conda can read the contents of setup.cfg using +# its load_setup_py_data function +from setuptools import setup +from versioningit import get_cmdclasses + +setup(cmdclass=get_cmdclasses())