Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
47 changes: 45 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ name: Python package
on:
push:
branches: [master, main]
paths:
- 'nisystemlink_examples/**'
- 'tests/**'
- 'pyproject.toml'
- '.github/workflows/python-package.yml'
pull_request:
branches: [master, main]
workflow_dispatch:
paths:
- 'nisystemlink_examples/**'
- 'tests/**'
- 'pyproject.toml'
- '.github/workflows/python-package.yml'

jobs:
build-lint-unit-test:
Expand All @@ -25,4 +34,38 @@ jobs:
- run: poetry run poe test
- run: poetry run poe check
- run: poetry run poe lint
- run: poetry run poe types
- run: poetry run poe types
release:
runs-on: ubuntu-latest
needs: [build-lint-unit-test]
if: github.event_name == github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
environment:
name: pypi
url: https://pypi.org/p/nisystemlink-examples
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: "poetry"
- run: poetry install
- name: Semantic release
run: |
pip install python-semantic-release==7.34.6
git config --global user.name "github-actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
semantic-release version
env:
GH_TOKEN: ${{secrets.GH_REPO_TOKEN}}
- name: Build package
run: poetry build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
94 changes: 94 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,100 @@ You can also run all checks at once:
poetry run poe format && poetry run poe lint && poetry run poe types && poetry run poe test
```

## Commit Message Convention

This project uses [Conventional Commits](https://www.conventionalcommits.org/)
for automated versioning and changelog generation of the `nisystemlink_examples`
Python package.

**When conventional commits matter:**

- Commits to the `nisystemlink_examples/` package code
- Changes to `tests/`, `pyproject.toml`, or the CI workflow
- When merged to the `main` branch

For other contributions (examples, documentation, etc.), conventional commit
format is optional but still encouraged for consistency.

### Commit Message Format

```md
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

### Common Types and Version Bumps

- **`fix:`** - A bug fix (triggers a **PATCH** version bump: 0.1.0 → 0.1.1)

```md
fix: correct calculation error in test result processing fix(simulator):
handle empty response from API endpoint
```

- **`feat:`** - A new feature (triggers a **MINOR** version bump: 0.1.0 → 0.2.0)

```md
feat: add support for querying test results by date range feat(testdata): add
batch delete functionality for test results
```

- **`feat!:`** or **`BREAKING CHANGE:`** - A breaking change (triggers a
**MAJOR** version bump: 0.1.0 → 1.0.0)

```md
feat!: remove deprecated create_result method
```

Or with a footer:

```md
feat: redesign simulator API

BREAKING CHANGE: The create_result method has been removed. Use
create_results_and_steps instead.
```

### Other Common Types (no version bump)

- **`docs:`** - Documentation changes only
- **`style:`** - Code style changes (formatting, whitespace, etc.)
- **`refactor:`** - Code refactoring without changing functionality
- **`test:`** - Adding or updating tests
- **`chore:`** - Maintenance tasks, dependency updates, etc.
- **`ci:`** - CI/CD configuration changes

### Examples

```bash
# Patch release (0.1.0 → 0.1.1)
git commit -m "fix: handle empty response from API endpoint"

# Minor release (0.1.0 → 0.2.0)
git commit -m "feat: add batch delete functionality for test results"

# Major release (1.0.0 → 2.0.0) - use commit editor for multi-line
git commit
# Then in the editor:
# feat!: redesign simulator API with new parameter structure
#
# BREAKING CHANGE: Removed create_result(), use create_results_and_steps()
```

**What triggers an automated release:**

When commits following the conventional format are merged to `main` and affect:

- `nisystemlink_examples/**` (package source code)
- `tests/**` (test files)
- `pyproject.toml` (package configuration)
- `.github/workflows/python-package.yml` (CI/CD workflow)

The package will be automatically versioned, tagged, and published to PyPI.

## Security scanning with Snyk

This repository uses [Snyk](https://snyk.io/) for security scanning to identify
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "nisystemlink-demo"
name = "nisystemlink-examples"
version = "0.0.0"
description = "NI SystemLink examples and demo utilities"
authors = ["National Instruments"]
Expand All @@ -11,7 +11,7 @@ readme = "README.md"
keywords = ["nisystemlink", "systemlink"]
license = "MIT"
packages = [
{include = "nisystemlink_demo"}
{include = "nisystemlink_examples"}
]

[tool.poetry.dependencies]
Expand Down Expand Up @@ -45,7 +45,7 @@ match = "(main|master)"

[tool.poe.tasks]
test = "pytest tests"
lint = "flake8 nisystemlink_demo tests"
check = "black --check nisystemlink_demo tests"
format = "black nisystemlink_demo tests"
types = "mypy nisystemlink_demo tests"
lint = "flake8 nisystemlink_examples tests"
check = "black --check nisystemlink_examples tests"
format = "black nisystemlink_examples tests"
types = "mypy nisystemlink_examples tests"
2 changes: 1 addition & 1 deletion tests/testdata/test_simulator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Unit tests for the Simulator class."""

from nisystemlink_demo.testdata.simulator import Simulator
from nisystemlink_examples.testdata.simulator import Simulator


class TestSimulator:
Expand Down