Skip to content

Commit 6758d60

Browse files
authored
Merge pull request #35 from LucaKro/gcs_and_docker
[docs and docker] added gcs examples and added semantic world docker
2 parents f1fef6a + 0ed95af commit 6758d60

16 files changed

Lines changed: 2712 additions & 19 deletions
Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
11
name: deploy-book
2+
defaults:
3+
run:
4+
shell: bash -ieo pipefail {0}
25

36
# Run this when the master or main branch changes
47
on:
58
push:
69
branches:
710
- main
11+
812
# If your git repository has the Jupyter Book within some-subfolder next to
913
# unrelated files, you can make this run only if a file within that specific
1014
# folder has been modified.
1115
#
1216
# paths:
1317
# - some-subfolder/**
18+
pull_request:
19+
branches:
20+
- main
1421

1522
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
1623
jobs:
1724
deploy-book:
1825
runs-on: ubuntu-latest
26+
container:
27+
image: "pycram/semantic_world:jazzy"
1928
permissions:
2029
pages: write
2130
id-token: write
2231
steps:
2332
- uses: actions/checkout@v4
24-
25-
# Install dependencies
26-
- name: Set up Python 3.10
27-
uses: actions/setup-python@v5
2833
with:
29-
python-version: '3.10'
30-
cache: pip # Implicitly uses requirements.txt for cache key
31-
34+
path: "ros/src/semantic_world"
35+
repository: ${{ github.repository }}
36+
ref: ${{ github.ref }}
37+
submodules: 'false'
38+
39+
- name: Update semantic_world source files
40+
run: |
41+
rm -rf /opt/ros/overlay_ws/src/semantic_world/*
42+
cd /opt/ros/overlay_ws/src/semantic_world
43+
rm -rf .git .github .gitignore .gitmodules .readthedocs.yaml
44+
cp -r /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ros/src/semantic_world /opt/ros/overlay_ws/src
45+
3246
- name: Install dependencies
3347
run: |
3448
sudo apt-get update
35-
sudo apt install graphviz graphviz-dev
49+
cd /opt/ros/overlay_ws/src/semantic_world
50+
source ../semantic_world-venv/bin/activate
3651
pip install -U pip && pip install -r requirements.txt && pip install . && pip install -r doc/requirements.txt
3752
3853
# (optional) Cache your executed notebooks between runs
@@ -48,15 +63,19 @@ jobs:
4863
# Build the book
4964
- name: Build the book
5065
run: |
66+
cd /opt/ros/overlay_ws/src/semantic_world
67+
source ../semantic_world-venv/bin/activate
5168
jupyter-book build doc
5269
5370
# Upload the book's HTML as an artifact
5471
- name: Upload artifact
72+
if: github.event_name == 'push'
5573
uses: actions/upload-pages-artifact@v3
5674
with:
57-
path: "doc/_build/html"
75+
path: "/opt/ros/overlay_ws/src/semantic_world/doc/_build/html"
5876

5977
# Deploy the book's HTML to GitHub Pages
6078
- name: Deploy to GitHub Pages
79+
if: github.event_name == 'push'
6180
id: deployment
62-
uses: actions/deploy-pages@v4
81+
uses: actions/deploy-pages@v4
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Jupyter Notebook Examples
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
# ----------------------------------------------------------------------------------------------------------------------
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
working-directory: .
17+
18+
jobs:
19+
test-and-build:
20+
name: Test Jupyter Notebooks
21+
runs-on: ubuntu-latest
22+
container:
23+
image: "pycram/semantic_world:jazzy"
24+
25+
steps:
26+
27+
- name: Checkout semantic_world
28+
uses: actions/checkout@v3
29+
with:
30+
path: "ros/src/semantic_world"
31+
repository: ${{ github.repository }}
32+
ref: ${{ github.ref }}
33+
submodules: "false"
34+
35+
# For debugging
36+
- name: Setup tmate session
37+
uses: mxschmitt/action-tmate@v3
38+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
39+
40+
- name: Update semantic_world source files
41+
run: |
42+
rm -rf /opt/ros/overlay_ws/src/semantic_world/*
43+
cd /opt/ros/overlay_ws/src/semantic_world
44+
rm -rf .git .github .gitignore .gitmodules .readthedocs.yaml
45+
cp -r /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ros/src/semantic_world /opt/ros/overlay_ws/src
46+
47+
# ----------------------------------------------------------------------------------------------------------------
48+
49+
- name: Install python dependencies
50+
run: |
51+
source /opt/ros/overlay_ws/src/semantic_world-venv/bin/activate
52+
pip install --upgrade pip --root-user-action=ignore
53+
cd /opt/ros/overlay_ws/src/semantic_world
54+
pip install -r requirements.txt
55+
pip install jupytext treon
56+
pip install -e .
57+
58+
# ----------------------------------------------------------------------------------------------------------------
59+
- name: Convert Notebooks
60+
run: |
61+
source /opt/ros/overlay_ws/src/semantic_world-venv/bin/activate
62+
cd /opt/ros/overlay_ws/src/semantic_world/examples
63+
rm -rf tmp
64+
mkdir tmp
65+
python -m jupytext --to notebook *.md
66+
mv *.ipynb tmp && cd tmp
67+
68+
- name: Run tests
69+
run: |
70+
source /opt/ros/overlay_ws/install/setup.bash
71+
source /opt/ros/overlay_ws/src/semantic_world-venv/bin/activate
72+
cd /opt/ros/overlay_ws/src/semantic_world/examples/tmp
73+
python -m treon --thread 1 -v --exclude=migrate_neems.ipynb --exclude=improving_actions.ipynb
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: update_docker
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'docker/Dockerfile'
8+
# only run when a commit has changes in the requirements.txt file
9+
10+
jobs:
11+
build_and_push_docker_image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Docker Buildx
16+
id: buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: log into Docker Hub #Set repository secrets in github secrets
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_PASS }}
24+
25+
- name: Build and push
26+
uses: docker/build-push-action@v5
27+
with:
28+
context: ./docker
29+
push: true
30+
tags: pycram/semantic_world:jazzy

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ __pycache__
33
.idea
44
.hypothesis
55
_build
6-
*.egg-info
6+
*.egg-info
7+
build

doc/_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Learn more at https://jupyterbook.org/customize/config.html
33

44
title: Semantic World
5-
author: Tom Schierenbeck
5+
author: AICOR Institute for Artificial Intelligence
66
# logo: logo.png
77

88
# Force re-execution of notebooks on each build.
@@ -43,7 +43,7 @@ sphinx:
4343

4444
# Information about where the book exists on the web
4545
repository:
46-
url: https://github.com/tomsch420/semantic_world # Online location of your book
46+
url: https://github.com/cram2/semantic_world # Online location of your book
4747
path_to_book: doc # Optional path to your book, relative to the repository root
4848
branch: main # Which branch of the repository should be used when creating links (optional)
4949

doc/_toc.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33

44
format: jb-book
55
root: intro
6-
chapters:
7-
- file: bibliography
8-
- file: kinematic_world
9-
- file: autoapi/index
10-
- file: style_guide
6+
parts:
7+
- caption: Concepts
8+
chapters:
9+
- file: kinematic_world
10+
- file: style_guide
11+
- caption: Examples
12+
chapters:
13+
- file: examples/graph_of_convex_sets
14+
- caption: References
15+
chapters:
16+
- file: autoapi/index
17+
- file: bibliography

doc/conf.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
import os
16+
import sys
17+
sys.path.insert(0, os.path.abspath(os.path.join("..", "src", "semantic_world")))
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = 'semantic_world'
22+
copyright = '2025, AICOR Institute for Artificial Intelligence'
23+
author = 'AICOR Institute for Artificial Intelligence'
24+
25+
# The short X.Y version
26+
version = ''
27+
# The full version, including alpha/beta/rc tags
28+
release = ''

doc/examples

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../examples/

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ matplotlib
33
numpy
44
sphinx-autoapi
55
sphinxcontrib-plantuml
6-
pylint
6+
pylint

docker/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# has to be called from the root dir of the repo with "sudo docker build -f docker/ros2/Dockerfile ." otherwise COPY will
2+
# not work
3+
4+
ARG FROM_IMAGE=ros:jazzy
5+
ARG OVERLAY_WS=/opt/ros/overlay_ws
6+
7+
FROM $FROM_IMAGE as builder
8+
ARG OVERLAY_WS=/opt/ros/overlay_ws
9+
WORKDIR $OVERLAY_WS/src
10+
SHELL ["/bin/bash", "-c"]
11+
12+
RUN apt update && apt install python3.12-venv ros-jazzy-xacro python3-vcstool git ros-dev-tools default-jre graphviz graphviz-dev -y
13+
RUN vcs import --input https://raw.githubusercontent.com/cram2/semantic_world/main/rosinstall/semantic_world-https.rosinstall
14+
RUN source /opt/ros/jazzy/setup.bash && cd $OVERLAY_WS && colcon build --symlink-install
15+
RUN echo "source $OVERLAY_WS/install/setup.bash" >> ~/.bashrc
16+
17+
RUN python3 -m venv semantic_world-venv --system-site-packages && source semantic_world-venv/bin/activate && pip install -U pip && pip install -U setuptools && pip install -r $OVERLAY_WS/src/semantic_world/requirements.txt
18+
19+
COPY entrypoint.sh /
20+
ENTRYPOINT ["bash", "/entrypoint.sh"]

0 commit comments

Comments
 (0)