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
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
indent_size = 4

[*.nix]
indent_size = 2

[*.{py,ipynb}]
indent_size = 4
max_line_length = 100

[*.rs]
indent_style = space
indent_size = 4

[*.{ts,svelte}]
indent_size = 2
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
use flake .
dotenv
dotenv
32 changes: 16 additions & 16 deletions .github/workflows/_docker-build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ jobs:
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/android
echo "=== Cleaning images from deleted branches ==="
# Get list of all remote branches
git ls-remote --heads origin | awk '{print $2}' | sed 's|refs/heads/||' > /tmp/active_branches.txt
# Check each docker image tag against branch list
docker images --format "{{.Repository}}:{{.Tag}}|{{.ID}}" | \
grep "ghcr.io/dimensionalos" | \
grep -v ":<none>" | \
while IFS='|' read image_ref id; do
tag=$(echo "$image_ref" | cut -d: -f2)
# Skip if tag matches an active branch
if grep -qx "$tag" /tmp/active_branches.txt; then
echo "Branch exists: $tag - keeping $image_ref"
Expand All @@ -59,15 +59,15 @@ jobs:
docker rmi "$id" 2>/dev/null || true
fi
done
rm -f /tmp/active_branches.txt
USAGE=$(df / | awk 'NR==2 {print $5}' | sed 's/%//')
echo "Pre-docker-cleanup disk usage: ${USAGE}%"
if [ $USAGE -gt 60 ]; then
echo "=== Running quick cleanup (usage > 60%) ==="
# Keep newest image per tag
docker images --format "{{.Repository}}|{{.Tag}}|{{.ID}}" | \
grep "ghcr.io/dimensionalos" | \
Expand All @@ -81,39 +81,39 @@ jobs:
{
repo=$1; tag=$2; id=$3
repo_tag = repo ":" tag
# Skip protected tags
if (tag ~ /^(main|dev|latest)$/) next
# Keep newest per tag, remove older duplicates
if (!(repo_tag in seen_combos)) {
seen_combos[repo_tag] = 1
} else {
system("docker rmi " id " 2>/dev/null || true")
}
}'
docker image prune -f
docker volume prune -f
fi
# Aggressive cleanup if still above 85%
USAGE=$(df / | awk 'NR==2 {print $5}' | sed 's/%//')
if [ $USAGE -gt 85 ]; then
echo "=== AGGRESSIVE cleanup (usage > 85%) - removing all except main/dev ==="
# Remove ALL images except main and dev tags
docker images --format "{{.Repository}}:{{.Tag}} {{.ID}}" | \
grep -E "ghcr.io/dimensionalos" | \
grep -vE ":(main|dev)$" | \
awk '{print $2}' | xargs -r docker rmi -f || true
docker container prune -f
docker volume prune -a -f
docker network prune -f
docker image prune -f
docker image prune -f
fi
echo -e "post cleanup space:\n $(df -h)"
- uses: docker/login-action@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/code-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ jobs:
- name: Fix permissions
run: |
sudo chown -R $USER:$USER ${{ github.workspace }} || true

- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Run pre-commit
id: pre-commit-first
uses: pre-commit/action@v3.0.1
continue-on-error: true

- name: Re-run pre-commit if failed initially
id: pre-commit-retry
if: steps.pre-commit-first.outcome == 'failure'
uses: pre-commit/action@v3.0.1
continue-on-error: false

- name: Commit code changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Fix permissions
run: |
sudo chown -R $USER:$USER ${{ github.workspace }} || true

- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
uses: ./.github/workflows/_docker-build-template.yml
with:
should-run: ${{
needs.check-changes.result == 'success' &&
needs.check-changes.result == 'success' &&
(needs.check-changes.outputs.dev == 'true' ||
(needs.ros-python.result == 'success' && (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.ros == 'true')))
}}
Expand Down Expand Up @@ -218,21 +218,20 @@ jobs:
# - name: Fix permissions
# run: |
# sudo chown -R $USER:$USER ${{ github.workspace }} || true
#
#
# - uses: actions/checkout@v4
# with:
# lfs: true
#
#
# - name: Configure Git LFS
# run: |
# git config --global --add safe.directory '*'
# git lfs install
# git lfs fetch
# git lfs checkout
#
#
# - name: Run module tests
# env:
# CI: "true"
# run: |
# /entrypoint.sh bash -c "pytest -m module"

12 changes: 6 additions & 6 deletions .github/workflows/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ https://code.visualstudio.com/docs/devcontainers/containers
create personal access token (classic, not fine grained)
https://github.com/settings/tokens

add permissions
add permissions
- read:packages scope to download container images and read their metadata.

and optionally,

- write:packages scope to download and upload container images and read and write their metadata.
- delete:packages scope to delete container images.

more info @ https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry

login to docker via
login to docker via

`sh
echo TOKEN | docker login ghcr.io -u GITHUB_USER --password-stdin
Expand All @@ -38,14 +38,14 @@ pull dev image (master)
docker pull ghcr.io/dimensionalos/dev:latest
`

# todo
# todo

Currently there is an issue with ensuring both correct docker image build ordering, and skipping unneccessary re-builds.

(we need job dependancies for builds to wait to their images underneath to be built (for example py waits for ros))
by default if a parent is skipped, it's children get skipped as well, unless they have always() in their conditional.

Issue is once we put always() in the conditional, it seems that no matter what other check we put in the same conditional, job will always run.
Issue is once we put always() in the conditional, it seems that no matter what other check we put in the same conditional, job will always run.
for this reason we cannot skip python (and above) builds for now. Needs review.

I think we will need to write our own build dispatcher in python that calls github workflows that build images.
11 changes: 5 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
# if: ${{ !inputs.should-run }}
# run: |
# exit 0

# - name: Free disk space
# run: |
# sudo rm -rf /opt/ghc
# sudo rm -rf /usr/share/dotnet
# sudo rm -rf /usr/local/share/boost
# sudo rm -rf /usr/local/lib/android

run-tests:
runs-on: [self-hosted, Linux]
container:
Expand All @@ -47,17 +47,16 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Fix permissions
run: |
git config --global --add safe.directory '*'
- name: Run tests
run: |
/entrypoint.sh bash -c "${{ inputs.cmd }}"
- name: check disk space
if: failure()
run: |
df -h
13 changes: 10 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,23 @@ repos:
- id: trailing-whitespace
language: python
types: [text]
stages: [pre-push]
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: check-json
- id: check-toml
- id: check-yaml
- id: pretty-format-json
name: format json
args: [ --autofix, --no-sort-keys ]

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.4.1
hooks:
- id: editorconfig-checker
alias: ec
args: [-disable-max-line-length, -disable-indentation]

# - repo: local
# hooks:
# - id: mypy
Expand All @@ -60,5 +69,3 @@ repos:
pass_filenames: false
entry: bin/lfs_check
language: script


1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
2 changes: 1 addition & 1 deletion .style.yapf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[style]
based_on_style = google
column_limit = 80
column_limit = 80
4 changes: 2 additions & 2 deletions AUTONOMY_STACK_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cd ~/autonomy_stack_mecanum_wheel_platform
| `/goal_pose` | `geometry_msgs/PoseStamped` | Send goal with orientation |
| `/cancel_goal` | `std_msgs/Bool` | Cancel current goal (data: true) |
| `/joy` | `sensor_msgs/Joy` | Joystick input |
| `/stop` | `std_msgs/Int8` | Soft Stop (2=stop all commmand, 0 = release) |
| `/stop` | `std_msgs/Int8` | Soft Stop (2=stop all commmand, 0 = release) |
| `/navigation_boundary` | `geometry_msgs/PolygonStamped` | Set navigation boundaries |
| `/added_obstacles` | `sensor_msgs/PointCloud2` | Virtual obstacles |

Expand Down Expand Up @@ -281,4 +281,4 @@ init_yaw: 0.0
mapping_line_resolution: 0.1 # Decrease for higher quality
mapping_plane_resolution: 0.2 # Decrease for higher quality
max_iterations: 5 # Increase for better accuracy
```
```
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
Loading
Loading