Skip to content

Commit

Permalink
Merge pull request #175 from sunpy/ci
Browse files Browse the repository at this point in the history
updated CI and py39 tests
  • Loading branch information
nabobalis committed Nov 28, 2020
2 parents ad1657f + e2bf5bc commit 6d6d1c0
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 130 deletions.
40 changes: 0 additions & 40 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,42 +50,6 @@ jobs:
- run: pip install --progress-bar off .[all,dev]
- run: pip install -e .[all,dev]

html-docs:
docker:
- image: continuumio/miniconda3
environment:
SUNPY_SAMPLEDIR=/root/sunpy/data/sample_data/
steps:
- run: *no-backports
- checkout
- run: *skip-check
- restore_cache:
keys: sample-data-v12
- run: *merge-check
- run: *apt-install
- run: pip install -U tox tox-pypi-filter>=0.12
- run: tox -e build_docs
- save_cache:
key: sample-data-v12
paths:
- /root/sunpy/data/sample_data/
- run:
name: Prepare for upload
command: |
# If it's not a PR, don't upload
if [ -z "${CIRCLE_PULL_REQUEST}" ]; then
rm -r docs/_build/html/*
else
# If it is a PR, delete sources, because it's a lot of files
# which we don't really need to upload
rm -r docs/_build/html/_sources
fi
- store_artifacts:
path: docs/_build/html
- run:
name: "Built documentation is available at:"
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/docs/_build/html/index.html"; echo $DOCS_URL

workflows:
version: 2

Expand All @@ -97,10 +61,6 @@ workflows:
jobs:
- pip-install

test-documentation:
jobs:
- html-docs

notify:
webhooks:
- url: https://giles.cadair.dev/circleci
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ docs/generated
docs/api/
docs/whatsnew/latest_changelog.txt
examples/**/*.asdf
# This is incase you run the figure tests
figure_test_images*
tags
sunraster/version.py
sunraster/_version.py

### Pycharm(?)
.idea
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ prune docs/_build
prune docs/api

global-exclude *.pyc *.o

# This subpackage is only used in development checkouts and should not be
# included in built tarballs
prune sunraster/_dev
157 changes: 96 additions & 61 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,64 +36,99 @@ schedules:
- master
always: true

jobs:
- template: run-tox-env.yml@OpenAstronomy
parameters:
default_python: '3.8'
submodules: false
coverage: codecov
posargs: -n=4
libraries:
yum:
- openssl-devel
- freetype-devel
- libpng-devel
envs:
- macos: py37
name: py37_osx
posargs: -n=1

- linux32: py38-32bit
name: py38_test_32bit

- windows: py37
name: py37_win

- linux: py38-online
name: py38_online

- linux: codestyle
name: python_codestyle

- linux: py37-oldestdeps
name: py37_oldestdeps

- linux: py38-devdeps
name: py38_test_devdeps

- linux: py38-ndcube14dev
name: py38_ndcube14dev

- linux: py38-ndcube20dev
name: py38_ndcube20dev

# On branches which aren't master, and not Pull Requests, build the wheels but only upload them on tags
- ${{ if and(ne(variables['Build.Reason'], 'PullRequest'), not(contains(variables['Build.SourceBranch'], 'master'))) }}:
- template: publish.yml@OpenAstronomy
parameters:
# Only Upload to PyPI on tags
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
pypi_connection_name : 'PyPI'
test_extras: 'dev'
test_command: 'pytest -p no:warnings --doctest-rst -m "not figure" --pyargs sunraster'
submodules: false
targets:
- wheels_linux
- wheels_macos
- sdist
dependsOn:
- py37_osx
- py37_win
- py38_online
- py37_oldestdeps
- py38_test_32bit
pr:
autoCancel: true

stages:
- stage: FirstPhaseTests
displayName: Core Tests
jobs:
- template: run-tox-env.yml@OpenAstronomy
parameters:
default_python: '3.8'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n=4

envs:
- linux: codestyle
name: style_check
pytest: false
libraries: {}

- linux: py38

- stage: SecondPhaseTests
displayName: Stage 2 Tests
dependsOn: FirstPhaseTests
jobs:
- template: run-tox-env.yml@OpenAstronomy
parameters:
default_python: '3.8'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n=4
libraries:
apt:
- graphviz

envs:
- macos: py37

- windows: py39

- linux: build_docs
posargs: " "
pytest: false

- linux: py38-online

- linux: py37-oldestdeps

- linux: py38-ndcube14dev

- linux: py38-ndcube20dev


- ${{ if or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.Reason'], 'Manual')) }}:
- stage: CronTests
displayName: Cron Tests
dependsOn: [] # Don't wait on other stages
jobs:
- template: run-tox-env.yml@OpenAstronomy
parameters:
default_python: '3.8'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
posargs: -n=4

libraries:
yum:
- openssl-devel
- freetype-devel
- libpng-devel
- hdf5-devel

envs:
- linux: py38-devdeps

# On branches which aren't master, and not Pull Requests, build the wheels but only upload them on tags
- ${{ if and(ne(variables['Build.Reason'], 'PullRequest'), or(ne(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.Reason'], 'Manual'))) }}:
- stage: Release
dependsOn: SecondPhaseTests
jobs:
- template: publish.yml@OpenAstronomy
parameters:
# Only Upload to PyPI on tags
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
pypi_connection_name : 'PyPI'
test_extras: 'dev'
test_command: 'pytest -p no:warnings --doctest-rst -m "not figure" --pyargs sunpy'
submodules: false
targets:
- wheels_cp3[78]-manylinux*x86_64
- wheels_cp3[78]-macosx*
- sdist
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ build-backend = 'setuptools.build_meta'

number_incorrect_long = "The number in the changelog file you added does not match the number of this pull request. Please rename the file."

[ tool.gilesbot.milestones ]
enabled = true
missing_message_long = "This pull request does not have a milestone assigned to it. Only maintainers can change this, so you don't need to worry about it. :smile:"

[tool.towncrier]
package = "sunraster"
filename = "CHANGELOG.rst"
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ docs =
sunpy-sphinx-theme
towncrier

[options.packages.find]
exclude = sunraster._dev

[tool:pytest]
minversion = 5.0
testpaths = "sunraster" "docs"
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".history"
norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".history" "sunraster[\/]_dev"
doctest_plus = enabled
doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS
text_file_format = rst
Expand Down
18 changes: 1 addition & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,7 @@
# Concatenate all the values together for 'all'
extras['all'] = list(chain.from_iterable(ex_extras.values()))

################################################################################
# Version configuration and setup call
################################################################################

VERSION_TEMPLATE = """
# Note that we need to fall back to the hard-coded version if either
# setuptools_scm can't be imported or setuptools_scm can't determine the
# version, so we catch the generic 'Exception'.
try:
from setuptools_scm import get_version
__version__ = get_version(root='..', relative_to=__file__)
except Exception:
__version__ = '{version}'
""".lstrip()

setup(
extras_require=extras,
use_scm_version={'write_to': os.path.join('sunraster', 'version.py'),
'write_to_template': VERSION_TEMPLATE},
use_scm_version={'write_to': os.path.join('sunraster', '_version.py')},
)
5 changes: 1 addition & 4 deletions sunraster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

from .spectrogram import SpectrogramCube
from .spectrogram_sequence import RasterSequence, SpectrogramSequence
from .version import version as __version__

try:
from .version import __version__
except ImportError:
__version__ = "unknown"

# Enforce Python version check during package import.
__minimum_python_version__ = "3.7"
Expand Down
6 changes: 6 additions & 0 deletions sunraster/_dev/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
This package contains utilities that are only used when developing drms in a
copy of the source repository.
These files are not installed, and should not be assumed to exist at
runtime.
"""
12 changes: 12 additions & 0 deletions sunraster/_dev/scm_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Try to use setuptools_scm to get the current version; this is only used
# in development installations from the git repository.
import os.path

try:
from setuptools_scm import get_version

version = get_version(root=os.path.join('..', '..'), relative_to=__file__)
except ImportError:
raise ImportError('setuptools_scm not installed')
except Exception as e:
raise ValueError(f'setuptools_scm broken with {e}')
40 changes: 40 additions & 0 deletions sunraster/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed
# This file is not included in sunpy wheels/tarballs, so otherwise it will
# fall back on the generated _version module.
try:
try:
from ._dev.scm_version import version
except ImportError:
from ._version import version
except Exception:
import warnings

warnings.warn(
f'could not determine {__name__.split(".")[0]} package version; this indicates a broken installation'
)
del warnings

version = '0.0.0'


# We use LooseVersion to define major, minor, micro, but ignore any suffixes.
def split_version(version):
pieces = [0, 0, 0]

try:
from distutils.version import LooseVersion

for j, piece in enumerate(LooseVersion(version).version[:3]):
pieces[j] = int(piece)

except Exception:
pass

return pieces


major, minor, bugfix = split_version(version)

del split_version # clean up namespace.

release = 'dev' not in version
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{37,38}{,-oldestdeps,-devdeps,-online}
py{37,38,39}{,-oldestdeps,-devdeps,-online}
build_docs
codestyle
isolated_build = true
Expand Down

0 comments on commit 6d6d1c0

Please sign in to comment.