Skip to content

Commit cc4792a

Browse files
previRoberto Previtera
and
Roberto Previtera
authored
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>
1 parent 5454eaa commit cc4792a

File tree

402 files changed

+1779
-25791
lines changed

Some content is hidden

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

402 files changed

+1779
-25791
lines changed

.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-

.github/workflows/build_backend.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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=./coderbot:./stub:./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 '^(?!(\/api\/v1\/video\/stream|\/api\/v1\/control\/move|\/api\/v1\/video\/rec|\/api\/v1\/video\/stop)$).*$' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
32+
echo "openapi test complete"
33+
34+
release-backend:
35+
#needs: [test]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Docker meta
39+
id: meta
40+
uses: docker/metadata-action@v4
41+
with:
42+
# list of Docker images to use as base name for tags
43+
images: ghcr.io/coderbotorg/backend
44+
# generate Docker tags based on the following events/attributes
45+
tags: |
46+
# always latest
47+
type=raw,value=latest
48+
# branch event
49+
type=ref,event=branch
50+
# tag event
51+
type=ref,event=tag
52+
# pull request event
53+
type=ref,event=pr
54+
# push event
55+
type=sha,enable=true,prefix=git-,format=short
56+
- uses: actions/checkout@v2 # Checking out the repo
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v2
59+
- name: Set up Docker Buildx
60+
id: buildx
61+
uses: docker/setup-buildx-action@v2
62+
- name: Login to DockerHub
63+
uses: docker/login-action@v2
64+
with:
65+
registry: ghcr.io
66+
username: ${{ github.actor }}
67+
password: ${{ secrets.GITHUB_TOKEN }}
68+
- name: Build and push
69+
uses: docker/build-push-action@v3
70+
with:
71+
push: true
72+
platforms: linux/arm/v7
73+
tags: ${{ steps.meta.outputs.tags }}
74+
context: .
75+
file: docker/Dockerfile
76+
cache-from: type=registry,ref=ghcr.io/coderbotorg/backend:latest
77+
cache-to: type=inline

.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

0 commit comments

Comments
 (0)