Skip to content

Use default Vega spectrum for flux conversions #816

Use default Vega spectrum for flux conversions

Use default Vega spectrum for flux conversions #816

name: Release
on:
schedule:
# run every day at 5am UTC
- cron: '0 5 * * *'
workflow_dispatch:
release:
types: [released]
pull_request:
# We also want this workflow triggered if the 'Build wheels'
# label is added or present when PR is updated
types:
- synchronize
- labeled
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_wheels:
permissions:
contents: none
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: (github.repository == 'spacetelescope/synphot_refactor' && ( github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build wheels')))
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install pip "twine>=3.3" -U
- name: Build wheels
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
env:
CIBW_BUILD: 'cp310-* cp311-* cp312-* cp313-* cp314-*'
CIBW_ARCHS_LINUX: 'x86_64'
CIBW_ARCHS_WINDOWS: 'AMD64'
CIBW_ARCHS_MACOS: 'x86_64 arm64'
CIBW_TEST_REQUIRES: 'pytest pytest-astropy'
CIBW_TEST_COMMAND: 'pytest --pyargs synphot'
- name: Check wheels
run: python -m twine check --strict wheelhouse/*
# Upload artifacts because gh-action-pypi-publish Docker is only on Linux
- name: Upload wheels
if: (github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: additional-pylons-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_dist:
permissions:
contents: none
name: Source dist
runs-on: ubuntu-latest
if: (github.repository == 'spacetelescope/synphot_refactor' && ( github.event_name == 'release' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build wheels')))
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install pip build "twine>=3.3" -U
- name: Build package
run: python -m build --sdist .
- name: Check dist
run: python -m twine check --strict dist/*
- name: Test package
run: |
cd ..
python -m venv testenv
testenv/bin/pip install -U pip
testenv/bin/pip install pytest pytest-astropy
testenv/bin/pip install synphot_refactor/dist/*.tar.gz
testenv/bin/pytest --pyargs synphot
- name: Upload dist
if: github.event_name == 'release'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: additional-pylons-dist
path: ./dist/*.tar.gz
publish:
name: Publish to PyPI
needs: [build_wheels, build_dist]
if: github.repository == 'spacetelescope/synphot_refactor' && github.event_name == 'release'
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/synphot
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download wheels
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: dist
pattern: additional-pylons-*
merge-multiple: true
- name: Pylons inspection
run: ls dist/*
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
anaconda:
name: Publish nightly wheel to Anaconda
needs: [build_wheels]
if: github.repository == 'spacetelescope/synphot_refactor' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
steps:
- name: Download wheels
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: dist
pattern: additional-pylons-*
merge-multiple: true
- name: Pylons inspection
run: ls dist/*
- uses: OpenAstronomy/publish-wheels-anaconda@eae491141709933a7636af70b070e4a92d1a45be # main
with:
anaconda_user: STScI
anaconda_package: synphot
anaconda_token: ${{ secrets.anaconda_token }}
keep_n_latest: 5