timeout-minutes: 1440 #349
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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==3.24.3 | |
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 | |
strategy: | |
matrix: | |
architecture: | |
- arch: linux/arm/v7 | |
dockerfile: Dockerfile | |
tag: armv7 | |
- arch: linux/arm64 | |
dockerfile: Dockerfile.arm64 | |
tag: arm64 | |
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,suffix=-${{ matrix.architecture.tag }} | |
# branch event | |
type=ref,event=branch,suffix=-${{ matrix.architecture.tag }} | |
# tag event | |
type=ref,event=tag,suffix=-${{ matrix.architecture.tag }} | |
# pull request event | |
type=ref,event=pr,suffix=-${{ matrix.architecture.tag }} | |
# push event | |
type=sha,enable=true,prefix=git-,format=short,suffix=-${{ matrix.architecture.tag }} | |
- 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@v5 | |
timeout-minutes: 1440 | |
with: | |
push: true | |
build-args: CODERBOT_VERSION=${{github.ref_name}}-${{github.sha}} | |
platforms: ${{ matrix.architecture.arch }} | |
tags: ${{ steps.meta.outputs.tags }} | |
context: . | |
file: docker/${{ matrix.architecture.dockerfile }} | |
cache-from: type=registry,ref=ghcr.io/coderbotorg/backend:latest-${{ matrix.architecture.tag }} | |
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 |