Skip to content

Commit f250eea

Browse files
authored
Merge pull request #47 from henrikef/master
github actions instead of travis ci
2 parents 4126b48 + e240e15 commit f250eea

File tree

8 files changed

+374
-0
lines changed

8 files changed

+374
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: "\U0001F41B Bug Report"
3+
about: "If something isn't working as expected \U0001F914."
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is. What data are you using and how was it obtained?
12+
13+
*NOTE:* This is for BUG reports and not questions about generic data analysis.
14+
15+
**To Reproduce**
16+
17+
Please provide enough information for someone else to reporoduce this bug. That means e.g. a script + (links to) necessary files + any command line options, or an ipython notebook or something similar.
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Log files**
23+
Add log files or copy & paste the entire terminal output.
24+
25+
**Desktop (please complete the following information):**
26+
- OS: [e.g. iOS]
27+
- Version [e.g. 22]
28+
29+
30+
**Additional context**
31+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: GitHub Community Support
4+
url: https://github.community/
5+
about: Please ask and answer questions here.
6+
- name: GitHub Security Bug Bounty
7+
url: https://bounty.github.com/
8+
about: Please report security vulnerabilities here.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: "\U0001F52D Data Analysis Question"
3+
about: "I am trying to analyze some data with 3ML/HAL and I am stuck!"
4+
title: ''
5+
labels:
6+
assignees: ''
7+
8+
---
9+
10+
## Data Analysis Question
11+
12+
**To reproduce**
13+
Please let us know which data file, instrument response function etc. you are using, and include your model(s) and analysis script.
14+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "\U0001F680 Feature Request"
3+
about: "I have a suggestion (and may want to implement it \U0001F642)!"
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Feature Request
11+
12+
**Is your feature request related to a problem? Please describe.**
13+
A clear and concise description of what the problem is. Ex. I have an issue when [...]
14+
15+
**Describe the solution you'd like**
16+
A clear and concise description of what you want to happen. Add any considered drawbacks.
17+
18+
**Describe alternatives you've considered**
19+
A clear and concise description of any alternative solutions or features you've considered.
20+
21+
**Teachability, Documentation, Adoption, Migration Strategy**
22+
If you can, explain how users will be able to use this and possibly write out a version the docs.
23+
Maybe a screenshot or design?

.github/workflows/build_and_test.yml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: CI
2+
on:
3+
push:
4+
# paths-ignore:
5+
# - 'CHANGELOG.md'
6+
pull_request:
7+
schedule:
8+
- cron: "0 11 * * *"
9+
10+
jobs:
11+
skip_duplicate:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
15+
steps:
16+
- id: skip_check
17+
uses: fkirc/skip-duplicate-actions@master
18+
with:
19+
github_token: ${{ github.token }}
20+
concurrent_skipping: never
21+
skip_after_successful_duplicate: true
22+
paths_ignore: '["**/README.md", "**/docs/**"]'
23+
do_not_skip: '["pull_request", "schedule"]'
24+
25+
test-conda:
26+
name: Test on Conda
27+
needs: skip_duplicate
28+
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
29+
strategy:
30+
matrix:
31+
os: ["ubuntu-latest", "macos-latest"]
32+
python-version: [3.7]
33+
runs-on: ${{ matrix.os }}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v2
37+
- name: Cache conda
38+
uses: actions/cache@v1
39+
with:
40+
path: ~/conda_pkgs_dir
41+
key: conda-${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('environment-ci.yml') }}
42+
- name: Setup Miniconda
43+
uses: conda-incubator/setup-miniconda@v2
44+
with:
45+
auto-update-conda: true
46+
auto-activate-base: false
47+
activate-environment: test_env
48+
python-version: ${{ matrix.python-version }}
49+
channels: conda-forge, xspecmodels, threeml, defaults
50+
environment-file: ci/environment.yml
51+
52+
- name: Init Env
53+
shell: bash -l {0}
54+
run: |
55+
# Make sure we fail in case of error
56+
if [[ ${{matrix.os}} == ubuntu-latest ]];
57+
then
58+
miniconda_os=Linux
59+
compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64"
60+
else # osx
61+
miniconda_os=MacOSX
62+
compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64"
63+
64+
# On macOS we also need the conda libx11 libraries used to build xspec
65+
# We also need to pin down ncurses, for now only on macos.
66+
xorg="xorg-libx11"
67+
fi
68+
69+
# Get the version in the __version__ environment variable
70+
#python ci/set_minor_version.py --patch $TRAVIS_BUILD_NUMBER --version_file threeML/version.py
71+
72+
#export PKG_VERSION=$(cd threeML && python -c "import version;print(version.__version__)")
73+
74+
export PKG_VERSION=$(python -c "import versioneer;print(versioneer.get_version())")
75+
76+
echo "HOME= ${HOME}"
77+
echo "Building ${PKG_VERSION} ..."
78+
echo "Python version: ${{matrix.python-version}}"
79+
80+
#libgfortranver="3.0"
81+
#NUMPYVER=1.15
82+
MATPLOTLIBVER=2
83+
XSPECVER="6.25"
84+
xspec_channel=xspecmodels
85+
86+
# Figure out requested dependencies
87+
if [ -n "${MATPLOTLIBVER}" ]; then MATPLOTLIB="matplotlib=${MATPLOTLIBVER}"; fi
88+
if [ -n "${NUMPYVER}" ]; then NUMPY="numpy=${NUMPYVER}"; fi
89+
if [ -n "${XSPECVER}" ];
90+
then export XSPEC="xspec-modelsonly=${XSPECVER} ${xorg}";
91+
fi
92+
93+
94+
PKG="pytest>=3.6 pandas>=0.23 ultranest interpolation>=2.1.5"
95+
96+
conda install ${PKG} codecov pytest-cov git ${MATPLOTLIB} ${NUMPY} ${XSPEC} astropy ${compilers} scipy astropy astromodels threeML numba reproject root emcee pymultinest ultranest flake8
97+
pip install --no-binary :all: root_numpy
98+
- name: Conda list
99+
shell: bash -l {0}
100+
run: |
101+
conda list
102+
- name: install it
103+
shell: bash -l {0}
104+
run: |
105+
pip install -e .
106+
- name: Lint with flake8
107+
shell: bash -l {0}
108+
run: |
109+
# stop the build if there are Python syntax errors or undefined names
110+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
111+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
112+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
113+
114+
- name: test it
115+
shell: bash -l {0}
116+
run: |
117+
python -m pytest -vv
118+
119+
env:
120+
OMP_NUM_THREADS: 1
121+
MKL_NUM_THREADS: 1
122+
NUMEXPR_NUM_THREADS: 1
123+
MPLBACKEND: "Agg"
124+
125+
test-master:
126+
name: Test with master threeML/astromodels
127+
needs: skip_duplicate
128+
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }}
129+
strategy:
130+
matrix:
131+
os: ["ubuntu-latest", "macos-latest"]
132+
python-version: [3.7]
133+
runs-on: ${{ matrix.os }}
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v2
137+
- name: Cache conda
138+
uses: actions/cache@v1
139+
with:
140+
path: ~/conda_pkgs_dir
141+
key: conda-${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('environment-ci.yml') }}
142+
- name: Setup Miniconda
143+
uses: conda-incubator/setup-miniconda@v2
144+
with:
145+
auto-update-conda: true
146+
auto-activate-base: false
147+
activate-environment: test_env
148+
python-version: ${{ matrix.python-version }}
149+
channels: conda-forge, xspecmodels, threeml, defaults
150+
environment-file: ci/environment.yml
151+
152+
- name: Init Env
153+
shell: bash -l {0}
154+
run: |
155+
# Make sure we fail in case of error
156+
if [[ ${{matrix.os}} == ubuntu-latest ]];
157+
then
158+
miniconda_os=Linux
159+
compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64"
160+
else # osx
161+
miniconda_os=MacOSX
162+
compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64"
163+
164+
# On macOS we also need the conda libx11 libraries used to build xspec
165+
# We also need to pin down ncurses, for now only on macos.
166+
xorg="xorg-libx11"
167+
fi
168+
169+
# Get the version in the __version__ environment variable
170+
#python ci/set_minor_version.py --patch $TRAVIS_BUILD_NUMBER --version_file threeML/version.py
171+
172+
#export PKG_VERSION=$(cd threeML && python -c "import version;print(version.__version__)")
173+
174+
export PKG_VERSION=$(python -c "import versioneer;print(versioneer.get_version())")
175+
176+
echo "HOME= ${HOME}"
177+
echo "Building ${PKG_VERSION} ..."
178+
echo "Python version: ${{matrix.python-version}}"
179+
180+
#libgfortranver="3.0"
181+
#NUMPYVER=1.15
182+
MATPLOTLIBVER=2
183+
XSPECVER="6.25"
184+
xspec_channel=xspecmodels
185+
186+
# Figure out requested dependencies
187+
if [ -n "${MATPLOTLIBVER}" ]; then MATPLOTLIB="matplotlib=${MATPLOTLIBVER}"; fi
188+
if [ -n "${NUMPYVER}" ]; then NUMPY="numpy=${NUMPYVER}"; fi
189+
if [ -n "${XSPECVER}" ];
190+
then export XSPEC="xspec-modelsonly=${XSPECVER} ${xorg}";
191+
fi
192+
193+
194+
PKG="pytest>=3.6 pandas>=0.23 ultranest interpolation>=2.1.5"
195+
196+
conda install ${PKG} codecov pytest-cov git ${MATPLOTLIB} ${NUMPY} ${XSPEC} astropy ${compilers} scipy astropy astromodels threeML numba reproject root emcee pymultinest ultranest flake8
197+
pip install --no-binary :all: root_numpy
198+
pip uninstall astromodels threeML -y
199+
pip install git+https://github.com/threeml/astromodels.git
200+
pip install git+https://github.com/threeml/threeML.git
201+
- name: Conda list
202+
shell: bash -l {0}
203+
run: |
204+
conda list
205+
- name: install it
206+
shell: bash -l {0}
207+
run: |
208+
pip install -e .
209+
- name: Lint with flake8
210+
shell: bash -l {0}
211+
run: |
212+
# stop the build if there are Python syntax errors or undefined names
213+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
214+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
215+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
216+
217+
- name: test it
218+
shell: bash -l {0}
219+
run: |
220+
python -m pytest -vv
221+
222+
env:
223+
OMP_NUM_THREADS: 1
224+
MKL_NUM_THREADS: 1
225+
NUMEXPR_NUM_THREADS: 1
226+
MPLBACKEND: "Agg"

.github/workflows/issues.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Close stale issues and PRs
2+
on:
3+
schedule:
4+
- cron: 30 1 * * *
5+
6+
jobs:
7+
stale:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/stale@v3
11+
with:
12+
repo-token: ${{ secrets.GITHUB_TOKEN }}
13+
stale-issue-message: 'This issue has become stale. Is there an update? We will close in 14 days'
14+
stale-pr-message: 'This PR has become stale. Please check the status'
15+
stale-issue-label: 'no-issue-activity'
16+
days-before-stale: 90
17+
days-before-close: 14

ci/environment.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# environment file fo CI testing
2+
3+
name: test_env
4+
channels:
5+
- conda-forge
6+
- threeml
7+
- xspecmodels
8+
- defaults
9+
10+
dependencies:
11+
- pip
12+
- pytest
13+
- pytest-cov
14+
- coverage
15+
- setuptools
16+
- python
17+
- numpy>=1.15
18+
- scipy>=0.18
19+
- emcee>=3
20+
- astropy>=1.0.3
21+
- matplotlib
22+
- uncertainties
23+
- pyyaml>=5.1
24+
- dill
25+
- iminuit>=1.2,<2
26+
- astromodels>=2
27+
- astroquery
28+
- corner>=1.0.2
29+
- pandas>=0.23
30+
- requests
31+
- speclite
32+
- pymultinest
33+
- ultranest
34+
- dynesty>=1
35+
- pygmo>=2.4
36+
- ipywidgets
37+
- ipython
38+
- ipyparallel
39+
- numba
40+
- xz
41+
- py
42+
- pytest
43+
- numexpr
44+
- ipopt
45+
- numdifftools
46+
- tqdm
47+
- astromodels
48+
- threeml
49+
- future
50+
- xspec-modelsonly==6.25
51+
- root
52+
- numba
53+
- reproject

hawc_hal/obsolete/image_to_healpix.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import six
66
from scipy.ndimage import map_coordinates
77

8+
from astropy import units as u
9+
810
def image_to_healpix(data, wcs_in, coord_system_out,
911
nside, pixels_id, order='bilinear', nested=False,
1012
fill_value=UNSEEN, pixels_to_be_zeroed=None, full=False):

0 commit comments

Comments
 (0)