Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build marked as failing. Tests are not running in CI. Github /actions/setup-python no longer supports Python 2.7. #262

Closed
JamesParrott opened this issue Jan 15, 2024 · 1 comment
Labels

Comments

@JamesParrott
Copy link
Collaborator

JamesParrott commented Jan 15, 2024

PyShp Version

All

Python Version

CI

Your code

The issue already occurs, due to PyShps's own CI code/config/setup. In particular the Github action file below:
https://github.com/GeospatialPython/pyshp/blob/master/.github/workflows/build.yml

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9"]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install pytest
        if [ -f requirements.test.txt ]; then pip install -r requirements.test.txt; fi
    - name: Test with doctest
      run: |
        python shapefile.py
    - name: Test with pytest
      run: |
        pytest

Full stacktrace

https://github.com/GeospatialPython/pyshp/actions

Other notes

In June 2023, Python 2 was dropped by /actions/setup-python actions/setup-python#672

A work around to run the action in a container, is suggested in the comments by tzortzispanagiotis (the proviso about localhost is not relevant to PyShp as it does not do any networking): actions/setup-python#672 (comment)

I'll investigate using that with the actions matrix.
Python 2 is no longer pre-installed in current Actions Runner Ubuntu images (19.04 having been dropped?).

https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md

@JamesParrott JamesParrott changed the title Build marked as failing. Tests are not running in CI. Github Actions no longer support Python 2.7. Build marked as failing. Tests are not running in CI. Github /actions/setup-python no longer supports Python 2.7. Jan 15, 2024
@JamesParrott
Copy link
Collaborator Author

The suggestion from tzortzispanagiotis works great with a matrix strategy, for PyShp.

Using this, the CI can be fixed, simply by replacing all the lines in the above file between:

jobs:
  build:

and

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip

(exclusive) with:

    strategy:
      fail-fast: false
      matrix:
        python-version: ["2.7.18", "3.6.15", "3.7.17", "3.8.18", "3.9.18", "3.10.13", "3.11.7", "3.12.1", "3.13.0a2"]

    runs-on: ubuntu-20.04
    container:
      image: python:${{ matrix.python-version }}-slim

    steps:
    - uses: actions/checkout@v3

I have tested this on my fork, but could only get a green tick for Python 2.7 as well, by disabling __geo_interface__, and all the tests for it, and for Pythons 3.10 upwards by relaxing the pinned version of Pytest, allowing Pip to pick the latest (and possibly by making other changes that don't spring to mine right now):

image

https://github.com/JamesParrott/IronPyShp/actions/runs/7534760731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant