Skip to content

Reusable github actions used for a python template project. Originally forked from microsoft/action-python project.

License

Notifications You must be signed in to change notification settings

altcoder/action-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

action-python

test reviewdog release GitHub release (latest SemVer) action-bumpr supported

This repo contains a action to run various Python tools including:

Input

inputs:
  black:
    description: |
      Run Black
      Default is false.
    default: false
  bandit:
    description: |
      Run Bandit
      Default is false.
    default: false
  pylint:
    description: |
      Run Pylint
      Default is false.
    default: false
  pyright:
    description: |
      Run Pyright
      Default is false.
    default: false
  flake8:
    description: |
      Run Flake8
      Default is false.
    default: false
  testing:
    description: |
      Run tests with PyTest
      Default is false.
    default: false
  publish:
    description: |
      Publish to PyPi
      Default is false
    default: false
  publish_url:
    description: |
      PyPi Target. Use this to point to private or test locations.      
      Default https://pypi.org
    default: 'https://pypi.org'
  github_token:
    description: 'GITHUB_TOKEN'
    default: '${{ github.token }}'
  workdir:
    description: 'Working directory relative to the root directory.'
    default: 'src'
  ### Flags for reviewdog ###
  level:
    description: 'Report level for reviewdog [info,warning,error]'
    default: 'error'
  reporter:
    description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
    default: 'github-pr-check'
  filter_mode:
    description: |
      Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
      Default is added.
    default: 'added'
  fail_on_error:
    description: |
      Exit code for reviewdog when errors are found [true,false]
      Default is `false`.
    default: 'false'
  reviewdog_flags:
    description: 'Additional reviewdog flags'
    default: ''
  toml:
    description: |
      pyproject.toml location.
      Default pyproject.toml
    default: 'pyproject.toml'
  pylint_rc:
    description: '.pylintrc configuration file'
    default: '.pylintrc'

Usage

name: Pull Request
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:

jobs:
  linting:
    runs-on: ubuntu-latest
    steps:
      - name: Black
        uses: altcoder/[email protected]
        with:
          python_tool: 'black'

      - name: Bandit
        uses: altcoder/[email protected]
        with:          
          python_tool: 'bandit'

      - name: Pylint
        uses: altcoder/[email protected]
        with:
          python_tool: 'pylint'
          
      - name: Pyright
        uses: altcoder/[email protected]
        with:          
          python_tool: 'pyright'
          
      - name: Flake8
        uses: altcoder/[email protected]
        with:          
          python_tool: 'flake8'

  testing:
    runs-on: ubuntu-latest
    steps:    
      - name: Pytest
        uses: altcoder/[email protected]
        with:          
          python_tool: 'pytest'

Development

Workflow

  1. Create branch or use release branch ex. '0.1.x'
  2. Apply code changes on branch
  3. Edit validation.yml and update the version to next version
  4. Pull request (all github checks should pass)
  5. Add label "bump:patch", "bump:minor" or "bump:major" to update release
  6. Rebase and merge

Release

You can bump version on merging Pull Requests with specific labels (bump:major,bump:minor,bump:patch). Pushing tag manually by yourself also work.

This action updates major/minor release tags on a tag push. e.g. Update v1 and v1.2 tag when released v1.2.3. ref: https://help.github.com/en/articles/about-actions#versioning-your-action

About

Reusable github actions used for a python template project. Originally forked from microsoft/action-python project.

Resources

License

Stars

Watchers

Forks

Packages