|
|
|
|
@ -5,17 +5,8 @@ on:
|
|
|
|
|
ref:
|
|
|
|
|
type: string
|
|
|
|
|
required: true
|
|
|
|
|
secrets:
|
|
|
|
|
DOCKERHUB_CI_WORKSPACE:
|
|
|
|
|
required: true
|
|
|
|
|
DOCKERHUB_CI_USERNAME:
|
|
|
|
|
required: true
|
|
|
|
|
DOCKERHUB_CI_TOKEN:
|
|
|
|
|
required: true
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
SERVER_IMAGE_TEST_REPO: cvat_server
|
|
|
|
|
UI_IMAGE_TEST_REPO: cvat_ui
|
|
|
|
|
WORKFLOW_RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
@ -48,18 +39,8 @@ jobs:
|
|
|
|
|
build:
|
|
|
|
|
needs: search_cache
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
env:
|
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
with:
|
|
|
|
|
ref: ${{ inputs.ref }}
|
|
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
|
with:
|
|
|
|
|
username: ${{ secrets.DOCKERHUB_CI_USERNAME }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_CI_TOKEN }}
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
|
|
- name: CVAT server. Getting cache from the default branch
|
|
|
|
|
uses: actions/cache@v3
|
|
|
|
|
@ -67,40 +48,28 @@ jobs:
|
|
|
|
|
path: /tmp/cvat_cache_server
|
|
|
|
|
key: ${{ runner.os }}-build-server-${{ needs.search_cache.outputs.sha }}
|
|
|
|
|
|
|
|
|
|
- name: Getting CVAT UI cache from the default branch
|
|
|
|
|
- name: CVAT UI. Getting cache from the default branch
|
|
|
|
|
uses: actions/cache@v3
|
|
|
|
|
with:
|
|
|
|
|
path: /tmp/cvat_cache_ui
|
|
|
|
|
key: ${{ runner.os }}-build-ui-${{ needs.search_cache.outputs.sha }}
|
|
|
|
|
|
|
|
|
|
- name: CVAT server. Extract metadata (tags, labels) for Docker
|
|
|
|
|
id: meta-server
|
|
|
|
|
uses: docker/metadata-action@master
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ secrets.DOCKERHUB_CI_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
|
|
|
|
|
tags: |
|
|
|
|
|
type=raw,value=${{ inputs.ref }}
|
|
|
|
|
|
|
|
|
|
- name: CVAT UI. Extract metadata (tags, labels) for Docker
|
|
|
|
|
id: meta-ui
|
|
|
|
|
uses: docker/metadata-action@master
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ secrets.DOCKERHUB_CI_WORKSPACE }}/${{ env.UI_IMAGE_TEST_REPO }}
|
|
|
|
|
tags: |
|
|
|
|
|
type=raw,value=${{ inputs.ref }}
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
|
|
- name: Create image directory
|
|
|
|
|
run: |
|
|
|
|
|
mkdir /tmp/cvat_server
|
|
|
|
|
mkdir /tmp/cvat_ui
|
|
|
|
|
|
|
|
|
|
- name: CVAT server. Build and push
|
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
|
with:
|
|
|
|
|
cache-from: type=local,src=/tmp/cvat_cache_server
|
|
|
|
|
context: .
|
|
|
|
|
file: Dockerfile
|
|
|
|
|
push: true
|
|
|
|
|
tags: ${{ steps.meta-server.outputs.tags }}
|
|
|
|
|
labels: ${{ steps.meta-server.outputs.labels }}
|
|
|
|
|
tags: cvat/server
|
|
|
|
|
outputs: type=docker,dest=/tmp/cvat_server/image.tar
|
|
|
|
|
|
|
|
|
|
- name: CVAT UI. Build and push
|
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
|
@ -108,12 +77,23 @@ jobs:
|
|
|
|
|
cache-from: type=local,src=/tmp/cvat_cache_ui
|
|
|
|
|
context: .
|
|
|
|
|
file: Dockerfile.ui
|
|
|
|
|
push: true
|
|
|
|
|
tags: ${{ steps.meta-ui.outputs.tags }}
|
|
|
|
|
labels: ${{ steps.meta-ui.outputs.labels }}
|
|
|
|
|
tags: cvat/ui
|
|
|
|
|
outputs: type=docker,dest=/tmp/cvat_ui/image.tar
|
|
|
|
|
|
|
|
|
|
unit_testing:
|
|
|
|
|
needs: [build, search_cache]
|
|
|
|
|
- name: Upload CVAT server artifact
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: cvat_server
|
|
|
|
|
path: /tmp/cvat_server/image.tar
|
|
|
|
|
|
|
|
|
|
- name: Upload CVAT UI artifact
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: cvat_ui
|
|
|
|
|
path: /tmp/cvat_ui/image.tar
|
|
|
|
|
|
|
|
|
|
rest_api:
|
|
|
|
|
needs: build
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
@ -159,35 +139,69 @@ jobs:
|
|
|
|
|
load: true
|
|
|
|
|
build-args: ELK_VERSION=6.8.23
|
|
|
|
|
|
|
|
|
|
- name: CVAT server. Extract metadata (tags, labels) for Docker
|
|
|
|
|
id: meta-server
|
|
|
|
|
uses: docker/metadata-action@master
|
|
|
|
|
- name: Download CVAT server image
|
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ secrets.DOCKERHUB_CI_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
|
|
|
|
|
tags: |
|
|
|
|
|
type=raw,value=${{ inputs.ref }}
|
|
|
|
|
name: cvat_server
|
|
|
|
|
path: /tmp/cvat_server/
|
|
|
|
|
|
|
|
|
|
- name: CVAT server. Extract metadata (tags, labels) for Docker
|
|
|
|
|
id: meta-ui
|
|
|
|
|
uses: docker/metadata-action@master
|
|
|
|
|
- name: Download CVAT UI images
|
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ secrets.DOCKERHUB_CI_WORKSPACE }}/${{ env.UI_IMAGE_TEST_REPO }}
|
|
|
|
|
tags: |
|
|
|
|
|
type=raw,value=${{ inputs.ref }}
|
|
|
|
|
name: cvat_ui
|
|
|
|
|
path: /tmp/cvat_ui/
|
|
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
|
with:
|
|
|
|
|
username: ${{ secrets.DOCKERHUB_CI_USERNAME }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_CI_TOKEN }}
|
|
|
|
|
- name: Load Docker images
|
|
|
|
|
run: |
|
|
|
|
|
docker load --input /tmp/cvat_server/image.tar
|
|
|
|
|
docker load --input /tmp/cvat_ui/image.tar
|
|
|
|
|
docker image ls -a
|
|
|
|
|
|
|
|
|
|
- name: Pull CVAT images
|
|
|
|
|
- name: Running REST API tests
|
|
|
|
|
run: |
|
|
|
|
|
pip3 install --user cvat-sdk/
|
|
|
|
|
pip3 install --user -r tests/rest_api/requirements.txt
|
|
|
|
|
pytest tests/rest_api/ -s -v
|
|
|
|
|
|
|
|
|
|
- name: Creating a log file from cvat containers
|
|
|
|
|
if: failure()
|
|
|
|
|
env:
|
|
|
|
|
LOGS_DIR: "${{ github.workspace }}/rest_api"
|
|
|
|
|
run: |
|
|
|
|
|
docker pull ${{ steps.meta-server.outputs.tags }}
|
|
|
|
|
docker tag ${{ steps.meta-server.outputs.tags }} cvat/server
|
|
|
|
|
mkdir $LOGS_DIR
|
|
|
|
|
docker logs test_cvat_1 > $LOGS_DIR/cvat.log
|
|
|
|
|
docker logs test_cvat_opa_1 2> $LOGS_DIR/cvat_opa.log
|
|
|
|
|
|
|
|
|
|
- name: Uploading "cvat" container logs as an artifact
|
|
|
|
|
if: failure()
|
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
|
env:
|
|
|
|
|
LOGS_DIR: "${{ github.workspace }}/rest_api"
|
|
|
|
|
with:
|
|
|
|
|
name: container_logs
|
|
|
|
|
path: $LOGS_DIR
|
|
|
|
|
|
|
|
|
|
docker pull ${{ steps.meta-ui.outputs.tags }}
|
|
|
|
|
docker tag ${{ steps.meta-ui.outputs.tags }} cvat/ui
|
|
|
|
|
unit_testing:
|
|
|
|
|
needs: build
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
with:
|
|
|
|
|
ref: ${{ inputs.ref }}
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@master
|
|
|
|
|
|
|
|
|
|
- name: Download CVAT server image
|
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: cvat_server
|
|
|
|
|
path: /tmp/cvat_server/
|
|
|
|
|
|
|
|
|
|
- name: Load Docker images
|
|
|
|
|
run: |
|
|
|
|
|
docker load --input /tmp/cvat_server/image.tar
|
|
|
|
|
docker image ls -a
|
|
|
|
|
|
|
|
|
|
- name: Running OPA tests
|
|
|
|
|
run: |
|
|
|
|
|
@ -195,13 +209,6 @@ jobs:
|
|
|
|
|
chmod +x ./opa
|
|
|
|
|
./opa test cvat/apps/iam/rules
|
|
|
|
|
|
|
|
|
|
- name: Running REST API tests
|
|
|
|
|
run: |
|
|
|
|
|
pip3 install --user cvat-sdk/
|
|
|
|
|
pip3 install --user -r tests/rest_api/requirements.txt
|
|
|
|
|
pytest tests/rest_api/ -s -v
|
|
|
|
|
pytest tests/rest_api/ --stop-services
|
|
|
|
|
|
|
|
|
|
- name: Running unit tests
|
|
|
|
|
env:
|
|
|
|
|
HOST_COVERAGE_DATA_DIR: ${{ github.workspace }}
|
|
|
|
|
@ -232,11 +239,11 @@ jobs:
|
|
|
|
|
env:
|
|
|
|
|
LOGS_DIR: "${{ github.workspace }}/unit_testing"
|
|
|
|
|
with:
|
|
|
|
|
name: cvat_container_logs
|
|
|
|
|
name: container_logs
|
|
|
|
|
path: $LOGS_DIR
|
|
|
|
|
|
|
|
|
|
e2e_testing:
|
|
|
|
|
needs: [build, search_cache]
|
|
|
|
|
needs: build
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
strategy:
|
|
|
|
|
fail-fast: false
|
|
|
|
|
@ -257,35 +264,23 @@ jobs:
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@master
|
|
|
|
|
|
|
|
|
|
- name: CVAT server. Extract metadata (tags, labels) for Docker
|
|
|
|
|
id: meta-server
|
|
|
|
|
uses: docker/metadata-action@master
|
|
|
|
|
- name: Download CVAT server image
|
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ secrets.DOCKERHUB_CI_WORKSPACE }}/${{ env.SERVER_IMAGE_TEST_REPO }}
|
|
|
|
|
tags: |
|
|
|
|
|
type=raw,value=${{ inputs.ref }}
|
|
|
|
|
name: cvat_server
|
|
|
|
|
path: /tmp/cvat_server/
|
|
|
|
|
|
|
|
|
|
- name: CVAT UI. Extract metadata (tags, labels) for Docker
|
|
|
|
|
id: meta-ui
|
|
|
|
|
uses: docker/metadata-action@master
|
|
|
|
|
- name: Download CVAT UI image
|
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ secrets.DOCKERHUB_CI_WORKSPACE }}/${{ env.UI_IMAGE_TEST_REPO }}
|
|
|
|
|
tags: |
|
|
|
|
|
type=raw,value=${{ inputs.ref }}
|
|
|
|
|
name: cvat_ui
|
|
|
|
|
path: /tmp/cvat_ui/
|
|
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
|
with:
|
|
|
|
|
username: ${{ secrets.DOCKERHUB_CI_USERNAME }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_CI_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Pull CVAT images
|
|
|
|
|
- name: Load Docker images
|
|
|
|
|
run: |
|
|
|
|
|
docker pull ${{ steps.meta-server.outputs.tags }}
|
|
|
|
|
docker tag ${{ steps.meta-server.outputs.tags }} cvat/server
|
|
|
|
|
|
|
|
|
|
docker pull ${{ steps.meta-ui.outputs.tags }}
|
|
|
|
|
docker tag ${{ steps.meta-ui.outputs.tags }} cvat/ui
|
|
|
|
|
docker load --input /tmp/cvat_server/image.tar
|
|
|
|
|
docker load --input /tmp/cvat_ui/image.tar
|
|
|
|
|
docker image ls -a
|
|
|
|
|
|
|
|
|
|
- name: Run CVAT instance
|
|
|
|
|
run: |
|
|
|
|
|
@ -342,7 +337,7 @@ jobs:
|
|
|
|
|
if: failure()
|
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
|
with:
|
|
|
|
|
name: cvat_container_logs
|
|
|
|
|
name: container_logs
|
|
|
|
|
path: ${{ github.workspace }}/tests/cvat_${{ matrix.specs }}.log
|
|
|
|
|
|
|
|
|
|
- name: Uploading cypress screenshots as an artifact
|
|
|
|
|
|