Skip to content

Commit a04ec7a

Browse files
previavivaceRoberto Previtera
authored
refactor API (#168)
* tf 2.7 * revert tf 2.1 * bump numpy ver * bump requirements_stub * bump requirements_stub * led ws2812b * led ws2812b * led ws2812b * add listMusicPackages api * fix musicPackage export * remove coderbot-copy.py * fix music package removal * v1 feature parity * fix #155 * fix program status and log with v2 * update ci * add default activity init * add default activity init * add default activity * activity default parameters * bullseye wip * bullseye wip * Update audioControls.py bullseye: "PCM" => "Headphone" * bullseye wip * Update audio.py fix audio sampling rate * update stock activities * Update program.py fix Program.load() when program non found * Update activity_default.json add "shadow" input blocks * Update coderbot.py * no longer init_activities * move init_activities on frontend for i18n * fix v4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * fix v4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * fix 4.1 bugs * Update wifi.py * Update wifi.py * add CONTRIBUTING.md (#162) Co-authored-by: previ <roberto.previtera@gmail.com> * fix event * Refactor API (#166) * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * merge remove_old_ui * merge remove_old_ui * fix merge * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * WIP #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wop #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #184 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 Co-authored-by: Roberto Previtera <roberto@MacBook-Air.station> * Refactor api v3 (#167) * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * merge remove_old_ui * merge remove_old_ui * fix merge * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * WIP #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wop #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #184 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 Co-authored-by: Roberto Previtera <roberto@MacBook-Air.station> * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 * wip #164 Co-authored-by: Antonio Vivace <avivace4@gmail.com> Co-authored-by: Roberto Previtera <roberto@MacBook-Air.station>
1 parent c889fb4 commit a04ec7a

File tree

407 files changed

+1894
-25872
lines changed

Some content is hidden

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

407 files changed

+1894
-25872
lines changed

Diff for: .circleci/config.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build:
88
docker:
99
# specify the version you desire here
10-
- image: coderbot/coderbot-ci:3.9-bullseye-ffmpeg
10+
- image: coderbot/coderbot-ci:3.9-bullseye
1111

1212
working_directory: ~/repo
1313

@@ -39,7 +39,7 @@ jobs:
3939
name: run tests
4040
command: |
4141
. venv/bin/activate
42-
export PYTHONPATH=./stub:test
42+
export PYTHONPATH=./coderbot:./stub:./test
4343
mkdir test-reports
4444
python3 -m unittest test/coderbot_test.py 2>&1 | tee test-reports/test_report.txt
4545
python3 -m unittest test/camera_test.py 2>&1 | tee test-reports/test_report.txt
@@ -51,4 +51,3 @@ jobs:
5151

5252
- store_test_results:
5353
path: test-reports/
54-

Diff for: .github/workflows/build_backend.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: build CoderBot backend
5+
6+
on: push
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
container: coderbot/coderbot-ci:3.9-bullseye-slim
12+
steps:
13+
- uses: actions/checkout@v3 # Checking out the repo
14+
- run: pip install -r requirements_stub.txt
15+
- run: |
16+
export PYTHONPATH=./coderbot:./stub:./test
17+
mkdir test-reports
18+
python3 -m unittest test/coderbot_test.py 2>&1 | tee test-reports/test_report.txt
19+
python3 -m unittest test/camera_test.py 2>&1 | tee test-reports/test_report.txt
20+
#python3 -m unittest test/cnn_test.py 2>&1 | tee test-reports/test_report.txt
21+
echo "test complete"
22+
- run: |
23+
export PYTHONPATH=./stub:./coderbot:./test
24+
python3 coderbot/main.py > coderbot.log &
25+
sleep 30
26+
apt-get install -y python3-venv
27+
mkdir -p schemathesis
28+
python3 -m venv schemathesis
29+
. schemathesis/bin/activate
30+
pip install schemathesis
31+
st run --endpoint 'activities' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
32+
#st run --endpoint 'media' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
33+
st run --endpoint 'control/speak' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
34+
st run --endpoint 'control/stop' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
35+
st run --endpoint 'music' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
36+
st run --endpoint 'programs' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
37+
echo "openapi test complete"
38+
39+
release-backend:
40+
needs: [test]
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Docker meta
44+
id: meta
45+
uses: docker/metadata-action@v4
46+
with:
47+
# list of Docker images to use as base name for tags
48+
images: ghcr.io/coderbotorg/backend
49+
# generate Docker tags based on the following events/attributes
50+
tags: |
51+
# always latest
52+
type=raw,value=latest
53+
# branch event
54+
type=ref,event=branch
55+
# tag event
56+
type=ref,event=tag
57+
# pull request event
58+
type=ref,event=pr
59+
# push event
60+
type=sha,enable=true,prefix=git-,format=short
61+
- uses: actions/checkout@v2 # Checking out the repo
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v2
64+
- name: Set up Docker Buildx
65+
id: buildx
66+
uses: docker/setup-buildx-action@v2
67+
- name: Login to DockerHub
68+
uses: docker/login-action@v2
69+
with:
70+
registry: ghcr.io
71+
username: ${{ github.actor }}
72+
password: ${{ secrets.GITHUB_TOKEN }}
73+
- name: Build and push
74+
uses: docker/build-push-action@v3
75+
with:
76+
push: true
77+
platforms: linux/arm/v7
78+
tags: ${{ steps.meta.outputs.tags }}
79+
context: .
80+
file: docker/Dockerfile
81+
cache-from: type=registry,ref=ghcr.io/coderbotorg/backend:latest
82+
cache-to: type=inline

Diff for: .gitignore

+7-14
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,21 @@
3333
*.sqlite
3434

3535
# Pictures taken
36-
photos/*.jpg
37-
photos/*.mp4
38-
photos/*.h264
39-
photos/*.json
36+
media/*.jpeg
37+
media/*.mp4
4038
saved_photos
4139

4240
#cnn models
4341
cnn_models/*
44-
cnn_models/cache/*
4542

4643
# Sounds recorded
4744
sounds/*.wav
4845

4946
# Logs
5047
logs/*.log
51-
logs/*.log.*
5248

5349
# User programs
54-
data/*.data
55-
56-
# Tutorial
57-
static/blockly-tutorial
50+
data/*.json
5851

5952
# OS generated files #
6053
######################
@@ -88,12 +81,12 @@ coderbot.cfg
8881

8982
swagger-ui/
9083

91-
# Photos
92-
photos/metadata.json
93-
9484
# Uploaded updates folder
95-
updatePackages/
85+
updatePackages
9686

9787
# firmware
9888
firmware/
9989

90+
# test
91+
cassette.yaml
92+
.hypothesis

Diff for: activity.py

-45
This file was deleted.

0 commit comments

Comments
 (0)