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
57 changes: 57 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: code checks
permissions:
contents: read
pull-requests: write

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- '**.py'
- uv.lock
- pyproject.toml
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- '**.py'
- uv.lock
- pyproject.toml

jobs:
code-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
version: "0.9.11"
enable-cache: true

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version-file: ".python-version"

- name: Install the project
run: uv sync --all-extras --dev

- name: Run pre-commit checks
run: |
source .venv/bin/activate
pre-commit run --all-files

- name: Seed pip into venv
run: uv pip install pip

- name: pip-audit
uses: pypa/gh-action-pip-audit@v1.1.0
with:
virtual-environment: .venv/
58 changes: 58 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: unit tests
permissions:
contents: read
pull-requests: write

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/unit_tests.yml
- .github/workflows/code_checks.yml
- '**.py'
- uv.lock
- pyproject.toml
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/unit_tests.yml
- .github/workflows/code_checks.yml
- '**.py'
- uv.lock
- pyproject.toml

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2

- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
version: "0.9.11"
enable-cache: true

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version-file: ".python-version"

- name: Install the project
run: uv sync --all-extras --dev

- name: Run unit tests
run: |
uv run pytest --cov src/motive --cov-report=xml tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: VectorInstitute/motive
fail_ci_if_error: false
verbose: true
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__pycache__/
*.py[cod]
*.egg-info/
.venv/
dist/
.coverage
coverage.xml
.pytest_cache/
.mypy_cache/
.ruff_cache/
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: fix-byte-order-marker
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
- id: check-yaml
args: [--unsafe]
- id: check-toml

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.26
hooks:
- id: uv-lock

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.15.8'
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, jupyter]
- id: ruff-format
types_or: [python, jupyter]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
entry: .venv/bin/python -m mypy --config-file pyproject.toml
language: system
types: [python]
exclude: "tests|examples"

- repo: https://github.com/crate-ci/typos
rev: v1.32.0
hooks:
- id: typos

ci:
autofix_commit_msg: |
[pre-commit.ci] Add auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: [mypy]
submodules: false
Loading
Loading