Skip to content

Commit ef1b88e

Browse files
authored
Merge pull request dnv-opensource#5 from dnv-opensource/setup-and-maintenance-update
Setup and maintenance update
2 parents bdab26c + eec8b23 commit ef1b88e

100 files changed

Lines changed: 8090 additions & 1323 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[paths]
2+
source =
3+
src/crane_controller
4+
*/site-packages/crane_controller
5+
6+
[run]
7+
source = crane_controller
8+
branch = True
9+
10+
[report]
11+
fail_under = 10.0
12+
show_missing = True
13+
skip_covered = True

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.{yml,yaml}]
14+
indent_style = space
15+
indent_size = 2

.gitattributes

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.py text
7+
*.cpp text
8+
*.hpp text
9+
*.c text
10+
*.h text
11+
*.json text
12+
*.xml text
13+
*.txt text
14+
*.yml text
15+
*.yaml text
16+
*.toml text
17+
*.rst text
18+
*.ini text
19+
20+
# Declare files that will always have CRLF line endings on checkout.
21+
*.vcproj text eol=crlf
22+
*.sln text eol=crlf
23+
*.md text eol=crlf
24+
25+
# Declare files that will always have LF line endings on checkout.
26+
*.sh text eol=lf
27+
28+
# Declare files that will not be normalized regardless of their content.
29+
*.jpg -text
30+
*.png -text
31+
*.gif -text
32+
*.ico -text
33+
34+
# Denote all files that are truly binary and should not be modified.
35+
*.onnx binary
36+
*.fmu binary

.github/copilot-instructions.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# GitHub Copilot – Project Instructions
2+
3+
This repository uses a **hybrid instruction model**:
4+
5+
- **Portable, tool-agnostic rules live in the repository root**
6+
- **GitHub-specific scoping and activation live under `.github/`**
7+
8+
GitHub Copilot and GitHub Agents must treat the files below as the
9+
authoritative source of project behavior.
10+
11+
---
12+
13+
## Primary Instruction Sources (Authoritative)
14+
15+
Always load and follow these files first:
16+
17+
- `/.instructions.md`
18+
Project-wide engineering rules, quality standards, and constraints.
19+
20+
- `/.prompt.md`
21+
Default working style and agent execution discipline.
22+
23+
- `/plans/plan.md` or `/plans/plan-draft.md` (when present)
24+
Explicit plan / orchestration artifact for Plan Mode workflows.
25+
The presence of `/plans/plan.md` or `/plans/plan-draft.md` indicates that a plan-first workflow is expected.
26+
`/plans/.plan.md` serves as a template and should not be modified directly.
27+
28+
These files form the **knowledge contract** for this repository and
29+
are reviewed and maintained like production code.
30+
31+
---
32+
33+
## GitHub-Scoped Instructions (Additive)
34+
35+
Additional GitHub-specific guidance MAY apply from:
36+
37+
- `.github/instructions/*.instructions.md`
38+
Narrow, scoped rules using `applyTo` (must not contradict root rules).
39+
40+
- `.github/prompts/*.prompt.md`
41+
Reusable GitHub workflows (feature implementation, reviews, refactors).
42+
43+
- `.github/agents/*.agent.md`
44+
Named agent personas, if explicitly activated.
45+
46+
GitHub-scoped files **refine or specialize** behavior.
47+
They must never redefine or override the intent of `/.instructions.md`.
48+
49+
---
50+
51+
## Precedence & Conflict Resolution
52+
53+
If multiple instructions apply, resolve conflicts in this order:
54+
55+
1. Scoped `.github/instructions/*.instructions.md` (most specific — may only **narrow or refine** root rules, never override or contradict them)
56+
2. `/.instructions.md`
57+
3. `/.prompt.md`
58+
59+
When in doubt:
60+
- Prefer correctness, testability, and clarity over speed
61+
- Ask for clarification rather than guessing
62+
63+
---
64+
65+
## Safety & Boundaries
66+
67+
- Work only within this repository
68+
- Do not assume network or internet access unless explicitly stated
69+
- Do not introduce hidden side effects, hooks, or background behavior
70+
- Do not change unrelated code opportunistically
71+
72+
All agent output is subject to human review and normal PR processes.
73+
74+
---
75+
76+
## Agent Operating Mode
77+
78+
Use a **plan-first workflow** by default:
79+
80+
1. Restate the task and assumptions
81+
2. Produce or update `plan.md` (unless instructed otherwise)
82+
3. Wait for confirmation if scope is ambiguous
83+
4. Implement incrementally
84+
5. Verify with tests
85+
6. Summarize changes and remaining risks
86+
87+
This discipline is mandatory for non-trivial changes.
88+
89+
---
90+
91+
## Intentional Non-Goals
92+
93+
- This file does **not** contain detailed coding rules
94+
(those belong in `/.instructions.md`)
95+
- This file does **not** encode organization policy or governance logic
96+
- This file avoids duplication by design
97+
98+
Less is intentional. Stability is a feature.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Build and publish documentation
2+
3+
on: workflow_call
4+
5+
env:
6+
DEFAULT_BRANCH: 'release'
7+
#SPHINXOPTS: '-W --keep-going -T'
8+
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings
9+
10+
jobs:
11+
build-and-publish-docs:
12+
name: Build and publish documentation
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout active branch
16+
uses: actions/checkout@v5
17+
with:
18+
lfs: true
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
21+
with:
22+
enable-cache: true
23+
cache-dependency-glob: 'uv.lock'
24+
- name: Install the project
25+
run: uv sync --frozen
26+
- name: Print debugging information
27+
run: |
28+
echo "github.ref:" ${{github.ref}}
29+
echo "github.event_name:" ${{github.event_name}}
30+
echo "github.head_ref:" ${{github.head_ref}}
31+
echo "github.base_ref:" ${{github.base_ref}}
32+
set -x
33+
git rev-parse --abbrev-ref HEAD
34+
git branch
35+
git branch -a
36+
git remote -v
37+
uv run python -V
38+
uv pip list
39+
40+
# Build documentation
41+
- uses: sphinx-doc/github-problem-matcher@master
42+
- name: Build documentation
43+
run: |
44+
cd docs
45+
uv run make html
46+
47+
- name: Clone and cleanup gh-pages branch
48+
run: |
49+
set -x
50+
git fetch
51+
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
52+
rm -rf _gh-pages/.git/
53+
mkdir -p _gh-pages/branch/
54+
55+
# Delete orphaned branch-folders:
56+
# Go through each subfolder in _gh-pages/branch/
57+
# If it relates to an orphaned branch, delete it.
58+
- name: Delete orphaned branch-folders
59+
run: |
60+
set -x
61+
for brdir in `ls _gh-pages/branch/` ; do
62+
brname=${brdir//--/\/} # replace '--' with '/'
63+
if ! git show-ref remotes/origin/$brname ; then
64+
echo "Removing $brdir"
65+
rm -r _gh-pages/branch/$brdir/
66+
fi
67+
done
68+
69+
# Copy documentation to _gh-pages/ (if push happened on release branch)
70+
- name: Copy documentation to _gh-pages/
71+
if: |
72+
contains(github.ref, env.DEFAULT_BRANCH)
73+
run: |
74+
set -x
75+
# Delete everything under _gh-pages/ that is from the
76+
# primary branch deployment. Excludes the other branches
77+
# _gh-pages/branch-* paths, and not including
78+
# _gh-pages itself.
79+
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete
80+
rsync -a docs/build/html/ _gh-pages/
81+
82+
# Copy documentation to _gh-pages/branch/$brname (if push happened on any other branch)
83+
# ('/' gets replaced by '--')
84+
- name: Copy documentation to _gh-pages/branch/${{github.ref}}
85+
if: |
86+
!contains(github.ref, env.DEFAULT_BRANCH)
87+
run: |
88+
set -x
89+
#brname=$(git rev-parse --abbrev-ref HEAD)
90+
brname="${{github.ref}}"
91+
brname="${brname##refs/heads/}"
92+
brdir=${brname//\//--} # replace '/' with '--'
93+
rm -rf _gh-pages/branch/${brdir}
94+
rsync -a docs/build/html/ _gh-pages/branch/${brdir}
95+
96+
# Add .nojekyll file
97+
- name: Add .nojekyll file
98+
run: touch _gh-pages/.nojekyll
99+
100+
# Publish: Commit gh-pages branch and publish it to GitHub Pages
101+
- name: Publish documentation
102+
uses: peaceiris/actions-gh-pages@v4
103+
with:
104+
publish_branch: gh-pages
105+
github_token: ${{ secrets.GITHUB_TOKEN }}
106+
publish_dir: _gh-pages/
107+
force_orphan: true
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build Package
2+
3+
on: workflow_call
4+
5+
jobs:
6+
build:
7+
name: Build source distribution
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v5
12+
with:
13+
lfs: true
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v7
16+
with:
17+
enable-cache: true
18+
cache-dependency-glob: 'uv.lock'
19+
- name: Build source distribution and wheels
20+
run: uv build
21+
- name: Check build artifacts
22+
run: uvx twine check --strict dist/*
23+
- name: Upload build artifacts
24+
uses: actions/upload-artifact@v5
25+
with:
26+
name: dist
27+
path: |
28+
dist/*.tar.gz
29+
dist/*.whl
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Code Quality
2+
3+
on: workflow_call
4+
5+
jobs:
6+
ruff_format:
7+
runs-on: ubuntu-latest
8+
name: ruff format
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v5
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v7
14+
with:
15+
enable-cache: true
16+
cache-dependency-glob: 'uv.lock'
17+
- name: Install the project
18+
run: uv sync -U
19+
- name: Run ruff format
20+
run: uv run ruff format --diff
21+
22+
ruff_check:
23+
runs-on: ubuntu-latest
24+
name: ruff check
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v5
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v7
30+
with:
31+
enable-cache: true
32+
cache-dependency-glob: 'uv.lock'
33+
- name: Install the project
34+
run: uv sync -U
35+
- name: Run ruff check
36+
run: uv run ruff check --diff
37+
38+
pyright:
39+
runs-on: ubuntu-latest
40+
name: pyright
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v5
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v7
46+
with:
47+
enable-cache: true
48+
cache-dependency-glob: 'uv.lock'
49+
- name: Install the project
50+
run: uv sync -U
51+
- name: Run pyright
52+
run: uv run pyright
53+
54+
mypy:
55+
runs-on: ubuntu-latest
56+
name: mypy
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v5
60+
- name: Install uv
61+
uses: astral-sh/setup-uv@v7
62+
with:
63+
enable-cache: true
64+
cache-dependency-glob: 'uv.lock'
65+
- name: Install the project
66+
run: uv sync -U
67+
- name: Run mypy
68+
run: uv run mypy
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Merge into release
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
RELEASE_TOKEN:
7+
required: true
8+
9+
jobs:
10+
merge_into_release:
11+
name: Merge ${{ github.event.ref }} -> release branch
12+
runs-on: ubuntu-latest
13+
environment: release
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v5
17+
with:
18+
# Fetch the whole history to prevent unrelated history errors
19+
fetch-depth: 0
20+
# The branch you want to checkout (usually equal to `branchtomerge`)
21+
# ref: ${{ github.event.ref }}
22+
- uses: devmasx/merge-branch@v1.4.0
23+
with:
24+
type: now
25+
target_branch: release
26+
github_token: ${{ secrets.RELEASE_TOKEN }}

0 commit comments

Comments
 (0)