Skip to content

make tests more resilient to different environments #875

make tests more resilient to different environments

make tests more resilient to different environments #875

Workflow file for this run

name: CI
on:
## uncomment before merging to master once test suite is finalized
# push:
# branches:
# - master
# tags:
# - '*'
pull_request:
branches:
# - master
- pytest-migration #temp
jobs:
data:
name: retrieve current CRDS context
runs-on: ubuntu-latest
env:
OBSERVATORY: hst
CRDS_SERVER_URL: https://hst-crds.stsci.edu
CRDS_PATH: /tmp/crds-cache-default-test
outputs:
crds_path: ${{ steps.crds_path.outputs.path }}
crds_context: ${{ steps.crds_context.outputs.pmap }}
crds_server: ${{ steps.crds_server.outputs.url }}
steps:
- id: crds_context
run: >
echo "pmap=$(
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}"], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ |
python -c "import sys, json; print(json.load(sys.stdin)['result'])"
)" >> $GITHUB_OUTPUT
# Get default CRDS_CONTEXT without installing crds client
# See https://hst-crds.stsci.edu/static/users_guide/web_services.html#generic-request
- id: crds_path
run: echo "path=${{ env.CRDS_PATH }}" >> $GITHUB_OUTPUT
- id: crds_server
run: echo "url=${{ env.CRDS_SERVER_URL }}" >> $GITHUB_OUTPUT
pytest:
name: ${{ matrix.runs-on }} Python ${{ matrix.python-version }}
needs: [ data ]
runs-on: ${{ matrix.runs-on }}
env:
CRDS_SERVER_URL: ${{ needs.data.outputs.crds_server }}
CRDS_TEST_ROOT: /tmp
CRDS_CLIENT_RETRY_COUNT: 3
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20
LD_LIBRARY_PATH: /usr/local/lib
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
# - macos-latest # TEMP
python-version:
- 3.9
- '3.10'
- 3.11
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install fitsverify
run: |
wget --quiet --output-document - http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.49.tar.gz | tar -xz -C $HOME
cd $HOME/cfitsio-3.49
./configure --prefix=/usr/local --enable-reentrant --disable-curl
make shared
sudo make install
wget --quiet --output-document - https://heasarc.gsfc.nasa.gov/docs/software/ftools/fitsverify/fitsverify-4.20.tar.gz | tar -xz -C $HOME
cd $HOME/fitsverify-4.20
gcc -o fitsverify ftverify.c fvrf_data.c fvrf_file.c fvrf_head.c fvrf_key.c fvrf_misc.c -DSTANDALONE -lcfitsio
sudo cp fitsverify /usr/local/bin
- name: Install Python dependencies
run: |
pip install roman-datamodels
pip install git+https://github.com/spacetelescope/jwst
pip uninstall --yes crds
./install
pip install .[submission,test,docs,synphot]
- uses: actions/cache@v3
if: always()
with:
path: ${{ needs.data.outputs.crds_path }}
key: ${{ needs.data.outputs.crds_context }}
- run: ./setup_test_cache $CRDS_TEST_ROOT
- run: ./runtests --cover