-
Notifications
You must be signed in to change notification settings - Fork 21
78 lines (76 loc) · 2.73 KB
/
check_examples.yml
File metadata and controls
78 lines (76 loc) · 2.73 KB
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
name: Check examples
on:
workflow_call:
workflow_dispatch:
jobs:
check_examples:
name: Check examples
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: ni/python-actions/setup-python@a2894c635a2cba635a1086c1f89796fec2c52f74 # v0.7.2
id: setup-python
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@a2894c635a2cba635a1086c1f89796fec2c52f74 # v0.7.2
# Updating poetry.lock for all of the examples takes over 6 minutes, so it's worth caching.
- name: Cache poetry.lock
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
id: cache-poetry-lock
with:
path: 'examples/**/poetry.lock'
# Include the main project's poetry.lock in the hash to detect upstream dependency updates.
key: examples-poetry-lock-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('examples/**/pyproject.toml', 'packages/service/poetry.lock') }}
- name: Lock examples
if: steps.cache-poetry-lock.outputs.cache-hit != 'true'
run: |
for example in examples/*/; do
echo "::group::$example"
pushd $example
poetry lock
popd
echo "::endgroup::"
done
- name: Cache virtualenvs
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
id: cache-venv
with:
path: 'examples/**/.venv'
key: examples-venv-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('examples/**/poetry.lock') }}
- name: Install examples
run: |
for example in examples/*/; do
echo "::group::$example"
pushd $example
poetry install -v
popd
echo "::endgroup::"
done
- name: Lint examples
run: |
for example in examples/*/; do
echo "::group::$example"
pushd $example
poetry run ni-python-styleguide lint
popd
echo "::endgroup::"
done
- name: Mypy static analysis (examples, Linux)
run: |
for example in examples/*/; do
echo "::group::$example"
pushd $example
poetry run mypy .
popd
echo "::endgroup::"
done
- name: Mypy static analysis (examples, Windows)
run: |
for example in examples/*/; do
echo "::group::$example"
pushd $example
poetry run mypy . --platform win32
popd
echo "::endgroup::"
done