-
Notifications
You must be signed in to change notification settings - Fork 15
92 lines (87 loc) · 3.93 KB
/
check_nims.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Check NIMS
on:
workflow_call:
workflow_dispatch:
env:
POETRY_VERSION: 1.8.2
PYTHON_VERSION: 3.9
jobs:
check_nims:
name: Check NIMS
runs-on: ubuntu-latest
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./packages/service
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Check for lock changes (ni-measurement-plugin-sdk-service)
run: poetry check --lock
# ni-measurement-plugin-sdk-service, all extras
- name: Restore cached virtualenv (ni-measurement-plugin-sdk-service, all extras)
uses: actions/cache/restore@v4
id: restore-nims-all-extras
with:
path: packages/service/.venv
key: ni-measurement-plugin-sdk-service-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-service (all extras)
run: poetry install -v --all-extras
- name: Save cached virtualenv (ni-measurement-plugin-sdk-service, all extras)
uses: actions/cache/save@v4
if: steps.restore-nims-all-extras.outputs.cache-hit != 'true'
with:
path: packages/service/.venv
key: ${{ steps.restore-nims-all-extras.outputs.cache-primary-key }}
- name: Lint ni-measurement-plugin-sdk-service
run: poetry run ni-python-styleguide lint
- name: Mypy static analysis (ni-measurement-plugin-sdk-service, Linux)
run: poetry run mypy
- name: Mypy static analysis (ni-measurement-plugin-sdk-service, Windows)
run: poetry run mypy --platform win32
- name: Bandit security checks (ni-measurement-plugin-sdk-service)
run: poetry run bandit -c pyproject.toml -r ni_measurement_plugin_sdk_service
# ni-measurement-plugin-sdk-service, all extras, docs
- name: Restore cached virtualenv (ni-measurement-plugin-sdk-service, all extras, docs)
uses: actions/cache/restore@v4
id: restore-nims-all-extras-docs
with:
path: packages/service/.venv
key: ni-measurement-plugin-sdk-service-all-extras-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-service (all extras, docs)
run: poetry install -v --all-extras --with docs
- name: Save cached virtualenv (ni-measurement-plugin-sdk-service, all extras, docs)
uses: actions/cache/save@v4
if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true'
with:
path: packages/service/.venv
key: ${{ steps.restore-nims-all-extras-docs.outputs.cache-primary-key }}
- name: Build docs and check for errors/warnings
run: |
rm -rf docs
mkdir -p docs
poetry run sphinx-build _docs_source docs -b html -W --keep-going
- name: Revert docs
run: rm -rf docs
- name: Generate gRPC stubs
run: |
find ni_measurement_plugin_sdk_service/_internal/stubs/ -name \*_pb2.py\* -o -name \*_pb2_grpc.py\* -delete
find tests/utilities/stubs/ -name \*_pb2.py\* -o -name \*_pb2_grpc.py\* -delete
poetry run python scripts/generate_grpc_stubs.py
- name: Check for out-of-date gRPC stubs
run: git diff --exit-code
- name: Revert gRPC stubs
run: |
git clean -dfx ni_measurement_plugin_sdk_service/_internal/stubs/ tests/utilities/stubs/
git restore ni_measurement_plugin_sdk_service/_internal/stubs/ tests/utilities/stubs/