Skip to content

Commit

Permalink
Release workflow (#70)
Browse files Browse the repository at this point in the history
* create publish/release workflow
* enable lcviz.test()
* populate initial change log file
* update to use trusted publishing
* pin jdaviz 3.8.* for first release
* fix toxenv for 3.9 test

---------

Co-authored-by: P. L. Lim <[email protected]>
  • Loading branch information
kecnry and pllim authored Dec 14, 2023
1 parent 486f5e1 commit a4eaea7
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Windows - Python 3.9
os: windows-latest
python: 3.9
toxenv: py38-test
toxenv: py39-test
allow_failure: false

# This also runs on cron but we want to make sure new changes
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

on:
# NOTE: PR trigger is to ensure changes do not break packaging.
pull_request:
release:
types: [released]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
if: github.repository == 'spacetelescope/lcviz'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install python-build and twine
run: python -m pip install build "twine>=3.3"

- name: Build package
run: python -m build --sdist --wheel .

- name: List result
run: ls -l dist

- name: Check dist
run: python -m twine check --strict dist/*

- name: Test package
run: |
cd ..
python -m venv testenv
testenv/bin/pip install pytest pytest-astropy pytest-tornasync lcviz/dist/*.whl
testenv/bin/python -c "import lcviz; lcviz.test(remote_data=True)"
# NOTE: Do not run this part for PR testing.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name != 'pull_request'
7 changes: 4 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Changes included in this version
--------------------------------
0.1.0 - unreleased
------------------

Edit this template to detail updates to the codebase
* Initial release of lcviz with support to import time-series light curves via lightkurve and
process them through binning, flattening, frequency analysis, and ephemeris plugins.
6 changes: 6 additions & 0 deletions lcviz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import os
from astropy.tests.runner import TestRunner

try:
from .version import version as __version__
except ImportError:
Expand All @@ -15,3 +18,6 @@
from .tools import * # noqa
from .viewers import * # noqa
from .helper import * # noqa

# Create the test function for self test
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
]
dependencies = [
"astropy>=5.2",
"jdaviz>=3.8",
"jdaviz==3.8.*",
"lightkurve>=2.4.1",
]
dynamic = [
Expand Down

0 comments on commit a4eaea7

Please sign in to comment.