Skip to content

Kwtool ci

Kwtool ci #1473

Workflow file for this run

name: test
on:
push:
branches:
- main
- '*.x'
tags:
- '*'
pull_request:
schedule:
# Weekly Monday 9AM build
# * is a special character in YAML so you have to quote this string
- cron: '0 9 * * 1'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
data:
name: retrieve current CRDS context
runs-on: ubuntu-latest
env:
OBSERVATORY: jwst
CRDS_PATH: /tmp/crds_cache
CRDS_SERVER_URL: https://jwst-crds.stsci.edu
steps:
- id: crds_context
run: >
echo "pmap=$(
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}", null], "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
outputs:
crds_context: ${{ steps.crds_context.outputs.pmap }}
crds_path: ${{ steps.crds_path.outputs.path }}
crds_server: ${{ steps.crds_server.outputs.url }}
check:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@924441154cf3053034c6513d5e06c69d262fb9a6 # v1.13.0
with:
envs: |
- linux: check-style
- linux: check-security
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@924441154cf3053034c6513d5e06c69d262fb9a6 # v1.13.0
needs: [ data ]
with:
setenv: |
CRDS_PATH: ${{ needs.data.outputs.crds_path }}
CRDS_SERVER_URL: ${{ needs.data.outputs.crds_server }}
CRDS_CLIENT_RETRY_COUNT: 3
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20
cache-path: ${{ needs.data.outputs.crds_path }}
cache-key: crds-${{ needs.data.outputs.crds_context }}
envs: |
- linux: py310-xdist
- macos: py311-xdist
- linux: py311-cov-xdist
coverage: codecov
- linux: py312-xdist
test_downstream:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@924441154cf3053034c6513d5e06c69d262fb9a6 # v1.13.0
needs: [ data ]
with:
setenv: |
CRDS_PATH: ${{ needs.data.outputs.crds_path }}
CRDS_SERVER_URL: ${{ needs.data.outputs.crds_server }}
CRDS_CLIENT_RETRY_COUNT: 3
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20
cache-path: ${{ needs.data.outputs.crds_path }}
cache-key: crds-${{ needs.data.outputs.crds_context }}
envs: |
- linux: py311-jwst-cov-xdist
test_keyword_dictionary:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: 3
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
- run: git checkout ${{ github.event.pull_request.base.sha }}
- run: pip install -e ".[test]"
- run: python -c "from stdatamodels.jwst._kwtool._tests.test_against_mast import dump_keyword_dictionary; dump_keyword_dictionary('jwstkd')"
- run: python -m stdatamodels.jwst._kwtool jwstkd -o main.html
- run: git checkout ${{ github.sha }}
- run: python -m stdatamodels.jwst._kwtool jwstkd -o pr.html
- run: diff main.html pr.html >> $GITHUB_STEP_SUMMARY