Coder Social home page Coder Social logo

latest-python-versions's Introduction

release tests

Latest Python Versions

This action will fetch up-to-date data on the latest Python versions available on Github Actions.

If you're already running tests on multiple Python versions, this action will allow you to replace your static matrix definitions with dynamic ones. With a dynamic version matrix definition, you will for example always be on the latest pre-release of the next upcoming Python release.

The Python versions are fetched from here - the official Github action version manifest.

Usage

To use the action, simply throw this into one of your workflows

- uses: snok/latest-python-versions@v1
  id: get-python-versions
  with:
    min-version: 3.7
    max-version: 3.10  # not required - defaults to latest
    include-prereleases: true  # not required - defaults to false

The action produces an output that can be accessed using:

${{ steps.get-python-versions.outputs.latest-python-versions }}

See examples below for recommended usage.

Example

name: Test

on: pull_request

jobs:
  linting:
    ...

  # Define the job to run before your matrix job
  get-python-versions:
    runs-on: ubuntu-latest
    outputs:
      python-matrix: ${{ steps.get-python-versions-action.outputs.latest-python-versions }}
    steps:
    - uses: snok/latest-python-versions@v1
      id: get-python-versions-action
      with:
        min-version: 3.8
        include-prereleases: true

  # Then use the output from the previous job in the matrix definition
  test:
    needs: [linting, get-python-versions]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
    steps:
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

Contributing

Contributions are always welcome ๐Ÿ‘

latest-python-versions's People

Contributors

carterbox avatar samamorgan avatar sondrelg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

latest-python-versions's Issues

Feature Proposal: Limit minimum python version by EOL date

I would like to make the min-version argument optional by using the end of life dates to determine which python versions are no longer supported. Does this feature make sense and would you be interested in accepting a PR? For example:

yaml

- uses: snok/latest-python-versions@v1
  id: get-python-versions
  with:
    min-version: EOL
    max-version: latest
    include-prereleases: false

Would return [3.7, 3.8, 3.9, 3.10] because pythons less than 3.7 are already EOL. The end of life dates could be pulled from endoflife.date/api/python.json

Handling different OSes

It seems like github does not provide all python versions on all OSes. For example, currently the version-manifest only has 3.9.15 for linux.

As a result, I'm having trouble mixing latest-python-versions with an OS matrix. Is there a known solution to this? Here is the relevant section of my workflow:

  get-python-versions:
    runs-on: ubuntu-latest
    outputs:
      python-matrix: ${{ steps.get-python-versions-action.outputs.latest-python-versions }}
    steps:
    - uses: snok/[email protected]
      id: get-python-versions-action
      with:
        min-version: 3.9
        include-prereleases: true

  test:
    needs: [lint, get-python-versions]
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]
    steps:
    - uses: actions/checkout@v3

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/[email protected]
      with:
        python-version: ${{ matrix.python-version }}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.