Skip to content

Commit

Permalink
Rework python-versions logic
Browse files Browse the repository at this point in the history
I can't find a simple way to pass around the multi-line inputs needed
by setup-python. This is a bit ugly but clear, at least.
  • Loading branch information
ajjackson committed Dec 18, 2024
1 parent 0151812 commit 12a6cdd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,20 @@ jobs:
config:
- os: ubuntu-latest
if: true
python-versions: ${{(github.event_name == 'workflow_dispatch') && '3.10%0A3.11%0A3.12' || '3.10%0A3.12'}}
all-python-versions: ${{(github.event_name == 'workflow_dispatch')}}
tox-skip-env: ${{((github.event_name == 'workflow_dispatch') && '' || '.*?(py311).*?')}}
coverage: true
- os: windows-latest
if: true
python-versions: ${{(github.event_name == 'workflow_dispatch') && '3.10%0A3.11%0A3.12' || '3.10%0A3.12'}}
tox-skip-env: ${{((github.event_name == 'workflow_dispatch') && '' || '.*?(py311).*?')}}
all-python-versions: ${{(github.event_name == 'workflow_dispatch')}}
coverage: false
- os: macos-latest
if: true
python-versions: ${{ (github.event_name == 'workflow_dispatch') && '3.10%0A3.11%0A3.12' || '3.10%0A3.12' }}
tox-skip-env: ${{((github.event_name == 'workflow_dispatch') && '' || '.*?(py311).*?')}}
all-python-versions: ${{(github.event_name == 'workflow_dispatch')}}
coverage: false
- os: macos-13
if: ${{ github.event_name == 'workflow_dispatch' }}
python-versions: ['3.10', '3.11', '3.12']
tox-skip-env: ''
all-python-versions: true
coverage: false

fail-fast: false
Expand Down
32 changes: 20 additions & 12 deletions .github/workflows/test_checkout_one_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@ on:
required: false
default: ubuntu-latest
type: string
python-versions:
description: 'Python versions'
all-python-versions:
description: 'Test all Python versions'
required: false
default: '[''3.10'', ''3.11'', ''3.12'']'
type: string
tox-skip-env:
description: 'Regex for skipped tests'
required: false
default: ''
type: string
default: false
type: boolean
coverage:
description: 'Publish coverage'
required: false
Expand All @@ -37,9 +32,22 @@ jobs:
with:
fetch-depth: 0 # Ensure tags are fetched for versioning
fetch-tags: true
- uses: actions/setup-python@v5
- name: Setup all supported Python versions
uses: actions/setup-python@v5
if: ${{ inputs.all-python-versions }}
with:
python-version: |
3.10
3.11
3.12
- name: Setup min/max Python versions
uses: actions/setup-python@v5
if: ${{ ! inputs.all-python-versions }}
with:
python-version: ${{ inputs.python-versions }}
python-version: |
3.10
3.12
- name: Install llvm on MacOS
if: startsWith(${{ inputs.os }}, 'macos')
shell: bash -l {0}
Expand Down Expand Up @@ -78,7 +86,7 @@ jobs:
- name: Run tests
env:
TOX_SKIP_ENV: ${{ inputs.tox-skip-env }}
TOX_SKIP_ENV: ${{ inputs.all-python-versions && '' || '.*?(py311).*?' }}
shell: bash -l {0}
run: python -m tox run-parallel

Expand Down

0 comments on commit 12a6cdd

Please sign in to comment.