Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda install #378

Merged
merged 7 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 99 additions & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ on:
branches:
- master
jobs:
git-tag-and-release:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.step1.outputs.v }}
steps:
- uses: actions/checkout@v4
- name: Get version number
run: |
VERSION="$(grep ':Version:' README.rst | awk '{print $2}')"
echo "DIST_VERSION=v${VERSION}" >> $GITHUB_ENV
id: step1
run: echo "v=$(grep ':Version:' README.rst | awk '{print $2}')" >> $GITHUB_OUTPUT

git-tag-and-release:
runs-on: ubuntu-latest
needs: get-version
steps:
- uses: actions/checkout@v4
- name: set version number
run: echo "DIST_VERSION=v${{ needs.get-version.outputs.version }}" >> $GITHUB_ENV
- name: Create Tag
uses: actions/github-script@v6
with:
Expand Down Expand Up @@ -48,8 +57,22 @@ jobs:
with:
password: ${{ secrets.PYPI_API_TOKEN }}

pypi-public:
needs:
- get-version
- pypi-release
runs-on: ubuntu-latest
steps:
- name: Wait for PyPi
uses: nev7n/wait_for_response@v1
with:
url: "https://files.pythonhosted.org/packages/source/a/anesthetic/anesthetic-${{ needs.get-version.outputs.version }}.tar.gz"
responseCode: 200
timeout: 600000
interval: 10000

aur-release:
needs: pypi-release
needs: pypi-public
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -63,17 +86,6 @@ jobs:
python -m pip install tomli
- name: Generate PKGBUILD
run: python ./bin/gen_PKGBUILD.py > ./PKGBUILD
- name: Get version number
run: |
VERSION="$(cat ./PKGBUILD | grep pkgver= | awk -F= '{print $2}')"
echo "DIST_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Wait for PyPi
uses: nev7n/wait_for_response@v1
with:
url: "https://files.pythonhosted.org/packages/source/a/anesthetic/anesthetic-${{ env.DIST_VERSION }}.tar.gz"
responseCode: 200
timeout: 600000
interval: 10000
- name: Publish AUR package
uses: KSXGitHub/[email protected]
with:
Expand All @@ -83,3 +95,74 @@ jobs:
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}

conda-release:
needs: pypi-public
name: Build and deploy to conda
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.11
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: install dependencies
shell: bash -el {0}
run: conda install grayskull conda-build anaconda-client
- name: Generate meta.yaml from grayskull
shell: bash -el {0}
run: grayskull pypi --strict-conda-forge anesthetic
- name: Build and upload the conda packages
uses: uibcdf/[email protected]
with:
meta_yaml_dir: anesthetic
python-version: 3.11
user: handley-lab
label: 'main'
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret

conda-build:
needs:
- conda-release
- get-version
name: test installation from conda
runs-on: ubuntu-latest
steps:
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.11
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: install from conda
shell: bash -el {0}
run: conda install -c handley-lab anesthetic
- name: get install version
shell: bash -el {0}
run: echo "install_version=$(python -c 'import anesthetic; print(anesthetic.__version__)')" >> $GITHUB_ENV
- name: fail if versions not matching
if: ${{ env.install_version != needs.get-version.outputs.version }}
run: exit 1

pypi-build:
needs:
- pypi-public
- get-version
name: test installation from pypi
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install from pypi
run: pip install anesthetic
- name: get install version
run: echo "install_version=$(python -c 'import anesthetic; print(anesthetic.__version__)')" >> $GITHUB_ENV
- name: fail if versions not matching
if: ${{ env.install_version != needs.get-version.outputs.version }}
run: exit 1
11 changes: 10 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ anesthetic: nested sampling post-processing
.. image:: https://badge.fury.io/py/anesthetic.svg
:target: https://badge.fury.io/py/anesthetic
:alt: PyPi location
.. image:: https://anaconda.org/handley-lab/anesthetic/badges/version.svg
:target: https://anaconda.org/handley-lab/anesthetic
:alt: Conda location
.. image:: https://zenodo.org/badge/175663535.svg
:target: https://zenodo.org/badge/latestdoi/175663535
:alt: Permanent DOI for this release
Expand Down Expand Up @@ -72,7 +75,13 @@ Installation

pip install anesthetic

or from the repository
via conda

.. code:: bash

conda install -c handley-lab anesthetic

or from the github repository

.. code:: bash

Expand Down
Loading