diff --git a/.github/workflow/check_comments.sh b/.github/workflows/check_comments.sh similarity index 100% rename from .github/workflow/check_comments.sh rename to .github/workflows/check_comments.sh diff --git a/.github/workflow/comment-check.yml b/.github/workflows/comment-check.yml similarity index 62% rename from .github/workflow/comment-check.yml rename to .github/workflows/comment-check.yml index 0f21c782..4c89e659 100644 --- a/.github/workflow/comment-check.yml +++ b/.github/workflows/comment-check.yml @@ -1,12 +1,10 @@ -name: Comment Check +name: Check comments percentage on: push: branches: - main - pull_request: - branches: - - main + - '*' jobs: build: @@ -16,6 +14,9 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Give execute permission for script + run: chmod +x ./.github/workflows/check_comments.sh + - name: Check comment percentage run: | ./.github/workflows/check_comments.sh diff --git a/.github/workflows/docker-compose-test.yml b/.github/workflows/docker-compose-test.yml new file mode 100644 index 00000000..a78d5787 --- /dev/null +++ b/.github/workflows/docker-compose-test.yml @@ -0,0 +1,44 @@ +name: Docker Compose Test + +on: + push: + branches: + - main + - '*' + +jobs: + Test_Nano_Docker: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v2 + # Exculding inference because it needs .oonx and .ini files, which are private + # Add docker-compose.override.yml to overcome CPU higher than 1 in pilot service + - name: Docker compose build (root without inference) + run: docker-compose -f docker-compose.yml -f docker-compose.override.yml build $(docker-compose -f docker-compose.yml -f docker-compose.override.yml config --services | grep -v inference) + + # Make sure it would run good for at least 30 seconds + - name: Docker compose up (root without inference) + run: | + docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d $(docker-compose -f docker-compose.yml -f docker-compose.override.yml config --services | grep -v inference) + sleep 30 + docker-compose -f docker-compose.yml -f docker-compose.override.yml down + + + Test_Pi_Docker: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v2 + # Build the Docker services: This validates the build process and catches issues related to the Dockerfile and dependencies. + - name: Docker compose build (raspi) + run: docker-compose -f raspi/docker-compose.yml build + + # Run (up): Ensures that the application behaves correctly in a containerized environment. + - name: Docker compose up (raspi) + run: | + docker-compose -f raspi/docker-compose.yml up -d + sleep 30 + docker-compose -f raspi/docker-compose.yml down diff --git a/.github/workflows/python-CI.yml b/.github/workflows/python-CI.yml new file mode 100644 index 00000000..f032c560 --- /dev/null +++ b/.github/workflows/python-CI.yml @@ -0,0 +1,34 @@ +name: Python CI + +on: + push: + branches: + - main + - '*' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black + - name: Check code formatting with Black on changed files + run: | + FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.py$' | xargs) + if [ ! -z "$FILES" ]; then + # Check the formatting of those files with black + black --check $FILES + else + echo "No Python files have changed." + fi diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 00000000..68fcda94 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,5 @@ +version: '3' # or whatever version you're using + +services: + pilot: + cpuset: '' # Clearing the CPU set constraint for testing diff --git a/docker-compose.yml b/docker-compose.yml index 29d3fa61..e9542ba5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "2" +version: '2' volumes: volume_zerotier_config: volume_wireguard_config: @@ -10,12 +10,12 @@ volumes: volume_byodr_sessions: services: zerotier: - cpuset: "0" + cpuset: '0' image: zyclonite/zerotier:1.6.6 restart: always network_mode: host devices: - - "/dev/net/tun" + - '/dev/net/tun' cap_add: - SYS_ADMIN - NET_ADMIN @@ -23,13 +23,13 @@ services: volumes: - volume_zerotier_config:/var/lib/zerotier-one:rw wireguard: - cpuset: "0" + cpuset: '0' image: masipcat/wireguard-go container_name: wireguard restart: always network_mode: host devices: - - "/dev/net/tun" + - '/dev/net/tun' cap_add: - SYS_ADMIN - NET_ADMIN @@ -37,49 +37,49 @@ services: volumes: - volume_wireguard_config:/etc/wireguard:rw httpd: - cpuset: "0" + cpuset: '0' build: context: . dockerfile: httpd/Dockerfile restart: always network_mode: host - command: ["python", "wrap.py"] + command: ['python', 'wrap.py'] stop_signal: SIGKILL volumes: - volume_byodr_config:/config:rw ftpd: - cpuset: "0" + cpuset: '0' build: context: . dockerfile: ftpd/Dockerfile restart: always - command: ["python3", "wrap.py"] + command: ['python3', 'wrap.py'] stop_signal: SIGKILL ports: - - "21:21" - - "30000-30009:30000-30009" + - '21:21' + - '30000-30009:30000-30009' volumes: - volume_ftpd_config:/etc/pureftpd:rw - volume_byodr_sessions:/home/ftpuser:rw rosnode: - cpuset: "0" + cpuset: '0' build: context: . dockerfile: rosnode/Dockerfile restart: always - command: ["python3", "app.py", "--name", "rosnode"] + command: ['python3', 'app.py', '--name', 'rosnode'] network_mode: host stop_signal: SIGKILL volumes: - volume_byodr_sockets:/byodr:rw - volume_byodr_config:/config:ro mongodb: - cpuset: "0" + cpuset: '0' build: context: . dockerfile: mongodb/Dockerfile restart: always - command: ["python3", "wrap.py"] + command: ['python3', 'wrap.py'] network_mode: host stop_signal: SIGKILL environment: @@ -89,17 +89,12 @@ services: - volume_mongodb_config:/config:rw - volume_mongodb_data:/data/db:rw teleop: - cpuset: "0" + cpuset: '0' build: context: . dockerfile: teleop/Dockerfile restart: always - command: - [ - "sh", - "-c", - "python3 -m teleop.app --name teleop --routes /sessions/routes", - ] + command: ['sh', '-c', 'python3 -m teleop.app --name teleop --routes /sessions/routes'] network_mode: host environment: LD_PRELOAD: libgomp.so.1 @@ -108,12 +103,12 @@ services: - volume_byodr_config:/config:rw - volume_byodr_sessions:/sessions:rw vehicle: - cpuset: "1" + cpuset: '1' build: context: . dockerfile: vehicles/rover/rover_vehicle.dockerfile restart: always - command: ["python", "app.py", "--name", "vehicle"] + command: ['python', 'app.py', '--name', 'vehicle'] privileged: true # NvMedia device creation for omx decoder. network_mode: host environment: @@ -122,24 +117,15 @@ services: - volume_byodr_sockets:/byodr:rw - volume_byodr_config:/config:rw pilot: - cpuset: "2" + cpuset: '2' build: context: . dockerfile: pilot/Dockerfile restart: always privileged: true # Access to usb devices without udev rules. - command: - [ - "python3", - "-m", - "pilot.app", - "--name", - "pilot", - "--routes", - "/sessions/routes", - ] + command: ['python3', '-m', 'pilot.app', '--name', 'pilot', '--routes', '/sessions/routes'] ports: - - "8082:8082" + - '8082:8082' environment: LD_PRELOAD: libgomp.so.1 volumes: @@ -153,20 +139,10 @@ services: dockerfile: inference/runtime-cp36-jp441.dockerfile restart: always privileged: true - command: - [ - "python3", - "-m", - "inference.app", - "--user", - "/sessions/models", - "--routes", - "/sessions/routes", - ] + command: ['python3', '-m', 'inference.app', '--user', '/sessions/models', '--routes', '/sessions/routes'] environment: LD_PRELOAD: libgomp.so.1 - OMP_PLACES: "{3}" + OMP_PLACES: '{3}' volumes: - volume_byodr_sockets:/byodr:rw - volume_byodr_config:/config:ro - - volume_byodr_sessions:/sessions:rw \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b2d47c07..00000000 --- a/requirements.txt +++ /dev/null @@ -1,24 +0,0 @@ -cachetools==5.3.0 -can==0.0.0 -carla==0.9.14 -ConfigParser==5.3.0 -Equation==1.2.01 -geographiclib==2.0 -gpiozero==1.6.2 -numpy==1.24.2 -onnxruntime==1.14.1 -opencv_python==4.7.0.72 -pandas==1.5.3 -pymodbus==3.2.2 -pymongo==4.3.3 -pyserial==3.5 -pyueye==4.96.952 -pyusb==1.2.1 -pyvesc==1.0.5 -pyzmq==25.0.2 -requests==2.28.2 -scikit_learn==1.2.2 -scipy==1.10.1 -simple_pid==1.0.1 -six==1.16.0 -tornado==6.2