Skip to content

Commit 9e1b558

Browse files
dixonjoelbkeryan
andauthored
Re-use analyze-project from the python-actions repo (#200)
* Re-use analyze-project from the python-actions repo * Attempt to aggregate the matrix checks for analyzing project * Use Brad's checks_succeeded action * Don't run mypy on oldest Python version because of NumPy support * Update to newly release 0.6.1 version of python-actions * github: Add a step to summarize the checks (#201) * github: Remove unused id, use sentence case --------- Co-authored-by: Brad Keryan <[email protected]>
1 parent bba6553 commit 9e1b558

File tree

2 files changed

+20
-32
lines changed

2 files changed

+20
-32
lines changed

.github/workflows/CI.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ jobs:
1515
check_docs:
1616
name: Check docs
1717
uses: ./.github/workflows/check_docs.yml
18+
checks_succeeded:
19+
name: Checks succeeded
20+
needs: [check_nitypes, check_docs]
21+
runs-on: ubuntu-latest
22+
steps:
23+
- run: exit 0
1824
run_unit_tests:
1925
name: Run unit tests
2026
uses: ./.github/workflows/run_unit_tests.yml
21-
needs: [check_nitypes]
27+
needs: [checks_succeeded]
2228
run_unit_tests_oldest_deps:
2329
name: Run unit tests (oldest deps)
2430
uses: ./.github/workflows/run_unit_tests_oldest_deps.yml
25-
needs: [check_nitypes]
31+
needs: [checks_succeeded]
2632
report_test_results:
2733
name: Report test results
2834
uses: ./.github/workflows/report_test_results.yml

.github/workflows/check_nitypes.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,23 @@ on:
77
jobs:
88
check_nitypes:
99
name: Check nitypes
10-
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
os: [windows-latest, ubuntu-latest, macos-latest]
13+
# Type checking requires an up-to-date NumPy.
14+
# The latest NumPy only supports 3.11 and later
15+
python-version: [3.11, 3.13]
16+
runs-on: ${{ matrix.os }}
1117
steps:
1218
- name: Check out repo
1319
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1420
- name: Set up Python
1521
uses: ni/python-actions/setup-python@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
16-
id: setup-python
22+
with:
23+
python-version: ${{ matrix.python-version }}
1724
- name: Set up Poetry
1825
uses: ni/python-actions/setup-poetry@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
19-
- name: Check for lock changes
20-
run: poetry check --lock
21-
- name: Cache virtualenv
22-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
23-
with:
24-
path: .venv
25-
key: nitypes-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
26-
- name: Install nitypes
27-
run: poetry install -v
28-
- name: Lint
29-
run: poetry run ni-python-styleguide lint
30-
- name: Mypy static analysis (Linux)
31-
run: poetry run mypy
32-
- name: Mypy static analysis (Windows)
33-
run: poetry run mypy --platform win32
26+
- name: Analyze Python project
27+
uses: ni/python-actions/analyze-project@f42e2f27a585f5d47efcab79b608ec0ec97191c9 # v0.6.1
3428
- name: Bandit security checks
35-
run: poetry run bandit -c pyproject.toml -r src/nitypes
36-
- name: Add virtualenv to the path for pyright-action
37-
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
38-
- name: Pyright static analysis (Linux)
39-
uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2.3.3
40-
with:
41-
python-platform: Linux
42-
version: PATH
43-
- name: Pyright static analysis (Windows)
44-
uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2.3.3
45-
with:
46-
python-platform: Windows
47-
version: PATH
29+
run: poetry run bandit -c pyproject.toml -r src/nitypes

0 commit comments

Comments
 (0)