Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
294de53
Add new outputs to get_package_info
jfriedri-ni Sep 4, 2025
216cde6
Rename 'package-base-path' to 'package-basepath'
jfriedri-ni Sep 4, 2025
1d56a3d
Use all JSON keys for each package info object
jfriedri-ni Sep 4, 2025
af0b453
Add and use input for package-basepath to check_docs.yml
jfriedri-ni Sep 4, 2025
773e047
Use new package info outputs in check_package.yml to skip unneeded jobs
jfriedri-ni Sep 4, 2025
999f6ae
Remove special treatment for grpc_generator in the CI
jfriedri-ni Sep 4, 2025
fe2bb54
Do not echo back the parsed JSON
jfriedri-ni Sep 5, 2025
42978f5
Merge remote-tracking branch 'origin/main' into users/jfriedri/rework…
jfriedri-ni Sep 5, 2025
f45325d
Incorporate the new no-proto pinmap client package
jfriedri-ni Sep 5, 2025
013f42c
Add the github workspace path segment to all working-directory parame…
jfriedri-ni Sep 5, 2025
3b3ff12
Hint that package-basepath is relative with a ./ prefix
jfriedri-ni Sep 5, 2025
99a4801
Use absolute basepaths for all step inputs
jfriedri-ni Sep 5, 2025
1d5df59
Revert the workspace root for check analyzers
jfriedri-ni Sep 5, 2025
2e39611
Rely on the working directory for the venv path to cache
jfriedri-ni Sep 5, 2025
bbc2c4d
Use relative paths for sub-action inputs
jfriedri-ni Sep 5, 2025
728e49e
Revert ./ prefix in packages.json
jfriedri-ni Sep 5, 2025
9a89e52
Use the default working directory to upload docs
jfriedri-ni Sep 5, 2025
3b6cfd5
Revert the absolute path input for run_and_upload_unit_tests
jfriedri-ni Sep 5, 2025
3da9712
Remove all ./ to build the paths correctly at call sites
jfriedri-ni Sep 5, 2025
cd7ca06
Remove intermediate relative path segments
jfriedri-ni Sep 5, 2025
f1c7c98
Use absolute path for upload-artifact because it doesn't use default …
jfriedri-ni Sep 5, 2025
5e8fc02
Use absolute path for Python venv cache because the action does not u…
jfriedri-ni Sep 5, 2025
9e2fa28
Update documentation and defaults in workflow files
jfriedri-ni Sep 8, 2025
b9e2a53
Merge remote-tracking branch 'origin/main' into users/jfriedri/rework…
jfriedri-ni Sep 8, 2025
4766a83
Only leaf workflows should use the repo root for their step inputs
jfriedri-ni Sep 8, 2025
ea547b3
Generalize check_analyzers and change 'install-drivers' to 'install-e…
jfriedri-ni Sep 8, 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
10 changes: 5 additions & 5 deletions .github/actions/run_and_upload_unit_tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ runs:
- name: Cache ${{ inputs.package-name }} virtualenv
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ./${{ inputs.package-basepath }}/${{ inputs.package-name }}/.venv
path: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}/.venv
key: ${{ inputs.package-name }}-${{ runner.os }}-py${{ env.pythonVersion }}-${{ hashFiles(format('{0}/{1}/poetry.lock', inputs.package-basepath, inputs.package-name)) }}
- name: Install ${{ inputs.package-name }}
run: poetry install -v
working-directory: ./${{ inputs.package-basepath }}/${{ inputs.package-name }}
working-directory: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}
shell: bash
- name: Run ${{ inputs.package-name }} unit tests and code coverage
run: poetry run pytest ./tests/unit -v --cov=${{ inputs.package-name }} --junitxml=test_results/${{ inputs.package-name }}-${{ matrix.os }}-py${{ matrix.python-version }}.xml
working-directory: ./${{ inputs.package-basepath }}/${{ inputs.package-name }}
working-directory: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}
shell: bash
- name: Upload ${{ inputs.package-name }} test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test_results_unit_${{ inputs.package-name }}_${{ matrix.os }}_py${{ matrix.python-version }}
path: ./${{ inputs.package-basepath }}/${{ inputs.package-name }}/test_results/*.xml
if: always()
path: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}/test_results/*.xml
if: always()
12 changes: 3 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,16 @@ jobs:
uses: ./.github/workflows/check_package.yml
with:
package-name: ${{ matrix.package-name }}
check_analyzers_grpc_gen:
name: Check analyzers for grpc_generator
uses: ./.github/workflows/check_analyzers.yml
with:
package-name: grpc_generator
package-base-path: tools
run_unit_tests:
name: Run unit tests
uses: ./.github/workflows/run_unit_tests.yml
needs: [check_package, check_analyzers_grpc_gen]
needs: check_package
report_test_results:
name: Report test results
uses: ./.github/workflows/report_test_results.yml
needs: [run_unit_tests]
needs: run_unit_tests
if: always()
permissions:
contents: read
checks: write
pull-requests: write
pull-requests: write
32 changes: 16 additions & 16 deletions .github/workflows/check_analyzers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on:
workflow_call:
inputs:
package-name:
description: 'The name of the package to check.'
description: 'The name of the package folder to check.'
default: ''
required: true
type: string
package-base-path:
description: 'The parent directory of the package to check. Defaults to packages.'
default: 'packages'
required: false
package-basepath:
description: 'The base path of the package to check, relative to the repo root.'
default: ''
required: true
type: string
install-drivers:
description: 'Whether to install drivers extras'
default: false
install-extras:
description: 'A space-separated list of package extras to install.'
default: ''
required: false
type: boolean
type: string

jobs:
check_analyzers:
Expand All @@ -26,7 +26,7 @@ jobs:
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./${{ inputs.package-base-path }}/${{ inputs.package-name }}
working-directory: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -42,12 +42,12 @@ jobs:
- name: Cache virtualenv
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ${{ inputs.package-base-path }}/${{ inputs.package-name }}/.venv
key: ${{ inputs.package-name }}-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(format('{0}/{1}/poetry.lock', inputs.package-base-path, inputs.package-name)) }}
path: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}/.venv
key: ${{ inputs.package-name }}-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(format('{0}/{1}/poetry.lock', inputs.package-basepath, inputs.package-name)) }}
- name: Install ${{ inputs.package-name }}
run: |
if [ "${{ inputs.install-drivers }}" = "true" ]; then
poetry install -v --extras drivers
if [ -n "${{ inputs.install-extras }}" ]; then
poetry install -v --extras '${{ inputs.install-extras }}'
else
poetry install -v
fi
Expand All @@ -66,10 +66,10 @@ jobs:
with:
python-platform: Linux
version: PATH
working-directory: ./${{ inputs.package-base-path }}/${{ inputs.package-name }}
working-directory: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}
- name: Pyright static analysis (Windows)
uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2.3.3
with:
python-platform: Windows
version: PATH
working-directory: ./${{ inputs.package-base-path }}/${{ inputs.package-name }}
working-directory: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}
18 changes: 9 additions & 9 deletions .github/workflows/check_codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
workflow_call:
inputs:
package-name:
description: 'The name of the package to check.'
description: 'The name of the package folder to check.'
default: ''
required: true
type: string
proto-basepath:
description: 'The base path for proto files used for generation.'
default: './third_party/ni-apis'
description: 'The base path to the proto files used for generation, relative to the repo root.'
default: 'third_party/ni-apis'
type: string
proto-subpath:
description: 'The path to proto files relative to proto-base-path.'
description: 'The specific subpath to the proto files needed for generation, relative to the proto-basepath.'
default: ''
required: true
type: string
proto-include-path:
description: 'Additional path to include in the proto generation.'
default: './third_party/ni-apis'
description: 'Additional path to include during proto generation, relative to the repo root.'
default: 'third_party/ni-apis'
type: string
output-basepath:
description: 'The base output path for codegened files.'
description: 'The base output path for the generated files, relative to the repo root.'
default: ''
required: true
type: string
Expand All @@ -39,7 +39,7 @@ jobs:
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./tools/grpc_generator
working-directory: ${{ github.workspace }}/tools/grpc_generator
steps:
- name: Validate package name
if: ${{ !endsWith(inputs.package-name, '.proto') && inputs.package-name != 'ni.protobuf.types' }}
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Cache virtualenv
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: tools/grpc_generator/.venv
path: ${{ github.workspace }}/tools/grpc_generator/.venv
key: grpc_generator-only-main-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('tools/grpc_generator/poetry.lock') }}
- name: Install grpc_generator
run: poetry install -v --only main
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/check_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on:
workflow_call:
inputs:
package-name:
description: 'The name of the package to check.'
description: 'The name of the package folder to check.'
default: ''
required: true
type: string
package-basepath:
description: 'The base path of the package to check, relative to the repo root.'
default: ''
required: true
type: string
Expand All @@ -16,7 +21,7 @@ jobs:
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./packages/${{ inputs.package-name }}
working-directory: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -30,8 +35,8 @@ jobs:
- name: Cache virtualenv (with docs)
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: .venv
key: ${{ inputs.package-name }}-with-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(format('packages/{0}/poetry.lock', inputs.package-name)) }}
path: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}/.venv
key: ${{ inputs.package-name }}-with-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(format('{0}/{1}/poetry.lock', inputs.package-basepath, inputs.package-name)) }}
- name: Install nitypes (with docs)
run: poetry install -v --only main,docs
- name: Generate docs
Expand All @@ -40,4 +45,4 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ inputs.package-name }}-docs
path: packages/${{ inputs.package-name }}/docs/_build/
path: ${{ github.workspace }}/${{ inputs.package-basepath }}/${{ inputs.package-name }}/docs/_build/
14 changes: 9 additions & 5 deletions .github/workflows/check_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
package-name:
description: 'The name of the package to check.'
description: 'The name of the package folder to check.'
default: ''
required: true
type: string
Expand All @@ -16,7 +16,7 @@ jobs:
with:
package-name: ${{ inputs.package-name }}
check_codegen:
if: ${{ needs.get_package_info.outputs.proto-subpath != '' }}
if: ${{ needs.get_package_info.outputs.should-check-codegen == 'true' }}
name: Check codegen for ${{ inputs.package-name }}
needs: get_package_info
uses: ./.github/workflows/check_codegen.yml
Expand All @@ -25,17 +25,21 @@ jobs:
proto-basepath: ${{ needs.get_package_info.outputs.proto-basepath }}
proto-subpath: ${{ needs.get_package_info.outputs.proto-subpath }}
proto-include-path: ${{ needs.get_package_info.outputs.proto-include-path }}
output-basepath: ./packages/${{ inputs.package-name }}/src
output-basepath: ${{ needs.get_package_info.outputs.package-basepath }}/${{ inputs.package-name }}/src
output-format: ${{ needs.get_package_info.outputs.output-format }}
check_analyzers:
name: Check analyzers for ${{ inputs.package-name }}
needs: get_package_info
uses: ./.github/workflows/check_analyzers.yml
with:
package-name: ${{ inputs.package-name }}
install-drivers: ${{ needs.get_package_info.outputs.install-drivers == 'true' }}
package-basepath: ${{ needs.get_package_info.outputs.package-basepath }}
install-extras: ${{ needs.get_package_info.outputs.install-extras }}
check_docs:
if: ${{ needs.get_package_info.outputs.should-check-docs == 'true' }}
name: Check docs for ${{ inputs.package-name }}
needs: get_package_info
uses: ./.github/workflows/check_docs.yml
with:
package-name: ${{ inputs.package-name }}
package-name: ${{ inputs.package-name }}
package-basepath: ${{ needs.get_package_info.outputs.package-basepath }}
79 changes: 64 additions & 15 deletions .github/workflows/get_package_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,53 @@ on:
workflow_call:
inputs:
package-name:
description: 'The name of the package to check.'
description: 'The name of the package from packages.json.'
default: ''
required: true
type: string
outputs:
package-basepath:
description: 'The path to the parent directory of the package, relative to the repo root.'
value: ${{ jobs.get_package_info.outputs.package-basepath }}
proto-basepath:
description: 'Base path for proto files.'
description: 'The base path to the proto files used for generation.'
value: ${{ jobs.get_package_info.outputs.proto-basepath }}
proto-subpath:
description: 'Subpath for proto files.'
description: 'The specific subpath to the proto files needed for generation, relative to the proto-basepath.'
value: ${{ jobs.get_package_info.outputs.proto-subpath }}
proto-include-path:
description: 'Include path for proto files.'
description: 'Additional path to include during proto generation.'
value: ${{ jobs.get_package_info.outputs.proto-include-path }}
output-format:
description: 'Output format.'
description: 'The format for the generated stubs. Options are submodule and subpackage.'
value: ${{ jobs.get_package_info.outputs.output-format }}
install-drivers:
description: 'Whether to install drivers extra'
value: ${{ jobs.get_package_info.outputs.install-drivers }}
install-extras:
description: 'A space-separated list of package extras to install.'
value: ${{ jobs.get_package_info.outputs.install-extras }}
should-check-codegen:
description: 'Whether to check protobuf code generation.'
value: ${{ jobs.get_package_info.outputs.should-check-codegen }}
should-check-docs:
description: 'Whether to check documentation generation.'
value: ${{ jobs.get_package_info.outputs.should-check-docs }}
should-run-tests:
description: 'Whether to run automated tests.'
value: ${{ jobs.get_package_info.outputs.should-run-tests }}

jobs:
get_package_info:
name: Get package info for ${{ inputs.package-name }}
runs-on: ubuntu-latest
outputs:
package-basepath: ${{ steps.parse_json.outputs.package-basepath }}
proto-basepath: ${{ steps.parse_json.outputs.proto-basepath }}
proto-subpath: ${{ steps.parse_json.outputs.proto-subpath }}
proto-include-path: ${{ steps.parse_json.outputs.proto-include-path }}
output-format: ${{ steps.parse_json.outputs.output-format }}
install-drivers: ${{ steps.parse_json.outputs.install-drivers }}
install-extras: ${{ steps.parse_json.outputs.install-extras }}
should-check-codegen: ${{ steps.parse_json.outputs.should-check-codegen }}
should-check-docs: ${{ steps.parse_json.outputs.should-check-docs }}
should-run-tests: ${{ steps.parse_json.outputs.should-run-tests }}
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -47,9 +63,42 @@ jobs:
echo "Error: Package '${{ inputs.package-name }}' not found in packages.json." >&2
exit 1
fi
echo "Package info: $info"
echo "proto-basepath=$(echo $info | jq -r '."proto-basepath"')" >> $GITHUB_OUTPUT
echo "proto-subpath=$(echo $info | jq -r '."proto-subpath"')" >> $GITHUB_OUTPUT
echo "proto-include-path=$(echo $info | jq -r '."proto-include-path"')" >> $GITHUB_OUTPUT
echo "output-format=$(echo $info | jq -r '."output-format"')" >> $GITHUB_OUTPUT
echo "install-drivers=$(echo $info | jq -r '."install-drivers"')" >> $GITHUB_OUTPUT

package_basepath=$(echo $info | jq -r '."package-basepath"')
proto_basepath=$(echo $info | jq -r '."proto-basepath"')
proto_subpath=$(echo $info | jq -r '."proto-subpath"')
proto_include_path=$(echo $info | jq -r '."proto-include-path"')
output_format=$(echo $info | jq -r '."output-format"')
install_extras=$(echo $info | jq -r '."install-extras"')

should_check_codegen=false
if [ "${proto_subpath}" != "null" ]; then
should_check_codegen=true
fi

should_check_docs=false
if [ -d "${GITHUB_WORKSPACE}/${package_basepath}/${{ inputs.package-name }}/docs" ]; then
should_check_docs=true
fi

should_run_tests=false
if [ -d "${GITHUB_WORKSPACE}/${package_basepath}/${{ inputs.package-name }}/tests" ]; then
should_run_tests=true
fi

if [ "${install_extras}" == "null" ]; then
install_extras=""
fi

echo "package-basepath=${package_basepath}" >> $GITHUB_OUTPUT
echo "proto-basepath="${proto_basepath} >> $GITHUB_OUTPUT
echo "proto-subpath=${proto_subpath}" >> $GITHUB_OUTPUT
echo "proto-include-path=${proto_include_path}" >> $GITHUB_OUTPUT
echo "output-format=${output_format}" >> $GITHUB_OUTPUT
echo "install-extras=${install_extras}" >> $GITHUB_OUTPUT
echo "should-check-codegen=${should_check_codegen}" >> $GITHUB_OUTPUT
echo "should-check-docs=${should_check_docs}" >> $GITHUB_OUTPUT
echo "should-run-tests=${should_run_tests}" >> $GITHUB_OUTPUT
- name: Show package info
run: |
echo "${{ toJSON(steps.parse_json.outputs) }}"
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
expected-version: ${{ needs.get_package_info.outputs.package-version }}
- name: Build distribution packages
run: poetry build
working-directory: ./packages/${{ needs.get_package_info.outputs.package-name }}
working-directory: ${{ github.workspace }}/packages/${{ needs.get_package_info.outputs.package-name }}
- name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
Expand All @@ -126,7 +126,7 @@ jobs:
name: ${{ needs.get_package_info.outputs.package-name }}-distribution-packages
path: ./packages/${{ needs.get_package_info.outputs.package-name }}/dist/
- run: ls -lR
working-directory: ./packages/${{ needs.get_package_info.outputs.package-name }}
working-directory: ${{ github.workspace }}/packages/${{ needs.get_package_info.outputs.package-name }}
- name: Upload to ${{ env.environment }}
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
Expand Down
Loading
Loading