Skip to content

Commit

Permalink
Extend SDK layer 1 docs (cvat-ai#5011)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max authored Oct 5, 2022
1 parent bcb3f9b commit 426f8e3
Show file tree
Hide file tree
Showing 24 changed files with 997 additions and 426 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Create image directory
- name: Create artifact directories
run: |
mkdir /tmp/cvat_server
mkdir /tmp/cvat_ui
mkdir /tmp/cvat_sdk
- name: CVAT server. Build
- name: CVAT server. Build and push
uses: docker/build-push-action@v3
with:
cache-from: type=local,src=/tmp/cvat_cache_server
Expand All @@ -78,7 +79,7 @@ jobs:
tags: cvat/server
outputs: type=docker,dest=/tmp/cvat_server/image.tar

- name: CVAT UI. Build
- name: CVAT UI. Build and push
uses: docker/build-push-action@v3
with:
cache-from: type=local,src=/tmp/cvat_cache_ui
Expand All @@ -87,6 +88,18 @@ jobs:
tags: cvat/ui
outputs: type=docker,dest=/tmp/cvat_ui/image.tar

- name: CVAT SDK. Build
run: |
docker run --rm -v ${PWD}/cvat-sdk/schema/:/transfer \
--entrypoint /bin/bash -u root cvat/server \
-c 'python manage.py spectacular --file /transfer/schema.yml'
pip3 install --user -r cvat-sdk/gen/requirements.txt
cd cvat-sdk/
gen/generate.sh
cd ..
cp -r cvat-sdk/* /tmp/cvat_sdk/
- name: Upload CVAT server artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -99,6 +112,12 @@ jobs:
name: cvat_ui
path: /tmp/cvat_ui/image.tar

- name: Upload CVAT SDK artifact
uses: actions/upload-artifact@v3
with:
name: cvat_sdk
path: /tmp/cvat_sdk/

rest_api:
needs: build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -158,6 +177,12 @@ jobs:
name: cvat_ui
path: /tmp/cvat_ui/

- name: Download CVAT SDK package
uses: actions/download-artifact@v3
with:
name: cvat_sdk
path: /tmp/cvat_sdk/

- name: Load Docker images
run: |
docker load --input /tmp/cvat_server/image.tar
Expand All @@ -168,15 +193,7 @@ jobs:
- name: Running REST API and SDK tests
run: |
docker run --rm -v ${PWD}/cvat-sdk/schema/:/transfer \
--entrypoint /bin/bash -u root cvat/server \
-c 'python manage.py spectacular --file /transfer/schema.yml'
pip3 install --user -r cvat-sdk/gen/requirements.txt
cd cvat-sdk/
gen/generate.sh
cd ..
pip3 install --user cvat-sdk/
pip3 install --user /tmp/cvat_sdk/
pip3 install --user cvat-cli/
pip3 install --user -r tests/python/requirements.txt
pytest tests/python -s -v
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/github_pages.yml

This file was deleted.

100 changes: 86 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Create image directory
- name: Create artifact directories
run: |
mkdir /tmp/cvat_server
mkdir /tmp/cvat_ui
mkdir /tmp/cvat_sdk
- name: CVAT server. Build and push
uses: docker/build-push-action@v3
Expand All @@ -88,6 +89,18 @@ jobs:
tags: cvat/ui
outputs: type=docker,dest=/tmp/cvat_ui/image.tar

- name: CVAT SDK. Build
run: |
docker run --rm -v ${PWD}/cvat-sdk/schema/:/transfer \
--entrypoint /bin/bash -u root cvat/server \
-c 'python manage.py spectacular --file /transfer/schema.yml'
pip3 install --user -r cvat-sdk/gen/requirements.txt
cd cvat-sdk/
gen/generate.sh
cd ..
cp -r cvat-sdk/* /tmp/cvat_sdk/
- name: Upload CVAT server artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -100,7 +113,13 @@ jobs:
name: cvat_ui
path: /tmp/cvat_ui/image.tar

rest_api:
- name: Upload CVAT SDK artifact
uses: actions/upload-artifact@v3
with:
name: cvat_sdk
path: /tmp/cvat_sdk/

rest_api_testing:
needs: build
runs-on: ubuntu-latest
steps:
Expand All @@ -125,6 +144,12 @@ jobs:
name: cvat_ui
path: /tmp/cvat_ui/

- name: Download CVAT SDK package
uses: actions/download-artifact@v3
with:
name: cvat_sdk
path: /tmp/cvat_sdk/

- name: Load Docker images
run: |
docker load --input /tmp/cvat_server/image.tar
Expand All @@ -135,22 +160,14 @@ jobs:
- name: Running REST API tests
run: |
docker run --rm -v ${PWD}/cvat-sdk/schema/:/transfer \
--entrypoint /bin/bash -u root cvat/server \
-c 'python manage.py spectacular --file /transfer/schema.yml'
pip3 install --user -r cvat-sdk/gen/requirements.txt
cd cvat-sdk/
gen/generate.sh
cd ..
pip3 install --user cvat-sdk/
pip3 install --user /tmp/cvat_sdk/
pip3 install --user -r tests/python/requirements.txt
pytest tests/python/rest_api -k 'GET' -s
- name: Creating a log file from cvat containers
if: failure()
env:
LOGS_DIR: "${{ github.workspace }}/rest_api"
LOGS_DIR: "${{ github.workspace }}/rest_api_testing"
run: |
mkdir $LOGS_DIR
docker logs test_cvat_server_1 > $LOGS_DIR/cvat.log
Expand All @@ -161,7 +178,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: container_logs
path: "${{ github.workspace }}/rest_api"
path: "${{ github.workspace }}/rest_api_testing"

unit_testing:
needs: build
Expand Down Expand Up @@ -320,9 +337,64 @@ jobs:
name: cypress_screenshots_${{ matrix.specs }}
path: ${{ github.workspace }}/tests/cypress/screenshots

generate_github_pages:
if: github.ref == 'refs/heads/develop'
needs: [rest_api_testing, unit_testing, e2e_testing]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

- name: Download CVAT server images
uses: actions/download-artifact@v3
with:
name: cvat_server
path: /tmp/cvat_server/

- name: Download CVAT server images
uses: actions/download-artifact@v3
with:
name: cvat_sdk
path: /tmp/cvat_sdk/

- name: Load Docker images
run: |
docker load --input /tmp/cvat_server/image.tar
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.83.1'
extended: true

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16.x'

- name: Install npm packages
working-directory: ./site
run: |
npm ci
- name: Build docs
run: |
pip install -r site/requirements.txt
python site/process_sdk_docs.py --input-dir /tmp/cvat_sdk/docs/ --site-root site/
python site/build_docs.py
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true

publish_dev_images:
if: github.ref == 'refs/heads/develop'
needs: [rest_api, unit_testing, e2e_testing]
needs: [rest_api_testing, unit_testing, e2e_testing, generate_github_pages]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,21 @@
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"name": "sdk docs: Postprocess generated docs",
"type": "python",
"request": "launch",
"justMyCode": false,
"stopOnEntry": false,
"python": "${command:python.interpreterPath}",
"program": "${workspaceFolder}/site/process_sdk_docs.py",
"args": [
"--input-dir", "${workspaceFolder}/cvat-sdk/docs/",
"--site-root", "${workspaceFolder}/site/",
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"name": "server: Generate REST API Schema",
"type": "python",
Expand Down
60 changes: 0 additions & 60 deletions cvat-sdk/gen/design.md

This file was deleted.

Loading

0 comments on commit 426f8e3

Please sign in to comment.