From d072da0c0d3083db6b154ffc064b789cedfdb301 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 18 Nov 2021 18:05:01 -0600 Subject: [PATCH] ci: Quote GitHub Action python-version number as YAML strings (#1707) * 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. --- .github/workflows/ci.yml | 20 +++++++++---------- .github/workflows/dependencies-head.yml | 10 +++++----- .github/workflows/docs.yml | 2 +- .github/workflows/lint.yml | 2 +- .../workflows/lower-bound-requirements.yml | 2 +- .github/workflows/notebooks.yml | 2 +- .github/workflows/publish-package.yml | 2 +- .github/workflows/release_tests.yml | 4 ++-- .github/workflows/tag.yml | 2 +- 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3daa327055..da649092d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/dependencies-head.yml b/.github/workflows/dependencies-head.yml index 2667f6667b..195b51aacf 100644 --- a/.github/workflows/dependencies-head.yml +++ b/.github/workflows/dependencies-head.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 @@ -39,7 +39,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 @@ -69,7 +69,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 @@ -95,7 +95,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 @@ -120,7 +120,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6dd830849a..a8e007c22c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1da95a37e9..8e8d92f624 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/lower-bound-requirements.yml b/.github/workflows/lower-bound-requirements.yml index a24995be9a..48f610f3a2 100644 --- a/.github/workflows/lower-bound-requirements.yml +++ b/.github/workflows/lower-bound-requirements.yml @@ -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 diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index a819e19d7c..112efbd530 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: ['3.9'] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 22172d487c..2850dc7498 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -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: | diff --git a/.github/workflows/release_tests.yml b/.github/workflows/release_tests.yml index 31f6998e5c..8d72b217de 100644 --- a/.github/workflows/release_tests.yml +++ b/.github/workflows/release_tests.yml @@ -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 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index f1fc911ce9..7ba54091d4 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -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