Skip to content

Export JPG with AVM (WCS metadata) #13514

Export JPG with AVM (WCS metadata)

Export JPG with AVM (WCS metadata) #13514

Workflow file for this run

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
if: github.repository == 'spacetelescope/jdaviz'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a # v5.6.0
with:
python-version: '3.12'
- name: Build pytestargs from labels
id: build-pytestargs
run: |
pytestargs=""
# Add --skip-remote-failures if 'skip-remote-failures' label is present
if ${{ contains(github.event.pull_request.labels.*.name, 'skip-remote-failures') }}; then
pytestargs="--skip-remote-failures"
fi
# Export as step output so later steps can reference it.
echo "pytestargs=$pytestargs" >> $GITHUB_OUTPUT
- name: Install python-build and twine
run: python -m pip install build "twine>=3.3" "importlib_metadata!=8.0.0"
- 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: Get components for cache key
id: date
run: |
echo "year=$(date +'%Y')" >> $GITHUB_OUTPUT
echo "week=$(date +'%V')" >> $GITHUB_OUTPUT
echo "day=$(date +'%j')" >> $GITHUB_OUTPUT
- name: Restore MAST cache
id: cache-restore
uses: actions/cache/restore@v5
with:
path: ./
key: use-restore-keys-below-to-match-in-priority-order
restore-keys: |
mast-cache-${{ steps.date.outputs.year }}-${{ steps.date.outputs.week }}-${{ steps.date.outputs.day }}-
mast-cache-${{ steps.date.outputs.year }}-${{ steps.date.outputs.week }}-
mast-cache-${{ steps.date.outputs.year }}-
mast-cache-
- name: Move cache to working directory
run: |
# Check if any fits files exist and move them to the working directory
if ls ./*.fits 1> /dev/null 2>&1; then
mv ./*.fits "/home/runner/work/jdaviz/"
echo "Files in working directory:"
ls -la "/home/runner/work/jdaviz/"*.fits
else
echo "No .fits files found in cache - tests will download files as needed"
fi
- name: Test package
run: |
cd ..
echo "pytest args ${{ steps.build-pytestargs.outputs.pytestargs }}"
python -m venv testenv
testenv/bin/pip install pytest pytest-astropy pytest-tornasync pytest-xdist jdaviz/dist/*.whl
testenv/bin/pytest -p no:warnings -n auto --dist load --astropy-header --remote-data ${{ steps.build-pytestargs.outputs.pytestargs }} --pyargs jdaviz
# NOTE: Do not run this part for PR testing.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
if: github.event_name != 'pull_request'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}