Skip to content
Open
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"bonsai.sgen": {
"version": "0.4.0",
"version": "0.6.1",
"commands": [
"bonsai.sgen"
]
Expand Down
5 changes: 5 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
_src_path: ..\Aind.Behavior.CopierTemplate\aind-behavior-template\
author_email: [email protected]
author_name: Bruno F. Cruz
prefix: aind-behavior-device
project_name: water-tuner
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
# All files
[*]
indent_style = space

# XML project files
[*.{csproj,vcxproj,vcxproj.filters,proj,projitems,shproj,bonsai}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# Code files
[*.{cs,csx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs}]
# Organize usings
dotnet_sort_system_directives_first = true
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
exclude =
.git,
__pycache__,
build
max-complexity = 10
max-line-length = 120
207 changes: 207 additions & 0 deletions .github/workflows/aind-behavior-device-water-tuner-cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
name: water-tuner test suite

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- dev*
- release*
release:
types: [published]

jobs:
# ╔──────────────────────────╗
# │ _____ _ │
# │ |_ _|__ ___| |_ ___ │
# │ | |/ _ \/ __| __/ __| │
# │ | | __/\__ \ |_\__ \ │
# │ |_|\___||___/\__|___/ │
# │ │
# ╚──────────────────────────╝
tests:
runs-on: windows-latest
name: water-tuner unit tests
steps:
- uses: actions/checkout@v5

- uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Install python dependencies
run: uv sync

- name: Run ruff format
run: uv run ruff format

- name: Run ruff check
run: uv run ruff check

- name: Run codespell
run: uv run codespell

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Restore dotnet tools
run: dotnet tool restore

- name: Setup Bonsai environment
working-directory: ./bonsai
run: ./setup.ps1

- name: Run python unit tests
run: uv run python -m unittest

- name: Regenerate schemas
run: uv run water-tuner regenerate

- name: Check for uncommitted changes
run: |
git config --global core.safecrlf false
git diff --exit-code || (echo "Untracked changes found" && exit 1)

# ╔───────────────────────────────────────────────────────────╗
# │ ____ ___ ____ ____ ____ _ │
# │ / ___|_ _/ ___| _ \ | _ \ ___| | ___ __ _ ___ ___ │
# │ | | | | | | | | | | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
# │ | |___ | | |___| |_| | | _ < __/ | __/ (_| \__ \ __/ │
# │ \____|___\____|____/ |_| \_\___|_|\___|\__,_|___/\___| │
# │ │
# ╚───────────────────────────────────────────────────────────╝
github-rc-release:
needs: tests
runs-on: ubuntu-latest
if: >
github.ref == 'refs/heads/main' &&
github.event_name == 'push' &&
github.event.head_commit.author.email != 'github-actions[bot]@users.noreply.github.com'
name: Create GitHub pre-release
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: main

- uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Bump pre-release by default
run: uv version --bump rc

- name: Regenerate schemas
run: uv run water-tuner regenerate

- name: Commit version and schema changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Bump version and regenerate schemas [skip ci]" || echo "No changes to commit"
git push origin main

- name: Get version
id: get_version
run: |
version=$(uv version --output-format json | jq -r '.version')
echo "version=$version" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: v${{ steps.get_version.outputs.version }}
generate_release_notes: true
prerelease: true
body: |
Automated pre-release v${{ steps.get_version.outputs.version }}

# ╔─────────────────────────────────────────────────────────────────╗
# │ ____ _ _ _ ____ _ │
# │ | _ \ _ _| |__ | (_) ___ | _ \ ___| | ___ __ _ ___ ___ │
# │ | |_) | | | | '_ \| | |/ __| | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
# │ | __/| |_| | |_) | | | (__ | _ < __/ | __/ (_| \__ \ __/ │
# │ |_| \__,_|_.__/|_|_|\___| |_| \_\___|_|\___|\__,_|___/\___| │
# │ │
# ╚─────────────────────────────────────────────────────────────────╝

github-public-release:
runs-on: ubuntu-latest
name: Create GitHub public release
needs: tests
if: github.event_name == 'release' &&
github.event.action == 'published' &&
!github.event.release.prerelease
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: main

- uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Get release version from tag
id: get_version
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT

- name: Validate version tag format
run: uv version ${{ steps.get_version.outputs.version }} --dry-run

- name: Update package version
run: uv version ${{ steps.get_version.outputs.version }}

- name: Regenerate schemas
run: uv run water-tuner regenerate

- name: Commit version and schema changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Set version and regenerate schemas" || echo "No changes to commit"
git push origin main

# ╔─────────────────────────╗
# │ ____ │
# │ | _ \ ___ ___ ___ │
# │ | | | |/ _ \ / __/ __| │
# │ | |_| | (_) | (__\__ \ │
# │ |____/ \___/ \___|___/ │
# │ │
# ╚─────────────────────────╝
build-docs:
name: Build and deploy documentation to GitHub Pages
runs-on: ubuntu-latest
needs: github-rc-release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2

- name: Install docs group of dependencies
run: uv sync --group docs

- name: Build Sphinx documentation
run: uv run sphinx-build -b html docs/ _build/html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html
force_orphan: true
25 changes: 0 additions & 25 deletions .github/workflows/ci.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/docs.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/workflows/tag_and_publish.yml

This file was deleted.

15 changes: 4 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ bin
obj
Packages
Bonsai.exe.WebView2
Bonsai/Settings/
*.bin
*.avi
*.dll
*.exe
*.exe.settings
*.bonsai.layout
local
*.snl
.venv


# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -80,13 +82,4 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# mypy
.mypy_cache/

# ruff
.ruff_cache/

# venv files
.venv
# .python-version
4 changes: 2 additions & 2 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
3.11
3.13
3.12
3.13
3.11
7 changes: 2 additions & 5 deletions bonsai/NuGet.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Gallery" value="Gallery" />
<add key="Bonsai Packages" value="https://www.myget.org/F/bonsai/api/v3/index.json" />
<add key="Community Packages" value="https://www.myget.org/F/bonsai-community/api/v3/index.json" />
<add key="Bonsai Boost" value="https://www.myget.org/F/bonsai-boost/api/v3/index.json" />
</packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
1 change: 0 additions & 1 deletion bonsai/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ if (!(Test-Path "./Bonsai.exe")) {
Expand-Archive "temp.zip" -DestinationPath "." -Force
Move-Item -Path "temp.config" "NuGet.config" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "temp.zip"
Remove-Item -Path "Bonsai32.exe"
}
& .\Bonsai.exe --no-editor
Pop-Location
Loading