Skip to content

Commit 119ce90

Browse files
mjohanse-emrMichael Johansen
andauthored
Initial submission of workflow files with simplified CI. (#7)
* Initial submission of workflow files with simplified CI. Signed-off-by: Michael Johansen <[email protected]> Fix the working directory setting. Signed-off-by: Michael Johansen <[email protected]> Specify working directory for pyright. Signed-off-by: Michael Johansen <[email protected]> I put the input in the wrong spot. Signed-off-by: Michael Johansen <[email protected]> Remove unused workflows. They will be added in later. Signed-off-by: Michael Johansen <[email protected]> * Try shortening the path passed to bandit to see if we can combine check yml files. Signed-off-by: Michael Johansen <[email protected]> * Combine check_*.yml into a single check_package.yml file with an input. Signed-off-by: Michael Johansen <[email protected]> --------- Signed-off-by: Michael Johansen <[email protected]> Co-authored-by: Michael Johansen <[email protected]>
1 parent fe47d4a commit 119ce90

File tree

8 files changed

+115
-0
lines changed

8 files changed

+115
-0
lines changed

.github/workflows/CI.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
check_ni_protobuf_types:
13+
name: Check ni.protobuf.types
14+
uses: ./.github/workflows/check_package.yml
15+
with:
16+
package_name: ni.protobuf.types
17+
check_ni_pythonpanel_v1_proto:
18+
name: Check ni.pythonpanel.v1.proto
19+
uses: ./.github/workflows/check_package.yml
20+
with:
21+
package_name: ni.pythonpanel.v1.proto

.github/workflows/PR.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
run_ci:
17+
name: Run CI
18+
uses: ./.github/workflows/CI.yml
19+
permissions:
20+
contents: read
21+
checks: write
22+
pull-requests: write
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Check Package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
package_name:
7+
description: 'The name of the package to check.'
8+
default: ''
9+
required: true
10+
type: string
11+
workflow_dispatch:
12+
13+
jobs:
14+
check_package:
15+
name: Check ${{ inputs.package_name }}
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
# Set the working-directory for all steps in this job.
20+
working-directory: ./packages/${{ inputs.package_name }}
21+
steps:
22+
- name: Check out repo
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
- name: Set up Python
25+
uses: ni/python-actions/setup-python@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
26+
id: setup-python
27+
- name: Set up Poetry
28+
uses: ni/python-actions/setup-poetry@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
29+
- name: Check for lock changes
30+
run: poetry check --lock
31+
- name: Cache virtualenv
32+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
33+
with:
34+
path: packages/${{ inputs.package_name }}/.venv
35+
key: ${{ inputs.package_name }}-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/${{ inputs.package_name }}/poetry.lock') }}
36+
- name: Install ${{ inputs.package_name }}
37+
run: poetry install -v
38+
- name: Lint
39+
run: poetry run ni-python-styleguide lint
40+
- name: Mypy static analysis (Linux)
41+
run: poetry run mypy
42+
- name: Mypy static analysis (Windows)
43+
run: poetry run mypy --platform win32
44+
- name: Bandit security checks
45+
run: poetry run bandit -c pyproject.toml -r src/
46+
- name: Add virtualenv to the path for pyright-action
47+
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
48+
- name: Pyright static analysis (Linux)
49+
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
50+
with:
51+
python-platform: Linux
52+
version: PATH
53+
working-directory: ./packages/${{ inputs.package_name }}
54+
- name: Pyright static analysis (Windows)
55+
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
56+
with:
57+
python-platform: Windows
58+
version: PATH
59+
working-directory: ./packages/${{ inputs.package_name }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Package for ni.protobuf.types."""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""This is a placeholder file for the package while we implement code generation."""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Tests for the ni.protobuf.types package."""
2+
3+
4+
def test___placeholder() -> None:
5+
pass
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Package for ni.pythonpanel.v1.proto."""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Tests for the ni.pythonpanel.v1.proto package."""
2+
3+
4+
def test___placeholder() -> None:
5+
pass

0 commit comments

Comments
 (0)