Skip to content

Commit 54869e6

Browse files
authored
Merge pull request #31 from astro-informatics/testing
add testing frameworks
2 parents d9a117b + dada014 commit 54869e6

File tree

457 files changed

+14360
-19813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+14360
-19813
lines changed

.clang-format

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
BasedOnStyle: LLVM
3+
AlignAfterOpenBracket: AlwaysBreak
4+
AllowAllArgumentsOnNextLine: true
5+
BinPackArguments: false
6+
BinPackParameters: false
7+
ColumnLimit: 88
8+
CompactNamespaces: true
9+
IncludeBlocks: Regroup
10+
IndentWidth: 2
11+
Language: Cpp
12+
ReflowComments: true
13+
SortIncludes: true
14+
UseTab: Never
15+
IncludeCategories:
16+
- Regex: '^<cmocka\.h>'
17+
Priority: 10
18+
- Regex: '^".*\.h"'
19+
Priority: 9
20+
- Regex: '^<.*\.h>'
21+
Priority: 8
22+
...

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CMake
1+
name: CMake Build
22

33
on:
44
push:

.github/workflows/conan.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Conan Packaging
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags:
7+
- "v[0-9]+.[0-9]+.[0-9]+"
8+
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
9+
pull_request:
10+
11+
jobs:
12+
conan:
13+
name: conan packaging and publication on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-latest]
19+
build_type: ["Release"]
20+
fpic: ["True", "False"]
21+
cfitsio: ["True", "False"]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- uses: actions/setup-python@v2
27+
with:
28+
python-version: 3.8
29+
30+
- name: install conan
31+
run: |
32+
python3 -m pip install --upgrade pip wheel
33+
python3 -m pip install conan
34+
conan remote add astro-informatics \
35+
https://api.bintray.com/conan/astro-informatics/astro-informatics
36+
37+
- name: create package with fpic=${{matrix.fpic}} cfitsio=${{matrix.cfitsio}}
38+
shell: bash
39+
run: |
40+
if [ "${{ github.ref }}" = "refs/tags/v1.3.0" ]; then
41+
channel="stable"
42+
else
43+
channel="testing"
44+
fi
45+
conan create . astro-informatics/${channel} \
46+
--build missing \
47+
-o s2let:fPIC=${{matrix.fpic}} \
48+
-o s2let:with_cfitsio=${{matrix.cfitsio}} \
49+
-s build_type=${{matrix.build_type}} \
50+
51+
- name: upload to bintray
52+
if: ${{ startsWith(github.ref, 'refs/tags') }}
53+
shell: bash
54+
env:
55+
CONAN_PASSWORD: ${{secrets.BINTRAY_TOKEN}}
56+
CONAN_LOGIN_USERNAME: astroinformaticsci
57+
CONAN_REMOTE_URL: https://api.bintray.com/conan/astro-informatics/astro-informatics
58+
run: conan upload s2let/2.1.0 -c --all -r=astro-informatics

.github/workflows/python.yml

Lines changed: 120 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,132 @@
1-
name: python
1+
name: Python Build
22

3-
on:
3+
"on":
44
push:
5-
branches: ["main"]
5+
branches: ["main"]
6+
tags:
7+
- "v[0-9]+.[0-9]+.[0-9]+"
8+
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
69
pull_request:
710

811
jobs:
9-
testing:
12+
development-mode:
13+
name: pip development mode on ${{ matrix.os }}
1014
runs-on: ${{ matrix.os }}
1115
strategy:
1216
fail-fast: false
1317
matrix:
14-
os: [ubuntu-latest, macos-latest]
18+
os: [macos-latest]
1519
python-version: [3.8]
1620

1721
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v2
21-
with:
22-
python-version: ${{ matrix.python-version }}
23-
24-
- name: Install build packages
25-
run: python -m pip install --upgrade pip scikit-build
26-
27-
- name: Create sdist package
28-
run: python setup.py sdist
29-
30-
- name: Install pys2let
31-
run: pip install dist/pys2let-2.1.0.tar.gz
22+
- uses: actions/checkout@v2
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install build packages and pytest
29+
run: |
30+
python -m pip install --upgrade pip wheel
31+
python -m pip install scikit-build
32+
33+
- name: Install python s2let
34+
run: pip install -e .[dev]
35+
36+
- name: run pytest
37+
run: pytest src/test/python/
38+
39+
from-sdist:
40+
name: python source distribution
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v2
44+
- name: Set up Python 3.8
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: 3.8
48+
49+
- name: Install build packages and pytest
50+
run: |
51+
python -m pip install --upgrade pip wheel setuptools
52+
python -m pip install conan scikit-build pytest cython numpy
53+
54+
- name: Create sdist
55+
run: python setup.py sdist
56+
57+
- name: Install python s2let
58+
run: "pip install dist/pys2let-*.tar.gz"
59+
60+
- name: run pytest
61+
run: pytest src/test/python/
62+
63+
- uses: actions/upload-artifact@v2
64+
if: ${{ startsWith(github.ref, 'refs/tags') }}
65+
with:
66+
path: ./dist/*.tar.gz
67+
name: source-distribution
68+
69+
70+
build_wheels:
71+
name: Build wheels on ${{ matrix.os }}
72+
runs-on: ${{ matrix.os }}
73+
strategy:
74+
matrix:
75+
os: [macos-latest]
76+
python-version: [3.8]
77+
78+
steps:
79+
- uses: actions/checkout@v2
80+
81+
- uses: actions/setup-python@v2
82+
name: Install Python
83+
with:
84+
python-version: ${{ matrix.python-version }}
85+
86+
- name: Setup environment
87+
run: |
88+
python -m pip install --upgrade pip wheel
89+
python -m pip install conan pytest
90+
conan profile new default --detect
91+
92+
- name: Build wheels
93+
run: pip wheel . --use-pep517 --no-deps -w dist
94+
95+
- name: install wheel
96+
run: "pip install dist/*.whl"
97+
98+
- name: run pytests
99+
run: pytest src/test/python/
100+
101+
- uses: actions/upload-artifact@v2
102+
if: ${{ startsWith(github.ref, 'refs/tags') }}
103+
with:
104+
path: ./dist/*.whl
105+
name: wheel-${{matrix.os}}-${{matrix.python-version}}
106+
107+
publication:
108+
name: publish to pypi
109+
if: ${{ startsWith(github.ref, 'refs/tags') }}
110+
runs-on: ubuntu-latest
111+
needs: [build_wheels, from-sdist]
112+
steps:
113+
- name: Download wheels and sdist
114+
uses: actions/download-artifact@v2
115+
116+
- name: Move wheels and source distribution to dist/
117+
run: |
118+
mkdir -p dist
119+
mv source-distribution/*.tar.gz wheel-*/*.whl dist
120+
121+
- name: Publish distribution 📦 to Test PyPI
122+
if: ${{ github.ref != 'refs/tags/v2.1.0' }}
123+
uses: pypa/gh-action-pypi-publish@master
124+
with:
125+
password: ${{ secrets.TEST_PYPI_TOKEN }}
126+
repository_url: https://test.pypi.org/legacy/
127+
128+
- name: Publish distribution 📦 to PyPI
129+
if: ${{ github.ref == 'refs/tags/v2.1.0' }}
130+
uses: pypa/gh-action-pypi-publish@master
131+
with:
132+
password: ${{ secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ CMakeCache.txt
2727
CMakeFiles/
2828
dist/
2929
MANIFEST
30+
.clangd/
31+
compile_commands.json

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
default_language_version:
2+
python: python3.8
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.1.0
6+
hooks:
7+
- id: check-merge-conflict
8+
- id: debug-statements
9+
- id: no-commit-to-branch
10+
args: ["--branch", "master"]
11+
- repo: https://github.com/prettier/prettier
12+
rev: 2.1.2
13+
hooks:
14+
- id: prettier
15+
files: '.+\.yaml'

CMakeLists.txt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,35 @@ option(conan_deps "Download dependencies using conan" OFF)
1616
if(WIN32)
1717
set(fpic OFF)
1818
endif()
19+
if(NOT CMAKE_BUILD_TYPE)
20+
set(CMAKE_BUILD_TYPE "Debug")
21+
endif()
1922

2023
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
21-
if(conan_deps)
24+
include("sanitizers")
25+
if(conan_deps OR CONAN_EDITABLE_MODE)
2226
include("conan_dependencies")
23-
set(SO3_TARGET CONAN_PKG::so3)
27+
if(NOT CONAN_EDITABLE_MODE)
28+
set(SO3_TARGET CONAN_PKG::so3)
29+
endif()
2430
if(cfitsio)
2531
set(CFITSIO_TARGET CONAN_PKG::cfitsio)
2632
endif()
27-
else()
33+
endif()
34+
if(NOT conan_deps)
2835
find_package(So3 REQUIRED)
29-
if(cfitsio)
36+
set(SO3_TARGET so3)
37+
if(cfitsio AND NOT CONAN_EDITABLE_MODE)
3038
find_package(CFITSIO REQUIRED)
3139
set(CFITSIO_TARGET cfitsio::cfitsio)
3240
endif()
33-
set(SO3_TARGET So3)
3441
endif()
3542

3643
add_subdirectory(src/main/c)
3744

3845
if(tests)
3946
enable_testing()
47+
include("fetch_cmocka")
4048
add_subdirectory(src/test/c)
4149
endif()
4250

@@ -52,7 +60,13 @@ else()
5260
add_subdirectory(src/main/pys2let)
5361
endif()
5462

55-
find_package(Doxygen)
56-
if(DOXYGEN_FOUND)
57-
doxygen_add_docs(docs WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs)
63+
# only run documentation if this is not a sub-project
64+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
65+
find_package(Doxygen)
66+
if(DOXYGEN_FOUND)
67+
set(DOXYGEN_PROJECT_LOGO ${PROJECT_SOURCE_DIR}/docs/images/wav.png)
68+
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C "YES")
69+
set(DOXYGEN_EXTRACT_ALL "YES")
70+
doxygen_add_docs(docs src/main/c src/test/c include)
71+
endif()
5872
endif()

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ include setup.py setup.cfg pyproject.toml
33
include COPYRIGHT.txt LICENSE.md README.md
44
include cmake/*.cmake
55
recursive-include src/main/c *.c CMakeLists.txt
6-
recursive-include include *.h
6+
recursive-include include/s2let *.h
77
recursive-include src/main/pys2let .py *.pyx *.md CMakeLists.txt

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

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

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

1418
## DESCRIPTION
1519

cmake/conan_dependencies.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ if(fPIC AND NOT CONAN_OPTIONS)
1212
elseif(NOT CONAN_OPTIONS)
1313
set(fpic_value "False")
1414
endif()
15-
if(NOT CONAN_DEPS)
16-
set(CONAN_DEPS "so3/1.2.1@AstroFizz/stable")
15+
if(NOT CONAN_EDITABLE_MODE)
16+
if(NOT CONAN_DEPS)
17+
set(CONAN_DEPS "so3/1.3.0@astro-informatics/stable")
18+
endif()
19+
list(APPEND CONAN_OPTIONS "so3:fPIC=${fpic_value}")
1720
endif()
18-
list(APPEND CONAN_OPTIONS "so3:fPIC=${fpic_value}")
1921
if(cfitsio)
2022
list(APPEND CONAN_DEPS "cfitsio/3.480")
2123
list(APPEND CONAN_OPTIONS "cfitsio:shared=False" "cfitsio:fPIC=${fpic_value}")
@@ -25,8 +27,9 @@ if(NOT CONAN_BUILD)
2527
endif()
2628

2729
conan_check(REQUIRED)
28-
conan_add_remote(NAME AstroFizz URL
29-
https://api.bintray.com/conan/mdavezac/AstroFizz)
30+
conan_add_remote(
31+
NAME astro-informatics URL
32+
https://api.bintray.com/conan/astro-informatics/astro-informatics)
3033
conan_cmake_run(
3134
REQUIRES
3235
${CONAN_DEPS}

0 commit comments

Comments
 (0)