Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
9b0997b
Add check_analyzers as a trial balloon
dixonjoel Sep 11, 2025
156d9b4
Fix project-directory inputs, change name of .yml file. Update instal…
dixonjoel Sep 12, 2025
2c82d44
Rename to analyze-project.yml and 'extras'
dixonjoel Sep 16, 2025
0469952
Remove bandit checks. Will be covered by ni-python-styleguide soon
dixonjoel Sep 16, 2025
5b8eb04
Switch to a composite action
dixonjoel Sep 18, 2025
4063db7
Add test for analyze-project
dixonjoel Sep 18, 2025
7e94081
Create project to analyze
dixonjoel Sep 18, 2025
02918c9
Add shell specification for actions
dixonjoel Sep 18, 2025
dffb6d2
Attempt to fix the project directory for analyze test
dixonjoel Sep 18, 2025
0818b7e
Attempt to fix the project directory for analyze test
dixonjoel Sep 18, 2025
02b50cc
Produce poetry.lock before analyzing
dixonjoel Sep 18, 2025
7746abc
Add dependency on ni-python-styleguide
dixonjoel Sep 18, 2025
0b967dc
Use a compatible Python version
dixonjoel Sep 18, 2025
6afd6b7
Use matrix Python version
dixonjoel Sep 18, 2025
f5abcf7
Another attempt at the correct python version
dixonjoel Sep 18, 2025
47f2905
Tenth time is the charm
dixonjoel Sep 18, 2025
f9ab523
Eleventh time is the charm
dixonjoel Sep 18, 2025
82c74e6
Twelfth time is the charm
dixonjoel Sep 18, 2025
5311b24
Thirteenth time is the charm
dixonjoel Sep 18, 2025
078cfb7
Try try again
dixonjoel Sep 18, 2025
bf0613b
Try try again
dixonjoel Sep 18, 2025
bec5db6
Add docstrings to .py files
dixonjoel Sep 18, 2025
6cee457
Try try again
dixonjoel Sep 18, 2025
afe9eec
Whee! Let's try Python
dixonjoel Sep 18, 2025
46f076e
Add mypy dependency
dixonjoel Sep 18, 2025
f2711b7
Further restrict the Python version for mypy to work
dixonjoel Sep 18, 2025
84271e0
Show pyproject.toml after the addition of deps
dixonjoel Sep 18, 2025
b0f22e5
Attempt to use a template project for testing
dixonjoel Sep 18, 2025
7ce8147
Add mypy section
dixonjoel Sep 18, 2025
e3a29bb
Add pyright dependencies
dixonjoel Sep 18, 2025
6c724cf
Update poetry .lock
dixonjoel Sep 18, 2025
4b06b0e
Try different working directory
dixonjoel Sep 18, 2025
fffe019
Try original working directory
dixonjoel Sep 18, 2025
5671259
Attempt to make it work on Windows
dixonjoel Sep 18, 2025
b23c4a2
Test more Python versions
dixonjoel Sep 18, 2025
d2db7bd
Make mypy and pyright optional.
dixonjoel Sep 18, 2025
c379517
fix yml syntax
dixonjoel Sep 18, 2025
101fbf5
Indent python code
dixonjoel Sep 18, 2025
901871a
Check the outputs
dixonjoel Sep 18, 2025
c1db319
Check packages after install
dixonjoel Sep 18, 2025
938f8ba
Use GITHUB_OUTPUT
dixonjoel Sep 18, 2025
9ef16d9
Move minimal test project under .github to hide it
dixonjoel Sep 22, 2025
4faa1d0
Simplify Add virtualenv to the path for pyright-action
dixonjoel Sep 22, 2025
21cdaf6
Merge remote-tracking branch 'origin/main' into users/jdixon/add-comm…
dixonjoel Sep 22, 2025
0020788
Various PR feedback
dixonjoel Sep 22, 2025
07d9779
Merge remote-tracking branch 'origin/main' into users/jdixon/add-comm…
dixonjoel Sep 22, 2025
2648d0c
Use poetry env info --path to get the venv path
dixonjoel Sep 22, 2025
4579668
Add -C parameter to poetry env --info command
dixonjoel Sep 22, 2025
4a8b3fa
Attempt to use {{ github.workspace }} instead of ./
dixonjoel Sep 22, 2025
228461b
Attempt to use working-directory instead of -C <path>
dixonjoel Sep 22, 2025
d840da7
Remove stray quote
dixonjoel Sep 22, 2025
8e5f35a
Merge remote-tracking branch 'origin/main' into users/jdixon/add-comm…
dixonjoel Sep 22, 2025
c35bbb4
Try quoting
dixonjoel Sep 22, 2025
94c19d6
Remove some bash code to narrow down error
dixonjoel Sep 22, 2025
6d628bc
Add back in path
dixonjoel Sep 22, 2025
867661a
Try another arrangement
dixonjoel Sep 22, 2025
d90f284
Try without echoing the path
dixonjoel Sep 22, 2025
34ee66b
Try some quotes, why not?
dixonjoel Sep 22, 2025
8672646
Try without --path, why not
dixonjoel Sep 23, 2025
a5a414d
Try without Python 3.9
dixonjoel Sep 23, 2025
10bad85
Echo the poetry env info
dixonjoel Sep 23, 2025
bcc1c1a
Add back in path
dixonjoel Sep 23, 2025
9d3f040
Try a different arrangement of quotes
dixonjoel Sep 23, 2025
0899ce9
Change variable name
dixonjoel Sep 23, 2025
3d89b41
Change variable name
dixonjoel Sep 23, 2025
359640c
print some debug info
mshafer-NI Sep 23, 2025
3fa2cfb
don't stop on help
mshafer-NI Sep 23, 2025
17a40c3
don't fail fast
mshafer-NI Sep 23, 2025
a3778a6
ok, let's print it out without exiting first
mshafer-NI Sep 23, 2025
640e806
ok, use or
mshafer-NI Sep 23, 2025
3acc52c
ok, try this...
mshafer-NI Sep 23, 2025
96c1e97
analyze-project: Fix venv caching (#28)
bkeryan Sep 24, 2025
082363c
Restore all the matrix of python versions and OSs
dixonjoel Sep 24, 2025
1831603
Merge branch 'users/jdixon/add-common-workflows' of https://github.co…
dixonjoel Sep 24, 2025
4dd9375
Fix copy and paste error in test_actions.yml
dixonjoel Sep 24, 2025
2187533
Minor PR feedback
dixonjoel Sep 24, 2025
dd965b2
Remove 3.13t Python from some spots
dixonjoel Sep 24, 2025
87ed507
Use v0 for actions in README
dixonjoel Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions workflows/analyze-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Check analyzers
description: >
This workflow checks the code quality of a Python package using various
analyzers like linters and type checkers, including ni-python-styleguide,
mypy, bandit, and pyright. It is designed to be reusable across different
projects and can be easily integrated into existing CI/CD pipelines.

on:
workflow_call:
inputs:
project-directory:
description: Path to the directory containing pyproject.toml.
default: ${{ github.workspace }}
install-extras:
description: 'List of Poetry extras to install (comma separated)'
default: ''
required: false
type: string

jobs:
check_analyzers:
name: Check analyzers for ${{ inputs.package-name }}
runs-on: ubuntu-latest
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ${{ inputs.project-directory }}
steps:
- name: Get package name and version
id: get_package_info
run: |
result=$(poetry version -C "${{ inputs.project-directory }}")
name=$(echo "$result" | awk '{print $1}')
version=$(echo "$result" | awk '{print $2}')
echo "name=$name" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: true
- name: Set up Python
uses: ./setup-python
id: setup-python
- name: Set up Poetry
uses: ./setup-poetry
- name: Check for lock changes
run: poetry check --lock
- name: Cache virtualenv
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ${{ inputs.project-directory }}/.venv
key: ${{ inputs.package-name }}-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(format('{0}/poetry.lock', inputs.project-directory)) }}
- name: Install ${{ steps.get_package_info.outputs.name }}
run: |
if [ "${{ inputs.install-extras }}" != "" ]; then
poetry install -v --extras "${{ inputs.install-extras }}"
else
poetry install -v
fi
- name: Lint
run: poetry run ni-python-styleguide lint
- name: Mypy static analysis (Linux)
run: poetry run mypy
- name: Mypy static analysis (Windows)
run: poetry run mypy --platform win32
- name: Bandit security checks
run: poetry run bandit -c pyproject.toml -r src/
- name: Add virtualenv to the path for pyright-action
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
- name: Pyright static analysis (Linux)
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
with:
python-platform: Linux
version: PATH
working-directory: ${{ inputs.project-directory }}
- name: Pyright static analysis (Windows)
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
with:
python-platform: Windows
version: PATH
working-directory: ${{ inputs.project-directory }}
Loading