Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions .github/actions/run_and_upload_unit_tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Run and upload unit tests'
description: 'Run unit tests using pytest and upload the results as an artifact.'
runs:
using: "composite"
steps:
- name: Get OS version
run: echo "osVersion=$ImageOS" >> "$GITHUB_ENV"
shell: bash
- name: Cache ni.datastore virtualenv
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ./.venv
key: ni.datastore-${{ runner.os }}-py${{ env.pythonVersion }}-${{ hashFiles('./poetry.lock') }}
- name: Install ni.datastore
run: poetry install -v
working-directory: .
shell: bash
- name: Run ni.datastore unit tests and code coverage
run: poetry run pytest ./tests/unit -v --cov=ni.datastore --junitxml=test_results/ni.datastore-${{ env.osVersion }}-py${{ env.pythonVersion }}.xml
working-directory: .
shell: bash
- name: Upload ni.datastore test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test_results_unit_ni.datastore_${{ env.osVersion }}_py${{ env.pythonVersion }}
path: ${{ github.workspace }}/test_results/*.xml
if: always()
21 changes: 16 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ on:
workflow_dispatch:

jobs:
todo_make_a_ci:
runs-on: ubuntu-latest
steps:
- name: CI Inactive
run: echo "This CI is inactive. Please activate it by removing this job."
check_analyzers:
name: Check analyzers for ni.datastore
uses: ./.github/workflows/check_ni_datastore.yml
check_docs:
name: Check docs for ni.datastore
uses: ./.github/workflows/check_docs.yml
run_unit_tests:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
name: Run unit tests
uses: ./.github/workflows/run_unit_tests.yml
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
38 changes: 38 additions & 0 deletions .github/workflows/check_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check docs

on:
workflow_call:
workflow_dispatch:

jobs:
check_docs:
name: Check docs for ni.datastore
runs-on: ubuntu-latest
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: .
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python
uses: ni/python-actions/setup-python@f0276f7f58868ec0d0d1a86377287c9e6fe0c6e7 # v0.5.0
id: setup-python
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@f0276f7f58868ec0d0d1a86377287c9e6fe0c6e7 # v0.5.0
- name: Check for lock changes
run: poetry check --lock
- name: Cache virtualenv (with docs)
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: .venv
key: ni.datastore-with-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('./poetry.lock') }}
- name: Install nitypes (with docs)
run: poetry install -v --only main,docs
- name: Generate docs
run: poetry run sphinx-build docs docs/_build -b html -W
- name: Upload docs artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ni.datastore-docs
path: ./docs/_build/
52 changes: 52 additions & 0 deletions .github/workflows/check_ni_datastore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check analyzers

on:
workflow_call:
workflow_dispatch:

jobs:
check_analyzers:
name: Check analyzers for ni.datastore
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: true
- name: Set up Python
uses: ni/python-actions/setup-python@f0276f7f58868ec0d0d1a86377287c9e6fe0c6e7 # v0.5.0
id: setup-python
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@f0276f7f58868ec0d0d1a86377287c9e6fe0c6e7 # v0.5.0
- name: Check for lock changes
run: poetry check --lock
- name: Cache virtualenv
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ./.venv
key: ni.datastore-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-{{ hashFiles('./poetry.lock') }}
- name: Install ni.datastore
run: |
poetry install -v
- name: Lint
run: poetry run ni-python-styleguide lint
- name: Mypy static analysis (Linux)
run: poetry run mypy
- name: Mypy static analysis (Windows)
run: poetry run mypy --platform win32
- name: Bandit security checks
run: poetry run bandit -c pyproject.toml -r src/
- name: Add virtualenv to the path for pyright-action
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
- name: Pyright static analysis (Linux)
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
with:
python-platform: Linux
version: PATH
working-directory: .
- name: Pyright static analysis (Windows)
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
with:
python-platform: Windows
version: PATH
working-directory: .
37 changes: 37 additions & 0 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run unit tests

on:
workflow_call:
inputs:
python-version:
description: 'The version of Python to use'
default: ''
required: true
type: string
os:
description: 'The name of the OS to use'
required: true
type: string

jobs:
run_unit_tests:
name: Run unit tests for ni.datastore with ${{ inputs.python-version }} on ${{ inputs.os }}
runs-on: ${{ inputs.os }}
strategy:
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
# incomplete JUnit XML results.
fail-fast: false
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: true
- name: Set up Python
uses: ni/python-actions/setup-python@f0276f7f58868ec0d0d1a86377287c9e6fe0c6e7 # v0.5.0
id: setup-python
with:
python-version: ${{ inputs.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@f0276f7f58868ec0d0d1a86377287c9e6fe0c6e7 # v0.5.0
- name: Run and upload unit tests for ni.datastore
uses: ./.github/actions/run_and_upload_unit_tests
2 changes: 1 addition & 1 deletion examples/placeholder.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Temporary placeholder example."""
"""Temporary placeholder example."""
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests."""
1 change: 1 addition & 0 deletions tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Unit tests."""
7 changes: 7 additions & 0 deletions tests/unit/test_ni_datastore_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Contains tests to validate the datastore client functionality."""

from __future__ import annotations


def test__datastore_client() -> None:
assert True
Loading