Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on:
push:
branches:
- main
- 'releases/**'
workflow_call:
workflow_dispatch:

jobs:
check_ni_protobuf_types:
name: Check ni.protobuf.types
uses: ./.github/workflows/check_package.yml
with:
package_name: ni.protobuf.types
check_ni_pythonpanel_v1_proto:
name: Check ni.pythonpanel.v1.proto
uses: ./.github/workflows/check_package.yml
with:
package_name: ni.pythonpanel.v1.proto
22 changes: 22 additions & 0 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PR

on:
pull_request:
branches:
- main
- 'releases/**'
workflow_call:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
run_ci:
name: Run CI
uses: ./.github/workflows/CI.yml
permissions:
contents: read
checks: write
pull-requests: write
59 changes: 59 additions & 0 deletions .github/workflows/check_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Check Package

on:
workflow_call:
inputs:
package_name:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action parameters typically use kebab-case.

description: 'The name of the package to check.'
default: ''
required: true
type: string
workflow_dispatch:

jobs:
check_package:
name: Check ${{ inputs.package_name }}
runs-on: ubuntu-latest
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./packages/${{ inputs.package_name }}
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: ni/python-actions/setup-python@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
id: setup-python
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
- name: Check for lock changes
run: poetry check --lock
- name: Cache virtualenv
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: packages/${{ inputs.package_name }}/.venv
key: ${{ inputs.package_name }}-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/${{ inputs.package_name }}/poetry.lock') }}
- name: Install ${{ inputs.package_name }}
run: poetry install -v
- 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: ./packages/${{ inputs.package_name }}
- name: Pyright static analysis (Windows)
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
with:
python-platform: Windows
version: PATH
working-directory: ./packages/${{ inputs.package_name }}
1 change: 1 addition & 0 deletions packages/ni.protobuf.types/src/ni/protobuf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Package for ni.protobuf.types."""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""This is a placeholder file for the package while we implement code generation."""
5 changes: 5 additions & 0 deletions packages/ni.protobuf.types/tests/test_placeholder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Tests for the ni.protobuf.types package."""


def test___placeholder() -> None:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Package for ni.pythonpanel.v1.proto."""
5 changes: 5 additions & 0 deletions packages/ni.pythonpanel.v1.proto/tests/test_placeholder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Tests for the ni.pythonpanel.v1.proto package."""


def test___placeholder() -> None:
pass