Skip to content

Commit

Permalink
Fixed GHA py3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain MARIE committed Sep 26, 2024
1 parent 1a7e883 commit 19e5a7c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/[email protected]

- name: Install python 3.9
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.1.0
with:
python-version: 3.9
architecture: x64
Expand Down Expand Up @@ -59,17 +59,33 @@ jobs:
- name: Checkout
uses: actions/[email protected]

- name: Install python ${{ matrix.nox_session.python }} for tests
# If one version fails, uncomment this one and the next step. For example here 3.13.
if: ${{ ! contains(fromJson('["3.13"]'), matrix.nox_session.python ) }}
uses: MatteoH2O1999/setup-python@v3.2.1 # actions/[email protected]
# General case
- name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.13)
if: ${{ ! contains(fromJson('["3.5", "3.13"]'), matrix.nox_session.python ) }}
uses: MatteoH2O1999/setup-python@v4 # actions/[email protected]
id: set-py
with:
python-version: ${{ matrix.nox_session.python }}
architecture: x64
allow-build: info
cache-build: true

# Particular case of issue with 3.5
- name: Install python ${{ matrix.nox_session.python }} for tests (3.5)
if: contains(fromJson('["3.5"]'), matrix.nox_session.python )
uses: MatteoH2O1999/setup-python@v4 # actions/[email protected]
id: set-py-35
with:
python-version: ${{ matrix.nox_session.python }}
architecture: x64
allow-build: info
cache-build: true
env:
# workaround found in https://github.com/actions/setup-python/issues/866
# for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"


- name: Install python ${{ matrix.nox_session.python }} for tests (3.13)
if: contains(fromJson('["3.13"]'), matrix.nox_session.python )
uses: actions/setup-python@v5
Expand All @@ -83,7 +99,7 @@ jobs:
cache-build: true

- name: Install python 3.12 for nox
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.1.0
with:
python-version: 3.12
architecture: x64
Expand All @@ -102,7 +118,7 @@ jobs:
# Share ./docs/reports so that they can be deployed with doc in next job
- name: Share reports with other jobs
if: runner.os == 'Linux'
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
name: reports_dir
path: ./docs/reports
Expand All @@ -115,7 +131,7 @@ jobs:
uses: actions/[email protected]

- name: Install python 3.9 for nox
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.1.0
with:
python-version: 3.9
architecture: x64
Expand All @@ -142,14 +158,14 @@ jobs:
fetch-depth: 0 # so that gh-deploy works

- name: Install python 3.9 for nox
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.1.0
with:
python-version: 3.9
architecture: x64

# 1) retrieve the reports generated previously
- name: Retrieve reports
uses: actions/[email protected].1
uses: actions/[email protected].4
with:
name: reports_dir
path: ./docs/reports
Expand Down Expand Up @@ -181,7 +197,7 @@ jobs:
EOF
- name: \[not on TAG\] Publish coverage report
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads')
uses: codecov/codecov-action@v4.0.1
uses: codecov/codecov-action@v4.1.1
with:
files: ./docs/reports/coverage/coverage.xml
- name: \[not on TAG\] Build wheel and sdist
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
"write_to": "src/pytest_harvest/_version.py",
}
# Use the 'version_file_template' directive if possible to avoid type hints and annotations (python <3.8)
from packaging.version import Version
setuptools_scm_version = pkg_resources.get_distribution("setuptools_scm").version
if Version(setuptools_scm_version) >= Version('6'):
# for some reason importing packaging.version.Version here fails on python 3.5
# from packaging.version import Version
# if Version(setuptools_scm_version) >= Version('6'):
setuptools_scm_version_major = int(setuptools_scm_version.split(".")[0])
if setuptools_scm_version_major >= 6:
# template_arg_name = "version_file_template" if Version(setuptools_scm_version) >= Version('8.1') else "write_to_template"
# print(Version(setuptools_scm_version))
# print(template_arg_name)
Expand Down

0 comments on commit 19e5a7c

Please sign in to comment.