From 19e5a7cc91747f9be1a8d344467e46c89840e6f6 Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 27 Sep 2024 00:14:56 +0200 Subject: [PATCH] Fixed GHA py3.5 --- .github/workflows/base.yml | 38 +++++++++++++++++++++++++++----------- setup.py | 7 +++++-- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 186b808..453489e 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v4.1.1 - 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 @@ -59,10 +59,10 @@ jobs: - name: Checkout uses: actions/checkout@v4.1.1 - - 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/setup-python@v5.0.0 + # 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/setup-python@v5.0.0 id: set-py with: python-version: ${{ matrix.nox_session.python }} @@ -70,6 +70,22 @@ jobs: 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/setup-python@v5.0.0 + 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 @@ -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 @@ -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/upload-artifact@v4.3.0 + uses: actions/upload-artifact@v4.3.1 with: name: reports_dir path: ./docs/reports @@ -115,7 +131,7 @@ jobs: uses: actions/checkout@v4.1.1 - 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 @@ -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/download-artifact@v4.1.1 + uses: actions/download-artifact@v4.1.4 with: name: reports_dir path: ./docs/reports @@ -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 diff --git a/setup.py b/setup.py index 29daecc..acec745 100644 --- a/setup.py +++ b/setup.py @@ -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)