Skip to content

need to drop out pre-release pythons too. #23

need to drop out pre-release pythons too.

need to drop out pre-release pythons too. #23

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
permissions:
contents: read
jobs:
pythons:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.set-pythons.outputs.pythons }}
steps:
- id: set-pythons
run: |
data=`curl -s --url "https://raw.githubusercontent.com/python/devguide/refs/heads/main/include/release-cycle.json"`
pythonarray=`echo ${data} | jq '.[] | select((.status!="end-of-life") and (.status!="prerelease")) | select(.branch | startswith("3.")) | .branch' | jq -s -c`
echo "pythons=${pythonarray}" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs: pythons
strategy:
matrix:
python-version: ${{ fromJson(needs.pythons.outputs.versions) }}
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
timeout-minutes: 3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
poetry --version
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest --version