Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 2.24 KB

README.md

File metadata and controls

76 lines (58 loc) · 2.24 KB

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 👏