|
4 | 4 | pull_request: |
5 | 5 | branches: |
6 | 6 | - main |
7 | | - - '*x' |
8 | | - # We also want this workflow triggered if the 'run devdeps tests' label is added |
9 | | - # or present when PR is updated |
| 7 | + - 'release/*.x' |
10 | 8 | types: |
| 9 | + - opened |
11 | 10 | - synchronize |
| 11 | + - reopened |
| 12 | + - ready_for_review |
12 | 13 | - labeled |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - main |
| 17 | + - 'release/*.x' |
| 18 | + tags: |
| 19 | + - '*' |
13 | 20 | schedule: |
14 | | - # Weekly Monday 6AM build |
15 | | - - cron: "0 0 * * 1" |
| 21 | + - cron: "0 0 * * 1" # every Monday at 6a |
16 | 22 | workflow_dispatch: |
17 | 23 | inputs: |
18 | 24 | crds_context: |
|
27 | 33 | default: https://jwst-crds.stsci.edu |
28 | 34 |
|
29 | 35 | concurrency: |
30 | | - group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.crds_context }} |
| 36 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.crds_context }} |
31 | 37 | cancel-in-progress: true |
32 | 38 |
|
| 39 | +permissions: {} |
| 40 | + |
| 41 | +env: |
| 42 | + PYTHON_VERSIONS: 3.9 3.10 3.11 3.12 3.13 3.14 |
| 43 | + CRDS_PATH: /tmp/data/crds_cache |
| 44 | + CRDS_OBSERVATORY: jwst |
| 45 | + CRDS_SERVER_URL: ${{ inputs.crds_server || 'https://jwst-crds.stsci.edu' }} |
| 46 | + CRDS_CLIENT_RETRY_COUNT: 3 |
| 47 | + CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 |
| 48 | + |
33 | 49 | jobs: |
34 | | - latest_crds_contexts: |
| 50 | + supported-pythons: |
35 | 51 | if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run extra tests'))) |
36 | | - uses: ./.github/workflows/contexts.yml |
37 | | - crds_context: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 55 | + with: |
| 56 | + persist-credentials: false |
| 57 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 58 | + with: |
| 59 | + python-version: "3" |
| 60 | + - run: pip install packaging tomli |
| 61 | + - name: convert Python version(s) into JSON list |
| 62 | + id: versions |
| 63 | + shell: python |
| 64 | + run: | |
| 65 | + import os |
| 66 | + import json |
| 67 | +
|
| 68 | + import tomli |
| 69 | + from packaging.specifiers import SpecifierSet |
| 70 | + from packaging.version import Version |
| 71 | +
|
| 72 | + with open("pyproject.toml", "rb") as pyproject_toml_file: |
| 73 | + version_requirements = SpecifierSet(tomli.load(pyproject_toml_file)["project"]["requires-python"]) |
| 74 | +
|
| 75 | + versions = [str(version) for version in sorted([Version(version) for version in os.environ["PYTHON_VERSIONS"].split() if version in version_requirements])] |
| 76 | +
|
| 77 | + with open(os.environ["GITHUB_OUTPUT"], "a") as github_output: |
| 78 | + print(f"json={json.dumps(versions)}", file=github_output) |
| 79 | + print(f"oldest={versions[0]}", file=github_output) |
| 80 | + print(f"latest={versions[-1]}", file=github_output) |
| 81 | + outputs: |
| 82 | + python-version-json: ${{ steps.versions.outputs.json }} |
| 83 | + oldest: ${{ steps.versions.outputs.oldest }} |
| 84 | + latest: ${{ steps.versions.outputs.latest }} |
| 85 | + crds: |
38 | 86 | if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run extra tests'))) |
39 | | - needs: [ latest_crds_contexts ] |
40 | 87 | runs-on: ubuntu-latest |
41 | 88 | steps: |
42 | | - - id: context |
43 | | - run: echo context=${{ github.event_name == 'workflow_dispatch' && (inputs.crds_context != '' && inputs.crds_context || needs.latest_crds_contexts.outputs.jwst) || needs.latest_crds_contexts.outputs.jwst }} >> $GITHUB_OUTPUT |
| 89 | + - if: inputs.crds_context |
| 90 | + id: latest-context |
| 91 | + run: > |
| 92 | + echo latest-context=$( |
| 93 | + curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.CRDS_OBSERVATORY }}", "latest"], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ --retry 8 --connect-timeout 10 | |
| 94 | + python -c "import sys, json; print(json.load(sys.stdin)['result'])" |
| 95 | + ) >> $GITHUB_OUTPUT |
44 | 96 | outputs: |
45 | | - context: ${{ steps.context.outputs.context }} |
| 97 | + path: ${{ env.CRDS_PATH }} |
| 98 | + server-url: ${{ env.CRDS_SERVER_URL }} |
| 99 | + context: ${{ inputs.crds_context || steps.latest-context.outputs.latest-context }} |
| 100 | + client-retry-count: ${{ env.CRDS_CLIENT_RETRY_COUNT }} |
| 101 | + client-retry-delay-seconds: ${{ env.CRDS_CLIENT_RETRY_DELAY_SECONDS }} |
46 | 102 | test: |
47 | 103 | if: (github.repository == 'spacetelescope/jwst' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run extra tests'))) |
48 | | - uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@2835f0cacddf3f8de198db9afdb5354a5cebe0ef # v2.6.3 |
49 | | - needs: [ crds_context ] |
| 104 | + needs: |
| 105 | + - supported-pythons |
| 106 | + - crds |
| 107 | + uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@4193751d511425d4edc1d5657c24b2128d49b017 # v2.6.4 |
50 | 108 | with: |
51 | 109 | setenv: | |
52 | | - CRDS_PATH: /tmp/crds_cache |
53 | | - CRDS_SERVER_URL: ${{ github.event_name == 'workflow_dispatch' && inputs.crds_server || 'https://jwst-crds.stsci.edu' }} |
54 | | - CRDS_CONTEXT: ${{ needs.crds_context.outputs.context }} |
55 | | - CRDS_CLIENT_RETRY_COUNT: 3 |
56 | | - CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 |
57 | | - cache-path: /tmp/crds_cache |
58 | | - cache-key: crds-${{ needs.crds_context.outputs.context }} |
59 | | - artifact-path: | |
60 | | - results.xml |
| 110 | + CRDS_PATH: ${{ needs.crds.outputs.path }} |
| 111 | + CRDS_SERVER_URL: ${{ needs.crds.outputs.server-url }} |
| 112 | + CRDS_CONTEXT: ${{ needs.crds.outputs.context }} |
| 113 | + CRDS_CLIENT_RETRY_COUNT: ${{ needs.crds.outputs.client-retry-count }} |
| 114 | + CRDS_CLIENT_RETRY_DELAY_SECONDS: ${{ needs.crds.outputs.client-retry-delay-seconds}} |
| 115 | + cache-path: ${{ needs.crds.outputs.path }} |
| 116 | + cache-key: crds-${{ needs.crds.outputs.context }} |
61 | 117 | envs: | |
62 | 118 | - linux: check-docs-links |
63 | | - python-version: '3.13' |
64 | | - - macos: py311-xdist |
65 | | - pytest-results-summary: true |
66 | | - - macos: py312-xdist |
67 | | - pytest-results-summary: true |
68 | | - - linux: py314-stdevdeps-xdist |
69 | | - pytest-results-summary: true |
70 | | - - macos: py313-stdevdeps-xdist |
71 | | - pytest-results-summary: true |
72 | | - - linux: py314-devdeps-xdist |
73 | | - pytest-results-summary: true |
74 | | - - macos: py313-devdeps-xdist |
75 | | - pytest-results-summary: true |
| 119 | + python-version: ${{ needs.supported-pythons.outputs.latest }} |
| 120 | + - linux: py3-stdevdeps-xdist |
| 121 | + - linux: py3-devdeps-xdist |
| 122 | + - macos: py3-stdevdeps-xdist |
| 123 | + - macos: py3-devdeps-xdist |
| 124 | + fill: true |
| 125 | + fill_platforms: macos |
| 126 | + fill_factors: xdist |
| 127 | + artifact-path: | |
| 128 | + results.xml |
0 commit comments