Skip to content

Add HTML rendering for tree structure visualization #3

Add HTML rendering for tree structure visualization

Add HTML rendering for tree structure visualization #3

Workflow file for this run

name: contraqctor test suite
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- dev*
- release*
release:
types: [published]
jobs:
# ╔──────────────────────────╗
# │ _____ _ │
# │ |_ _|__ ___| |_ ___ │
# │ | |/ _ \/ __| __/ __| │
# │ | | __/\__ \ |_\__ \ │
# │ |_|\___||___/\__|___/ │
# │ │
# ╚──────────────────────────╝
tests:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.11, 3.12, 3.13]
fail-fast: false
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 interrogate
run: uv run interrogate
- name: Run codespell
run: uv run codespell --check-filenames
- name: Run pytest
run: uv run pytest --cov contraqctor
- name: Build
run: uv build
# ╔───────────────────────────────────────────────────────────╗
# │ ____ ___ ____ ____ ____ _ │
# │ / ___|_ _/ ___| _ \ | _ \ ___| | ___ __ _ ___ ___ │
# │ | | | | | | | | | | |_) / _ \ |/ _ \/ _` / __|/ _ \ │
# │ | |___ | | |___| |_| | | _ < __/ | __/ (_| \__ \ __/ │
# │ \____|___\____|____/ |_| \_\___|_|\___|\__,_|___/\___| │
# │ │
# ╚───────────────────────────────────────────────────────────╝
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
# Note: Bumping the rc will fail if the version is not currently an rc
# To solve it, we bump the patch and rc atomically
run: |
if uv version --bump rc --dry-run; then
uv version --bump rc
else
uv version --bump rc --bump patch
fi
- name: Commit version
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 [skip ci]" || echo "No changes to commit"
git push origin main
- name: Get version
id: get_version
shell: bash # interop with win/linux for if statement
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: Commit version
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 [skip ci]" || echo "No changes to commit"
git push origin main
- name: Build
run: uv build
- name: Publish
run: uv publish --token ${{ secrets.AIND_PYPI_TOKEN }}
# ╔─────────────────────────╗
# │ ____ │
# │ | _ \ ___ ___ ___ │
# │ | | | |/ _ \ / __/ __| │
# │ | |_| | (_) | (__\__ \ │
# │ |____/ \___/ \___|___/ │
# │ │
# ╚─────────────────────────╝
build-docs:
name: Build and deploy documentation to GitHub Pages
runs-on: ubuntu-latest
needs: github-public-release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install dependencies
run: uv sync --group docs
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Build & Deploy docs
run: uv run mkdocs gh-deploy --force