Skip to content

Commit

Permalink
ci: Quote GitHub Action python-version number as YAML strings (#1707)
Browse files Browse the repository at this point in the history
* Quote all python-version numbers in CI. This is done as a preventive
action to set a YAML string precedence for when Python 3.10 is added
to testing, as without quotes YAML will treat `3.10` as a float and 
interpret it as `3.1`.
* Simplify the inclusion of the latest Python version on macos-latest
by using the `include` keyword in the CI strategy matrix to add it
instead of excluding all Python versions to not test.
  • Loading branch information
matthewfeickert authored Nov 19, 2021
1 parent 9f9a6b4 commit d072da0
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 24 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ jobs:
|| (github.event_name == 'push' && github.ref != 'refs/heads/master' && contains(github.event.head_commit.message, '[ci all]'))
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
exclude:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9']
include:
- os: macos-latest
python-version: 3.7
- os: macos-latest
python-version: 3.8
python-version: '3.9'

steps:
- uses: actions/checkout@v2
Expand All @@ -50,7 +48,7 @@ jobs:
pytest -r sx --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
- name: Report core project coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == 3.9 && matrix.os == 'ubuntu-latest'
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
Expand All @@ -61,24 +59,24 @@ jobs:
pytest -r sx tests/contrib --mpl --mpl-baseline-path tests/contrib/baseline
- name: Report contrib coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == 3.9 && matrix.os == 'ubuntu-latest'
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: contrib

- name: Test docstring examples with doctest
if: matrix.python-version == 3.9
if: matrix.python-version == '3.9'
run: pytest -r sx src/ README.rst

- name: Report doctest coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == 3.9 && matrix.os == 'ubuntu-latest'
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: doctest

- name: Run benchmarks
if: github.event_name == 'schedule' && matrix.python-version == 3.9
if: github.event_name == 'schedule' && matrix.python-version == '3.9'
run: |
pytest -r sx --benchmark-sort=mean tests/benchmarks/test_benchmark.py
10 changes: 5 additions & 5 deletions .github/workflows/dependencies-head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -95,7 +95,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -120,7 +120,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lower-bound-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# minimum supported Python
python-version: [3.7]
python-version: ['3.7']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'

- name: Install python-build, check-manifest, and twine
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9']
include:
- os: macos-latest
python-version: 3.9
python-version: '3.9'

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'
- name: Install bump2version
run: |
python -m pip install --upgrade pip setuptools wheel
Expand Down

0 comments on commit d072da0

Please sign in to comment.