diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5af0a6fe..3457396e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,5 +52,6 @@ jobs: - name: Test with pytest run: | + cosmosis --version mkdir tmp && cd tmp && pytest --pyargs cosmosis diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 027eef04..4c56d3d2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,12 +16,24 @@ jobs: uses: actions/setup-python@v2 - name: Build wheel and source tarball + id: build_tarball run: | python setup.py sdist - + version=$(head -1 cosmosis/version.py | cut -d "'" -f 2) + sha=$(shasum dist/cosmosis-${version}.tar.gz | awk '{print $1}') + echo "::set-output name=tarball-sha::${sha}" + echo "::set-output name=pypi-version::${version}" - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_COSMOSIS_UPLOAD }} + + - name: Make PR on cosmosis conda forge feedstock + uses: joezuntz/cosmosis-action@v0.1 + with: + token: ${{ secrets.PR_MAKER_TOKEN }} + which-repository: cosmosis + version: ${{ steps.build_tarball.outputs.pypi-version }} + hash: ${{ steps.build_tarball.outputs.tarball-sha }} diff --git a/cosmosis/main.py b/cosmosis/main.py index 1fbc3466..047af09a 100755 --- a/cosmosis/main.py +++ b/cosmosis/main.py @@ -15,6 +15,7 @@ from .samplers.sampler import Sampler, ParallelSampler, Hints from . import output as output_module from .runtime.handler import activate_segfault_handling +from .version import __version__ RUNTIME_INI_SECTION = "runtime" @@ -361,11 +362,12 @@ def main(): parser.add_argument("-v", "--variables", nargs="*", action=ParseExtraParameters, help="Override variables in values file, with format section.name1=value1 section.name2=value2...") parser.add_argument("--only", nargs="*", help="Fix all parameters except the ones listed") parser.add_argument("--graph", type=str, default='', help="Do not run a sampler; instead make a graphviz dot file of the pipeline") + parser.add_argument('--version', action='version', version=__version__, help="Print out a version number") args = parser.parse_args(sys.argv[1:]) if args.graph: make_graph(args.inifile, args.graph, args.params, args.variables) - return + return 0 demo_10_special (args) demo_20b_special (args) diff --git a/cosmosis/version.py b/cosmosis/version.py index ce0149a2..8e903eba 100644 --- a/cosmosis/version.py +++ b/cosmosis/version.py @@ -1 +1 @@ -__version__ = '0.5.17' +__version__ = '0.5.18'