Skip to content

Commit 6f123d7

Browse files
author
Sylvain MARIE
committed
Upgraded GHA workflow to enable python 3.5. removed useless nox session
1 parent 714fe1f commit 6f123d7

3 files changed

Lines changed: 62 additions & 41 deletions

File tree

.github/workflows/base.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/checkout@v4.1.1
2727

2828
- name: Install python 3.9
29-
uses: actions/setup-python@v5.0.0
29+
uses: actions/setup-python@v5.1.0
3030
with:
3131
python-version: 3.9
3232
architecture: x64
@@ -59,16 +59,33 @@ jobs:
5959
- name: Checkout
6060
uses: actions/checkout@v4.1.1
6161

62-
- name: Install python ${{ matrix.nox_session.python }} for tests
63-
if: ${{ ! contains(fromJson('["3.13"]'), matrix.nox_session.python ) }}
64-
uses: MatteoH2O1999/setup-python@v3.2.1 # actions/setup-python@v5.0.0
62+
# General case
63+
- name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.13)
64+
if: ${{ ! contains(fromJson('["3.5", "3.13"]'), matrix.nox_session.python ) }}
65+
uses: MatteoH2O1999/setup-python@v4 # actions/setup-python@v5.0.0
6566
id: set-py
6667
with:
6768
python-version: ${{ matrix.nox_session.python }}
6869
architecture: x64
6970
allow-build: info
7071
cache-build: true
7172

73+
# Particular case of issue with 3.5
74+
- name: Install python ${{ matrix.nox_session.python }} for tests (3.5)
75+
if: contains(fromJson('["3.5"]'), matrix.nox_session.python )
76+
uses: MatteoH2O1999/setup-python@v4 # actions/setup-python@v5.0.0
77+
id: set-py-35
78+
with:
79+
python-version: ${{ matrix.nox_session.python }}
80+
architecture: x64
81+
allow-build: info
82+
cache-build: true
83+
env:
84+
# workaround found in https://github.com/actions/setup-python/issues/866
85+
# for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5
86+
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
87+
88+
7289
- name: Install python ${{ matrix.nox_session.python }} for tests (3.13)
7390
if: contains(fromJson('["3.13"]'), matrix.nox_session.python )
7491
uses: actions/setup-python@v5
@@ -82,7 +99,7 @@ jobs:
8299
cache-build: true
83100

84101
- name: Install python 3.12 for nox
85-
uses: actions/setup-python@v5.0.0
102+
uses: actions/setup-python@v5.1.0
86103
with:
87104
python-version: 3.12
88105
architecture: x64
@@ -101,7 +118,7 @@ jobs:
101118
# Share ./docs/reports so that they can be deployed with doc in next job
102119
- name: Share reports with other jobs
103120
if: runner.os == 'Linux'
104-
uses: actions/upload-artifact@v4.3.0
121+
uses: actions/upload-artifact@v4.3.1
105122
with:
106123
name: reports_dir
107124
path: ./docs/reports
@@ -114,7 +131,7 @@ jobs:
114131
uses: actions/checkout@v4.1.1
115132

116133
- name: Install python 3.9 for nox
117-
uses: actions/setup-python@v5.0.0
134+
uses: actions/setup-python@v5.1.0
118135
with:
119136
python-version: 3.9
120137
architecture: x64
@@ -141,14 +158,14 @@ jobs:
141158
fetch-depth: 0 # so that gh-deploy works
142159

143160
- name: Install python 3.9 for nox
144-
uses: actions/setup-python@v5.0.0
161+
uses: actions/setup-python@v5.1.0
145162
with:
146163
python-version: 3.9
147164
architecture: x64
148165

149166
# 1) retrieve the reports generated previously
150167
- name: Retrieve reports
151-
uses: actions/download-artifact@v4.1.1
168+
uses: actions/download-artifact@v4.1.4
152169
with:
153170
name: reports_dir
154171
path: ./docs/reports
@@ -180,7 +197,7 @@ jobs:
180197
EOF
181198
- name: \[not on TAG\] Publish coverage report
182199
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads')
183-
uses: codecov/codecov-action@v4.0.1
200+
uses: codecov/codecov-action@v4.1.1
184201
with:
185202
files: ./docs/reports/coverage/coverage.xml
186203
- name: \[not on TAG\] Build wheel and sdist

noxfile.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# add parent folder to python path so that we can import noxfile_utils.py
1010
# note that you need to "pip install -r noxfile-requiterements.txt" for this file to work.
1111
sys.path.append(str(Path(__file__).parent / "ci_tools"))
12-
from nox_utils import (PY27, PY37, PY36, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file,
12+
from nox_utils import (PY27, PY37, PY36, PY35, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file,
1313
DONT_INSTALL) # noqa
1414

1515

@@ -61,6 +61,7 @@ class Folders:
6161
PY39: {"coverage": False, "pkg_specs": {"pip": ">19"}},
6262
PY38: {"coverage": False, "pkg_specs": {"pip": ">19"}},
6363
PY27: {"coverage": False, "pkg_specs": {"pip": ">10"}},
64+
PY35: {"coverage": False, "pkg_specs": {"pip": ">10"}},
6465
PY36: {"coverage": False, "pkg_specs": {"pip": ">19"}},
6566
# IMPORTANT: this should be last so that the folder docs/reports is not deleted afterwards
6667
PY37: {"coverage": True, "pkg_specs": {"pip": ">19"}}, # , "pytest-html": "1.9.0"
@@ -289,34 +290,34 @@ def release(session):
289290
"-d", f"https://{gh_org}.github.io/{gh_repo}/changelog", current_tag)
290291

291292

292-
@nox.session(python=False)
293-
def gha_list(session):
294-
"""(mandatory arg: <base_session_name>) Prints all sessions available for <base_session_name>, for GithubActions."""
295-
296-
# see https://stackoverflow.com/q/66747359/7262247
297-
298-
# The options
299-
parser = argparse.ArgumentParser()
300-
parser.add_argument("-s", "--session", help="The nox base session name")
301-
parser.add_argument(
302-
"-v",
303-
"--with_version",
304-
action="store_true",
305-
default=False,
306-
help="Return a list of lists where the first element is the python version and the second the nox session.",
307-
)
308-
additional_args = parser.parse_args(session.posargs)
309-
310-
# Now use --json CLI option
311-
out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True)
312-
sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)]
313-
314-
# TODO filter ?
315-
316-
# print the list so that it can be caught by GHA.
317-
# Note that json.dumps is optional since this is a list of string.
318-
# However it is to remind us that GHA expects a well-formatted json list of strings.
319-
print(json.dumps(sessions_list))
293+
# @nox.session(python=False)
294+
# def gha_list(session):
295+
# """(mandatory arg: <base_session_name>) Prints all sessions available for <base_session_name>, for GithubActions."""
296+
#
297+
# # see https://stackoverflow.com/q/66747359/7262247
298+
#
299+
# # The options
300+
# parser = argparse.ArgumentParser()
301+
# parser.add_argument("-s", "--session", help="The nox base session name")
302+
# parser.add_argument(
303+
# "-v",
304+
# "--with_version",
305+
# action="store_true",
306+
# default=False,
307+
# help="Return a list of lists where the first element is the python version and the second the nox session.",
308+
# )
309+
# additional_args = parser.parse_args(session.posargs)
310+
#
311+
# # Now use --json CLI option
312+
# out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True)
313+
# sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)]
314+
#
315+
# # TODO filter ?
316+
#
317+
# # print the list so that it can be caught by GHA.
318+
# # Note that json.dumps is optional since this is a list of string.
319+
# # However it is to remind us that GHA expects a well-formatted json list of strings.
320+
# print(json.dumps(sessions_list))
320321

321322

322323
# if __name__ == '__main__':

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@
3434
"write_to": "src/makefun/_version.py",
3535
}
3636
# Use the 'version_file_template' directive if possible to avoid type hints and annotations (python <3.8)
37-
from packaging.version import Version
3837
setuptools_scm_version = pkg_resources.get_distribution("setuptools_scm").version
39-
if Version(setuptools_scm_version) >= Version('6'):
38+
# for some reason importing packaging.version.Version here fails on python 3.5
39+
# from packaging.version import Version
40+
# if Version(setuptools_scm_version) >= Version('6'):
41+
setuptools_scm_version_major = int(setuptools_scm_version.split(".")[0])
42+
if setuptools_scm_version_major >= 6:
4043
# template_arg_name = "version_file_template" if Version(setuptools_scm_version) >= Version('8.1') else "write_to_template"
4144
# print(Version(setuptools_scm_version))
4245
# print(template_arg_name)

0 commit comments

Comments
 (0)