Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
BasedOnStyle: LLVM
AlignAfterOpenBracket: AlwaysBreak
AllowAllArgumentsOnNextLine: true
BinPackArguments: false
BinPackParameters: false
ColumnLimit: 88
CompactNamespaces: true
IncludeBlocks: Regroup
IndentWidth: 2
Language: Cpp
ReflowComments: true
SortIncludes: true
UseTab: Never
IncludeCategories:
- Regex: '^<cmocka\.h>'
Priority: 10
- Regex: '^".*\.h"'
Priority: 9
- Regex: '^<.*\.h>'
Priority: 8
...
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake
name: CMake Build

on:
push:
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/conan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Conan Packaging

on:
push:
branches: ["main"]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:

jobs:
conan:
name: conan packaging and publication on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
build_type: ["Release"]
fpic: ["True", "False"]
cfitsio: ["True", "False"]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: install conan
run: |
python3 -m pip install --upgrade pip wheel
python3 -m pip install conan
conan remote add astro-informatics \
https://api.bintray.com/conan/astro-informatics/astro-informatics

- name: create package with fpic=${{matrix.fpic}} cfitsio=${{matrix.cfitsio}}
shell: bash
run: |
if [ "${{ github.ref }}" = "refs/tags/v1.3.0" ]; then
channel="stable"
else
channel="testing"
fi
conan create . astro-informatics/${channel} \
--build missing \
-o s2let:fPIC=${{matrix.fpic}} \
-o s2let:with_cfitsio=${{matrix.cfitsio}} \
-s build_type=${{matrix.build_type}} \

- name: upload to bintray
if: ${{ startsWith(github.ref, 'refs/tags') }}
shell: bash
env:
CONAN_PASSWORD: ${{secrets.BINTRAY_TOKEN}}
CONAN_LOGIN_USERNAME: astroinformaticsci
CONAN_REMOTE_URL: https://api.bintray.com/conan/astro-informatics/astro-informatics
run: conan upload s2let/2.1.0 -c --all -r=astro-informatics
139 changes: 120 additions & 19 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,132 @@
name: python
name: Python Build

on:
"on":
push:
branches: ["main"]
branches: ["main"]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:

jobs:
testing:
development-mode:
name: pip development mode on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest]
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install build packages
run: python -m pip install --upgrade pip scikit-build

- name: Create sdist package
run: python setup.py sdist

- name: Install pys2let
run: pip install dist/pys2let-2.1.0.tar.gz
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install build packages and pytest
run: |
python -m pip install --upgrade pip wheel
python -m pip install scikit-build

- name: Install python s2let
run: pip install -e .[dev]

- name: run pytest
run: pytest src/test/python/

from-sdist:
name: python source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install build packages and pytest
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install conan scikit-build pytest cython numpy

- name: Create sdist
run: python setup.py sdist

- name: Install python s2let
run: "pip install dist/pys2let-*.tar.gz"

- name: run pytest
run: pytest src/test/python/

- uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
path: ./dist/*.tar.gz
name: source-distribution


build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
python-version: [3.8]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: ${{ matrix.python-version }}

- name: Setup environment
run: |
python -m pip install --upgrade pip wheel
python -m pip install conan pytest
conan profile new default --detect

- name: Build wheels
run: pip wheel . --use-pep517 --no-deps -w dist

- name: install wheel
run: "pip install dist/*.whl"

- name: run pytests
run: pytest src/test/python/

- uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
path: ./dist/*.whl
name: wheel-${{matrix.os}}-${{matrix.python-version}}

publication:
name: publish to pypi
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs: [build_wheels, from-sdist]
steps:
- name: Download wheels and sdist
uses: actions/download-artifact@v2

- name: Move wheels and source distribution to dist/
run: |
mkdir -p dist
mv source-distribution/*.tar.gz wheel-*/*.whl dist

- name: Publish distribution 📦 to Test PyPI
if: ${{ github.ref != 'refs/tags/v2.1.0' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/tags/v2.1.0' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ CMakeCache.txt
CMakeFiles/
dist/
MANIFEST
.clangd/
compile_commands.json
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
default_language_version:
python: python3.8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: no-commit-to-branch
args: ["--branch", "master"]
- repo: https://github.com/prettier/prettier
rev: 2.1.2
hooks:
- id: prettier
files: '.+\.yaml'
30 changes: 22 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,35 @@ option(conan_deps "Download dependencies using conan" OFF)
if(WIN32)
set(fpic OFF)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
if(conan_deps)
include("sanitizers")
if(conan_deps OR CONAN_EDITABLE_MODE)
include("conan_dependencies")
set(SO3_TARGET CONAN_PKG::so3)
if(NOT CONAN_EDITABLE_MODE)
set(SO3_TARGET CONAN_PKG::so3)
endif()
if(cfitsio)
set(CFITSIO_TARGET CONAN_PKG::cfitsio)
endif()
else()
endif()
if(NOT conan_deps)
find_package(So3 REQUIRED)
if(cfitsio)
set(SO3_TARGET so3)
if(cfitsio AND NOT CONAN_EDITABLE_MODE)
find_package(CFITSIO REQUIRED)
set(CFITSIO_TARGET cfitsio::cfitsio)
endif()
set(SO3_TARGET So3)
endif()

add_subdirectory(src/main/c)

if(tests)
enable_testing()
include("fetch_cmocka")
add_subdirectory(src/test/c)
endif()

Expand All @@ -52,7 +60,13 @@ else()
add_subdirectory(src/main/pys2let)
endif()

find_package(Doxygen)
if(DOXYGEN_FOUND)
doxygen_add_docs(docs WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs)
# only run documentation if this is not a sub-project
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(DOXYGEN_PROJECT_LOGO ${PROJECT_SOURCE_DIR}/docs/images/wav.png)
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C "YES")
set(DOXYGEN_EXTRACT_ALL "YES")
doxygen_add_docs(docs src/main/c src/test/c include)
endif()
endif()
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ include setup.py setup.cfg pyproject.toml
include COPYRIGHT.txt LICENSE.md README.md
include cmake/*.cmake
recursive-include src/main/c *.c CMakeLists.txt
recursive-include include *.h
recursive-include include/s2let *.h
recursive-include src/main/pys2let .py *.pyx *.md CMakeLists.txt
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

[docs-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-url]: https://astro-informatics.github.io/s2let/
[bintray-img]: https://img.shields.io/bintray/v/mdavezac/AstroFizz/s2let:AstroFizz?label=C%20package
[bintray-url]: https://bintray.com/mdavezac/AstroFizz/s2let:AstroFizz/2.1.0:stable/link
[bintray-img]: https://img.shields.io/bintray/v/astro-informatics/astro-informatics/s2let:astro-informactics?label=C%20package
[bintray-url]: https://bintray.com/astro-informatics/astro-informatics/s2let:astro-informatics/2.1.0:stable/link
[pypi-img]: https://badge.fury.io/py/pys2let.svg
[pypi-url]: https://badge.fury.io/py/pys2let
[codefactor-img]: https://www.codefactor.io/repository/github/astro-informatics/s2let/badge/main
[codefactor-url]: https://www.codefactor.io/repository/github/astro-informatics/s2let/overview/main

[![][docs-img]][docs-url]
[![][bintray-img]][bintray-url]
[![][pypi-img]][pypi-url]
![CMake Build](https://github.com/astro-informatics/s2let/workflows/CMake%20Build/badge.svg)
![Python Build](https://github.com/astro-informatics/s2let/workflows/Python%20Build/badge.svg)

## DESCRIPTION

Expand Down
13 changes: 8 additions & 5 deletions cmake/conan_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ if(fPIC AND NOT CONAN_OPTIONS)
elseif(NOT CONAN_OPTIONS)
set(fpic_value "False")
endif()
if(NOT CONAN_DEPS)
set(CONAN_DEPS "so3/1.2.1@AstroFizz/stable")
if(NOT CONAN_EDITABLE_MODE)
if(NOT CONAN_DEPS)
set(CONAN_DEPS "so3/1.3.0@astro-informatics/stable")
endif()
list(APPEND CONAN_OPTIONS "so3:fPIC=${fpic_value}")
endif()
list(APPEND CONAN_OPTIONS "so3:fPIC=${fpic_value}")
if(cfitsio)
list(APPEND CONAN_DEPS "cfitsio/3.480")
list(APPEND CONAN_OPTIONS "cfitsio:shared=False" "cfitsio:fPIC=${fpic_value}")
Expand All @@ -25,8 +27,9 @@ if(NOT CONAN_BUILD)
endif()

conan_check(REQUIRED)
conan_add_remote(NAME AstroFizz URL
https://api.bintray.com/conan/mdavezac/AstroFizz)
conan_add_remote(
NAME astro-informatics URL
https://api.bintray.com/conan/astro-informatics/astro-informatics)
conan_cmake_run(
REQUIRES
${CONAN_DEPS}
Expand Down
18 changes: 18 additions & 0 deletions cmake/fetch_cmocka.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include(FetchContent)

FetchContent_Declare(
CMocka
GIT_REPOSITORY https://gitlab.com/cmocka/cmocka.git
GIT_TAG cmocka-1.1.5)

FetchContent_GetProperties("cmocka")
if(NOT cmocka_POPULATED)
# Fetch the content using previously declared details
FetchContent_Populate("cmocka")
file(READ "${cmocka_SOURCE_DIR}/CMakeLists.txt" patch_cmocka)
string(REPLACE "add_subdirectory(src)" "add_subdirectory(src)\nreturn()"
patch_cmocka ${patch_cmocka})
file(WRITE "${cmocka_SOURCE_DIR}/CMakeLists.txt" ${patch_cmocka})

add_subdirectory(${cmocka_SOURCE_DIR} ${cmocka_BINARY_DIR})
endif()
Loading