diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e658c52a73..cfaaf48652 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,85 @@ on: # Weekly Monday 9AM build - cron: "0 9 * * 1" +env: + CRDS_SERVER_URL: https://jwst-crds.stsci.edu + CRDS_PATH: /tmp/crds_cache + CRDS_CLIENT_RETRY_COUNT: 3 + CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 + +jobs: + test: + name: ${{ matrix.toxenv }} (Python ${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + toxenv: [ test-xdist ] + python-version: [ '3.8', '3.9', '3.10', '3.11' ] + os: [ ubuntu-latest, macos-latest ] + include: + - toxenv: check-style + os: ubuntu-latest + python-version: '3.x' + - toxenv: check-security + os: ubuntu-latest + python-version: '3.x' + - toxenv: check-dependencies + os: ubuntu-latest + python-version: '3.x' + - toxenv: build-dist + os: ubuntu-latest + python-version: '3.x' + - toxenv: test-cov-xdist + os: ubuntu-latest + python-version: '3.11' + - toxenv: test-pyargs-xdist + os: ubuntu-latest + python-version: '3.11' + - toxenv: test-sdpdeps-xdist + os: ubuntu-latest + python-version: '3.9' + - toxenv: test-oldestdeps-xdist-cov + os: ubuntu-latest + python-version: '3.8' + - toxenv: test-opencv-xdist + os: ubuntu-latest + python-version: '3.10' + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: 'setup.cfg' + - if: ${{ contains(matrix.toxenv, 'test') && !contains(matrix.toxenv, 'opencv') }} + run: > + echo "pmap=$( + curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["jwst"], "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-context + - if: ${{ contains(matrix.toxenv, 'test') && !contains(matrix.toxenv, 'opencv') }} + run: echo "CRDS CONTEXT ${{ steps.crds-context.outputs.pmap }}" + - if: ${{ contains(matrix.toxenv, 'test') && !contains(matrix.toxenv, 'opencv') }} + uses: actions/cache@v3 + with: + path: ${{ env.CRDS_PATH }} + key: crds-${{ steps.crds-context.outputs.pmap }} + - run: pip install tox + - run: tox -e ${{ matrix.toxenv }} + - if: ${{ contains(matrix.toxenv, '-cov') }} + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unit + fail_ci_if_error: true +======= concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ci_cron.yml b/.github/workflows/ci_cron.yml index ee940474f4..66a2360828 100644 --- a/.github/workflows/ci_cron.yml +++ b/.github/workflows/ci_cron.yml @@ -17,12 +17,14 @@ jobs: steps: - id: 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-context + - run: echo "CRDS CONTEXT ${{ steps.crds-context.outputs.pmap }}" + - uses: actions/cache@v3 + with: + path: ${{ env.CRDS_PATH }} + key: crds-reffiles-${{ steps.crds-context.outputs.pmap }} + - run: pip install tox + - run: tox -e ${{ matrix.toxenv }} - id: path run: echo "path=${{ env.CRDS_PATH }}" >> $GITHUB_OUTPUT - id: server