diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 00000000..df5c8116 --- /dev/null +++ b/.github/workflows/CI.yml @@ -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 diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml new file mode 100644 index 00000000..2886cc3b --- /dev/null +++ b/.github/workflows/PR.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/check_package.yml b/.github/workflows/check_package.yml new file mode 100644 index 00000000..54c43ae7 --- /dev/null +++ b/.github/workflows/check_package.yml @@ -0,0 +1,59 @@ +name: Check Package + +on: + workflow_call: + inputs: + package_name: + 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 }} diff --git a/packages/ni.protobuf.types/src/ni/protobuf/__init__.py b/packages/ni.protobuf.types/src/ni/protobuf/__init__.py new file mode 100644 index 00000000..1a5e2f46 --- /dev/null +++ b/packages/ni.protobuf.types/src/ni/protobuf/__init__.py @@ -0,0 +1 @@ +"""Package for ni.protobuf.types.""" diff --git a/packages/ni.protobuf.types/src/ni/protobuf/types/placeholder.py b/packages/ni.protobuf.types/src/ni/protobuf/types/placeholder.py new file mode 100644 index 00000000..0fa6b227 --- /dev/null +++ b/packages/ni.protobuf.types/src/ni/protobuf/types/placeholder.py @@ -0,0 +1 @@ +"""This is a placeholder file for the package while we implement code generation.""" diff --git a/packages/ni.protobuf.types/tests/test_placeholder.py b/packages/ni.protobuf.types/tests/test_placeholder.py new file mode 100644 index 00000000..de29cbcf --- /dev/null +++ b/packages/ni.protobuf.types/tests/test_placeholder.py @@ -0,0 +1,5 @@ +"""Tests for the ni.protobuf.types package.""" + + +def test___placeholder() -> None: + pass diff --git a/packages/ni.pythonpanel.v1.proto/src/ni/pythonpanel/v1/__init__.py b/packages/ni.pythonpanel.v1.proto/src/ni/pythonpanel/v1/__init__.py new file mode 100644 index 00000000..133c0e6c --- /dev/null +++ b/packages/ni.pythonpanel.v1.proto/src/ni/pythonpanel/v1/__init__.py @@ -0,0 +1 @@ +"""Package for ni.pythonpanel.v1.proto.""" diff --git a/packages/ni.pythonpanel.v1.proto/tests/test_placeholder.py b/packages/ni.pythonpanel.v1.proto/tests/test_placeholder.py new file mode 100644 index 00000000..37d9b66d --- /dev/null +++ b/packages/ni.pythonpanel.v1.proto/tests/test_placeholder.py @@ -0,0 +1,5 @@ +"""Tests for the ni.pythonpanel.v1.proto package.""" + + +def test___placeholder() -> None: + pass