-
Notifications
You must be signed in to change notification settings - Fork 17
119 lines (114 loc) · 4.6 KB
/
build_backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# 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
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Build CoderBot backend
on: push
jobs:
test:
runs-on: ubuntu-latest
container: coderbot/coderbot-ci:3.9-bullseye-slim
steps:
- uses: actions/checkout@v3 # Checking out the repo
- run: pip install -r docker/stub/requirements.txt
- run: |
export PYTHONPATH=./coderbot:./stub:./test
mkdir test-reports
python3 -m unittest test/coderbot_test.py 2>&1 | tee test-reports/test_report.txt
python3 -m unittest test/camera_test.py 2>&1 | tee test-reports/test_report.txt
#python3 -m unittest test/cnn_test.py 2>&1 | tee test-reports/test_report.txt
echo "test complete"
- run: |
export PYTHONPATH=./stub:./coderbot:./test
python3 coderbot/main.py > coderbot.log &
sleep 30
apt-get install -y python3-venv
mkdir -p schemathesis
python3 -m venv schemathesis
. schemathesis/bin/activate
pip install schemathesis
st run --endpoint 'activities' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
#st run --endpoint 'media' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
st run --endpoint 'control/speak' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
st run --endpoint 'control/stop' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
st run --endpoint 'music' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
st run --endpoint 'programs' --hypothesis-max-examples=10 --request-timeout=20 http://localhost:5000/api/v1/openapi.json
echo "openapi test complete"
release-backend:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: ghcr.io/coderbotorg/backend
# generate Docker tags based on the following events/attributes
tags: |
# always latest
type=raw,value=latest
# branch event
type=ref,event=branch
# tag event
type=ref,event=tag
# pull request event
type=ref,event=pr
# push event
type=sha,enable=true,prefix=git-,format=short
- uses: actions/checkout@v3 # Checking out the repo
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
build-args: CODERBOT_VERSION=${{github.ref_name}}-${{github.sha}}
platforms: linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
context: .
file: docker/Dockerfile
cache-from: type=registry,ref=ghcr.io/coderbotorg/backend:latest
cache-to: type=inline
release-stub:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: ghcr.io/coderbotorg/backend
# generate Docker tags based on the following events/attributes
tags: |
# always latest
type=raw,value=stub-latest
- uses: actions/checkout@v3 # Checking out the repo
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
build-args: CODERBOT_VERSION=${{github.ref_name}}-${{github.sha}}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
context: .
file: docker/stub/Dockerfile
cache-from: type=registry,ref=ghcr.io/coderbotorg/backend:stub-latest
cache-to: type=inline