Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
80 changes: 80 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Conda Build and Upload

on:
schedule:
- cron: '0 0 * * 0' # Run weekly on Sunday at midnight UTC
push:
branches: [master]
tags:
- 'v*'
workflow_dispatch: # Allow manual triggering

jobs:
conda-build:
name: Build and Upload Conda Package
runs-on: ubuntu-24.04
permissions:
contents: read

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for git describe

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: '3.12'
channels: conda-forge,defaults
channel-priority: strict

- name: Install conda-build and anaconda-client
shell: bash -l {0}
run: |
conda install -y conda-build anaconda-client

- name: Determine package version
id: get_version
shell: bash -l {0}
run: |
# Use the most recent version tag, falling back to the version in CMakeLists.txt
TAG_VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
if [ -n "${TAG_VERSION}" ]; then
VERSION="${TAG_VERSION}"
else
MAJOR=$(grep -m1 'set(MADNESS_MAJOR_VERSION' CMakeLists.txt | grep -oE '[0-9]+')
MINOR=$(grep -m1 'set(MADNESS_MINOR_VERSION' CMakeLists.txt | grep -oE '[0-9]+')
MICRO=$(grep -m1 'set(MADNESS_MICRO_VERSION' CMakeLists.txt | grep -oE '[0-9]+')
VERSION="${MAJOR}.${MINOR}.${MICRO}"
fi
echo "GIT_DESCRIBE_TAG=${VERSION}" >> $GITHUB_ENV
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Package version: ${VERSION}"

- name: Build Conda Package
shell: bash -l {0}
run: |
conda build conda-recipe/ \
--no-test \
--output-folder ${{ github.workspace }}/conda-dist/

- name: Upload to Anaconda.org
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref, 'refs/tags/')
shell: bash -l {0}
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
# Upload all built packages (both .conda and legacy .tar.bz2 formats)
find ${{ github.workspace }}/conda-dist/ \( -name '*.conda' -o -name '*.tar.bz2' \) | \
xargs -r -I{} anaconda -t "${ANACONDA_TOKEN}" upload --force {}

- name: Upload conda package as workflow artifact
uses: actions/upload-artifact@v4
with:
name: conda-package-${{ steps.get_version.outputs.version }}
path: ${{ github.workspace }}/conda-dist/**/*.conda
if-no-files-found: warn
1 change: 1 addition & 0 deletions conda-recipe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!build.sh
19 changes: 19 additions & 0 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -ex

mkdir -p build
cd build

cmake ${CMAKE_ARGS} \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_PREFIX_PATH="${PREFIX}" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DMADNESS_TASK_BACKEND=Pthreads \
-DMPI_CXX_SKIP_MPICXX=ON \
-DMPIEXEC_PREFLAGS='--allow-run-as-root' \
..

ninja install
54 changes: 54 additions & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% set version = environ.get('GIT_DESCRIBE_TAG', 'dev') %}

package:
name: madness
version: {{ version }}

source:
path: ..

build:
number: 0
skip: true # [win]
script_env:
- OMPI_ALLOW_RUN_AS_ROOT=1
- OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

requirements:
build:
- {{ compiler('cxx') }}
- {{ compiler('c') }}
- {{ compiler('fortran') }}
- cmake >=3.12
- ninja
- make
host:
- openmpi
- libblas
- liblapack
run:
- openmpi
- libblas
- liblapack

test:
commands:
- test -f $PREFIX/include/madness/world/world.h # [unix]
- test -f $PREFIX/lib/libMADworld.a # [unix]

about:
home: https://madness.readthedocs.io/
license: GPL-2.0-or-later
license_file: LICENSE
summary: 'MADNESS: Multiresolution Adaptive Numerical Environment for Scientific Simulation'
description: |
MADNESS (Multiresolution Adaptive Numerical Environment for Scientific Simulation)
provides a high-level environment for the solution of integral and differential
equations in many dimensions using adaptive, fast methods with guaranteed precision
based on multi-resolution analysis and novel separated representations.
dev_url: https://github.com/m-a-d-n-e-s-s/madness
doc_url: https://madness.readthedocs.io/

extra:
recipe-maintainers:
- m-a-d-n-e-s-s
Loading