Skip to content

Commit

Permalink
Merge pull request #48 from soar-telescope/update_publish_action
Browse files Browse the repository at this point in the history
Update publish action
  • Loading branch information
simontorres authored Sep 24, 2024
2 parents 06cd424 + bddfd04 commit b046d64
Show file tree
Hide file tree
Showing 13 changed files with 200 additions and 252 deletions.
83 changes: 71 additions & 12 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,89 @@ on:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
include:

- name: Python 3.12 with Coverage
os: ubuntu-latest
python: '3.12'
toxenv: py312-test-cov

- name: Python 3.12
os: ubuntu-latest
python: '3.12'
toxenv: py312-test

- name: Python 3.10
os: ubuntu-latest
python: '3.10'
toxenv: py310-test

- name: Python 3.9
os: ubuntu-latest
python: 3.9
toxenv: py39-test

- name: Python 3.8
os: ubuntu-latest
python: 3.8
toxenv: py38-test

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Checkout code
uses: actions/checkout@v4
with:
python-version: ${{ matrix.python-version }}
fetch-depth: 0

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest wheel
python -m pip install --upgrade tox
pip install flake8 pytest-cov wheel tox
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
- name: Run Tests
run: |
pytest
tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
- name: Upload coverage to artifacts
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.toxenv }}.xml
path: coverage.xml
if-no-files-found: error

upload-coverage-report:
needs: ['tests']
permissions:
contents: none
runs-on: ubuntu-latest
name: Upload Coverage
steps:
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
path: coverage
pattern: coverage_*
merge-multiple: true
- name: Upload to Codecov
if: ${{ hashFiles('coverage/') != ''}}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
fail_ci_if_error: true # optional (default = false)
verbose: true
48 changes: 31 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@

# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload to PYPI

on:
release:
types: [created]
on: push

jobs:
deploy:

release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build .
twine upload dist/*
python3 -m pip install build
- name: Build a binary wheel and source tarball
run: python3 -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
name: Publish Package to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- release-build
permissions:
id-token: write

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ build/*
*__pycache__*
*.egg-info/*
.tox/*
/coverage.xml
/.tox/
/.coverage*
/goodman_focus/version.py
.DS_Store
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: 2


build:
os: ubuntu-lts-latest
tools:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Goodman Focus Finder

![Goodman Focus](https://github.com/soar-telescope/goodman_focus/workflows/Goodman%20Focus/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/soar-telescope/goodman_focus/badge.svg?branch=master)](https://coveralls.io/github/soar-telescope/goodman_focus?branch=master)
[![codecov](https://codecov.io/gh/soar-telescope/goodman_focus/graph/badge.svg?token=2ZK2DAMMYE)](https://codecov.io/gh/soar-telescope/goodman_focus)
[![Documentation Status](https://readthedocs.org/projects/goodman-focus/badge/?version=latest)](https://goodman-focus.readthedocs.io/en/latest/?badge=latest)
[![pypi](https://img.shields.io/pypi/v/goodman_focus.svg?style=flat)](https://pypi.org/project/goodman-focus/)

Expand All @@ -17,4 +17,4 @@ All the documentation is maintained in https://soardocs.readthedocs.io/projects/
# Found a problem?

Please [Open an Issue](https://github.com/soar-telescope/goodman_focus/issues) on
GitHub.
GitHub.
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

__version__ = __import__('goodman_focus').__version__
from importlib.metadata import version
__version__ = version('goodman_focus')

# -- Project information -----------------------------------------------------

Expand All @@ -43,8 +44,8 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinxcontrib.napoleon',
'matplotlib.sphinxext.plot_directive',
'sphinx.ext.napoleon'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -170,4 +171,4 @@
# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: goodman_focus
dependencies:
- python=3.8
- python=3.12
- astropy
- matplotlib
- numpy
Expand Down
5 changes: 4 additions & 1 deletion goodman_focus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from .version import __version__ # noqa: F401
from importlib.metadata import version

from .goodman_focus import GoodmanFocus # noqa: F401
from .goodman_focus import run_goodman_focus # noqa: F401

__version__ = version('goodman_focus')
2 changes: 0 additions & 2 deletions goodman_focus/version.py

This file was deleted.

73 changes: 69 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

requires = ["setuptools",
"setuptools_scm",
"wheel"]
[project]
name = "goodman_focus"
dynamic = ["version"]
description = "Finds best focus for Goodman HTS based on a series of images obtained with different focus values"
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
keywords = [
"soar",
"pipelines",
"astronomy",
"images",
"spectroscopy",
"focus"
]

build-backend = 'setuptools.build_meta'
authors = [
{name = "Simón Torres", email = "[email protected]"}
]
maintainers = [
{name = "Simón Torres", email = "[email protected]"}
]

classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Operating System :: POSIX :: Other',
'Operating System :: MacOS :: MacOS X',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Libraries :: Python Modules',
]

dependencies = [
"astropy",
"ccdproc",
"matplotlib",
"numpy",
"packaging",
"pandas",
"scipy",
]

[project.urls]
"Homepage" = "https://soardocs.readthedocs.io/projects/goodmanfocus/en/latest/"
"Bug Reports" = "https://github.com/soar-telescope/goodman_focus/issues"
"Source" = "https://github.com/soar-telescope/goodman_focus"

[project.scripts]
goodman-focus = "goodman_focus:run_goodman_focus"

[tool.setuptools]
[tool.setuptools.packages.find]
where = ["goodman_focus"]

[tool.setuptools_scm]
version_file = "goodman_focus/version.py"
22 changes: 0 additions & 22 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,3 @@ build_dir = docs/_build
[upload_docs]
upload_dir = docs/_build/html
show_response = 1

[metadata]
package_name = goodman_focus
description = Finds best focus for Goodman HTS based on a series of images obtained with different focus values
long_description = Standalone app to get the best focus.
author = Simon Torres
author_email = [email protected]
license = BSD-3-Clause
# url =
edit_on_github = False
github_project = soar-telescope/goodman_focus
install_requires =
astropy
matplotlib
numpy
pandas
scipy
ccdproc
sphinx

# version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440)
version = 2.0.3
Loading

0 comments on commit b046d64

Please sign in to comment.