Skip to content

Commit 9afc18d

Browse files
authored
Merge pull request #96 from neutrons/conda_pkg
Conda package and workflow actions
2 parents 2caea44 + c6c7dc4 commit 9afc18d

File tree

5 files changed

+108
-5
lines changed

5 files changed

+108
-5
lines changed

.github/workflows/actions.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,47 @@ jobs:
2929
- name: Upload coverage reports to Codecov
3030
uses: codecov/codecov-action@v3
3131

32+
conda-build:
33+
runs-on: ubuntu-latest
34+
defaults:
35+
run:
36+
shell: bash -l {0}
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: conda-incubator/setup-miniconda@v2
40+
with:
41+
auto-update-conda: true
42+
mamba-version: "*"
43+
environment-file: environment.yml
44+
- name: Build python wheel
45+
run: |
46+
python -m build --wheel --no-isolation
47+
check-wheel-contents dist/shiver-*.whl
48+
- name: Build conda library
49+
shell: bash -l {0}
50+
run: |
51+
# set up environment
52+
cd conda.recipe
53+
echo "versioningit $(versioningit ../)"
54+
# build the package
55+
VERSION=$(versioningit ../) conda mambabuild --output-folder . .
56+
conda verify noarch/shiver*.tar.bz2
57+
- name: Deploy to Anaconda
58+
shell: bash -l {0}
59+
if: startsWith(github.ref, 'refs/tags/v')
60+
env:
61+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
62+
IS_RC: ${{ contains(github.ref, 'rc') }}
63+
run: |
64+
# label is main or rc depending on the tag-name
65+
CONDA_LABEL="main"
66+
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
67+
echo pushing ${{ github.ref }} with label $CONDA_LABEL
68+
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/shiver*.tar.bz2
69+
3270
trigger-deploy:
3371
runs-on: ubuntu-22.04
34-
needs: [tests]
72+
needs: [tests, conda-build]
3573
# only trigger deploys from protected branches and tags
3674
if: ${{ github.ref_protected || github.ref_type == 'tag' }}
3775
steps:

conda.recipe/meta.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# load information from setup.cfg/setup.py
2+
{% set data = load_setup_py_data() %}
3+
{% set license = data.get('license') %}
4+
{% set description = data.get('description') %}
5+
{% set url = data.get('url') %}
6+
# this will get the version set by environment variable
7+
{% set version = environ.get('VERSION') %}
8+
{% set version_number = environ.get('GIT_DESCRIBE_NUMBER', '0') | string %}
9+
10+
11+
package:
12+
name: shiver
13+
version: {{ version_number }}
14+
15+
source:
16+
path: ..
17+
18+
build:
19+
noarch: python
20+
linux-64: python
21+
number: {{ version_number }}
22+
string: py{{py}}
23+
script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv
24+
25+
requirements:
26+
host:
27+
- python
28+
- versioningit
29+
30+
build:
31+
- setuptools
32+
- versioningit
33+
34+
run:
35+
- mantidworkbench
36+
37+
about:
38+
home: {{ url }}
39+
license: {{ license }}
40+
license_family: GPL
41+
license_file: ../LICENSE
42+
summary: {{ description }}

environment.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@ channels:
33
- conda-forge
44
- mantid/label/nightly
55
dependencies:
6+
- boa
7+
- conda-build
8+
- conda-verify
69
- mantidworkbench
710
- pre-commit
811
- versioningit
912
- pylint=2.17.3
1013
- pytest=7.2.1
1114
- pytest-qt=4.2.0
1215
- pytest-cov=4.0.0
16+
- setuptools
1317
- sphinx
18+
- python-build
1419
- pip
1520
- pip:
16-
- https://oncat.ornl.gov/packages/pyoncat-1.4.1-py3-none-any.whl
21+
- https://oncat.ornl.gov/packages/pyoncat-1.6.1-py2.py3-none-any.whl
1722
- sphinx-rtd-theme
23+
- check-wheel-contents

pyproject.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ dynamic = ["version"]
55
requires-python = ">=3.8"
66
dependencies = [
77
"mantidworkbench >= 6.6.20230517",
8-
"pyoncat == 1.4.1"
8+
"pyoncat == 1.6.1"
99
]
1010

11+
[project.urls]
12+
"Homepage" = "https://github.com/neutrons/Shiver/"
13+
1114
[build-system]
1215
requires = [
13-
"setuptools >= 42",
14-
"versioningit"
16+
"setuptools",
17+
"wheel",
18+
"toml",
19+
"versioningit"
1520
]
1621
build-backend = "setuptools.build_meta"
1722

@@ -24,6 +29,10 @@ file = "src/shiver/_version.py"
2429

2530
[tool.setuptools.packages.find]
2631
where = ["src"]
32+
exclude = ["tests*", "DGS_SC_scripts*"]
33+
34+
[tool.setuptools.package-data]
35+
"*" = ["*.yml","*.yaml","*.ini"]
2736

2837
[project.gui-scripts]
2938
shiver = "shiver:main"

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
This file is necessary so conda can read the contents of setup.cfg using
3+
its load_setup_py_data function
4+
"""
5+
from setuptools import setup
6+
from versioningit import get_cmdclasses
7+
8+
setup(cmdclass=get_cmdclasses())

0 commit comments

Comments
 (0)