Revision fb87d7dff80139f56f3dd3c37b58e1e9cc79f02d authored by Andrey Zhavoronkov on 14 June 2023, 21:13:38 UTC, committed by GitHub on 14 June 2023, 21:13:38 UTC
<!-- Raise an issue to propose your change
(https://github.com/opencv/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution
guide](https://opencv.github.io/cvat/docs/contributing/). -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->
Manually with docker-compose.https.yml config enabled

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into the
[CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Nikita Manovich <nikita@cvat.ai>
1 parent b19e925
Raw File
helm.yml
name: Helm
on:
  push:
    branches:
      - 'master'
      - 'develop'
  pull_request:
    types: [edited, ready_for_review, opened, synchronize, reopened]
    paths-ignore:
      - 'site/**'
      - '**/*.md'
  workflow_dispatch:

jobs:
  testing:
    if: |
      github.event.pull_request.draft == false &&
      !startsWith(github.event.pull_request.title, '[WIP]') &&
      !startsWith(github.event.pull_request.title, '[Dependent]')
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3

    - name: Start minikube
      uses: medyagh/setup-minikube@latest
      with:
        cpus: max
        memory: max

    - name: Try the cluster!
      run: kubectl get pods -A

    - name: Build images
      run: |
        export SHELL=/bin/bash
        eval $(minikube -p minikube docker-env)
        docker compose -f docker-compose.yml -f docker-compose.dev.yml build
        echo -n "verifying images:"
        docker images

    - uses: azure/setup-helm@v3
      with:
        version: 'v3.9.4'

    - name: Deploy to minikube
      run: |
        printf "  service:\n    externalIPs:\n      - $(minikube ip)\n" >> tests/values.test.yaml
        cd helm-chart
        helm dependency update
        cd ..
        helm upgrade -n default release-${{ github.run_id }}-${{ github.run_attempt }} -i --create-namespace helm-chart -f helm-chart/values.yaml -f tests/values.test.yaml

    - name: Update test config
      run: |
        sed -i -e 's$http://localhost:8080$http://cvat.local:80$g' tests/python/shared/utils/config.py
        find tests/python/shared/assets/ -type f -name '*.json' | xargs sed -i -e 's$http://localhost:8080$http://cvat.local$g'
        echo "$(minikube ip) cvat.local" | sudo tee -a /etc/hosts

    - name: Wait for CVAT to be ready
      run: |
        max_tries=60
        while [[ $(kubectl get pods -l component=server -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" && max_tries -gt 0 ]]; do echo "waiting for CVAT pod" && (( max_tries-- )) && sleep 5; done
        while [[ $(kubectl get pods -l app.kubernetes.io/name=postgresql -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" && max_tries -gt 0 ]]; do echo "waiting for DB pod" && (( max_tries-- )) && sleep 5; done
        while [[ $(curl -s -o /tmp/server_response -w "%{http_code}" cvat.local/api/server/about) != "200" && max_tries -gt 0 ]]; do echo "waiting for CVAT" && (( max_tries-- )) && sleep 5; done
        kubectl get pods
        kubectl logs $(kubectl get pods -l component=server -o jsonpath='{.items[0].metadata.name}')


    - name: Generate SDK
      run: |
        pip3 install --user -r cvat-sdk/gen/requirements.txt
        ./cvat-sdk/gen/generate.sh

    - name: Install test requirements
      run: |
        pip3 install --user cvat-sdk/
        pip3 install --user cvat-cli/
        pip3 install --user -r tests/python/requirements.txt

    - name: REST API and SDK tests
      # We don't have external services in Helm tests, so we ignore corresponding cases
      # They are still tested without Helm
      run: |
        kubectl cp tests/mounted_file_share/images $(kubectl get pods -l component=server -o jsonpath='{.items[0].metadata.name}'):/home/django/share
        pytest --timeout 30 --platform=kube -m "not with_external_services" tests/python --log-cli-level DEBUG

    - name: Creating a log file from "cvat" container logs
      if: failure()
      env:
          LOGS_DIR: "${{ github.workspace }}/rest_api_testing"
      run: |
        mkdir ${LOGS_DIR}
        kubectl logs $(kubectl get pods -l component=server -o 'jsonpath={.items[0].metadata.name}') >${LOGS_DIR}/cvat_server.log
        kubectl logs $(kubectl get pods -l component=worker-import -o 'jsonpath={.items[0].metadata.name}') >${LOGS_DIR}/cvat_worker_import.log
        kubectl logs $(kubectl get pods -l component=worker-export -o 'jsonpath={.items[0].metadata.name}') >${LOGS_DIR}/cvat_worker_export.log
        kubectl logs $(kubectl get pods -l component=worker-webhooks -o 'jsonpath={.items[0].metadata.name}') >${LOGS_DIR}/cvat_worker_webhooks.log
        kubectl logs $(kubectl get pods -l app.kubernetes.io/name=traefik -o 'jsonpath={.items[0].metadata.name}') >${LOGS_DIR}/traefik.log

    - name: Uploading "cvat" container logs as an artifact
      if: failure()
      uses: actions/upload-artifact@v3.1.1
      with:
        name: rest_api_container_logs
        path: "${{ github.workspace }}/rest_api_testing"
back to top