Skip to content

Commit fe148d4

Browse files
committed
Merge branch 'release-2.2.0'
2 parents 3bd7c7e + 79ce99a commit fe148d4

File tree

1,097 files changed

+76741
-115998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,097 files changed

+76741
-115998
lines changed

.bandit

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
# B406 : import_xml_sax
77
# B410 : import_lxml
88
skips: B101,B102,B320,B404,B406,B410
9+
exclude: **/tests/**,tests

.coveragerc

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ branch = true
44

55
source =
66
cvat/apps/
7-
utils/cli/
7+
cvat-sdk/
8+
cvat-cli/
89
utils/dataset_manifest
910

1011
omit =

.eslintrc.js

+25-8
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ module.exports = {
77
env: {
88
node: true,
99
browser: true,
10-
es6: true,
10+
es2020: true,
1111
},
1212
parserOptions: {
1313
sourceType: 'module',
14-
ecmaVersion: 2018,
14+
parser: '@typescript-eslint/parser',
1515
},
1616
ignorePatterns: [
1717
'.eslintrc.js',
1818
'lint-staged.config.js',
1919
],
20-
plugins: ['security', 'no-unsanitized', 'eslint-plugin-header', 'import'],
20+
plugins: ['@typescript-eslint', 'security', 'no-unsanitized', 'eslint-plugin-header', 'import'],
2121
extends: [
2222
'eslint:recommended', 'plugin:security/recommended', 'plugin:no-unsanitized/DOM',
2323
'airbnb-base', 'plugin:import/errors', 'plugin:import/warnings',
24-
'plugin:import/typescript',
24+
'plugin:import/typescript', 'plugin:@typescript-eslint/recommended', 'airbnb-typescript/base',
2525
],
2626
rules: {
27-
'header/header': [2, 'line', [{
28-
pattern: ' {1}Copyright \\(C\\) (?:20\\d{2}-)?2022 Intel Corporation',
29-
template: ' Copyright (C) 2022 Intel Corporation'
30-
}, '', ' SPDX-License-Identifier: MIT']],
27+
// 'header/header': [2, 'line', [{
28+
// pattern: ' {1}Copyright \\(C\\) (?:20\\d{2}-)?2022 Intel Corporation',
29+
// template: ' Copyright (C) 2022 Intel Corporation'
30+
// }, '', ' SPDX-License-Identifier: MIT']],
3131
'no-plusplus': 0,
3232
'no-continue': 0,
3333
'no-console': 0,
@@ -51,5 +51,22 @@ module.exports = {
5151
'security/detect-object-injection': 0, // the rule is relevant for user input data on the node.js environment
5252
'import/order': ['error', {'groups': ['builtin', 'external', 'internal']}],
5353
'import/prefer-default-export': 0, // works incorrect with interfaces
54+
55+
'@typescript-eslint/ban-ts-comment': 0,
56+
'@typescript-eslint/no-explicit-any': 0,
57+
'@typescript-eslint/indent': ['error', 4],
58+
'@typescript-eslint/lines-between-class-members': 0,
59+
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
60+
'@typescript-eslint/explicit-module-boundary-types': 'off',
61+
'@typescript-eslint/ban-types': [
62+
'error',
63+
{
64+
types: {
65+
'{}': false, // TODO: try to fix with Record<string, unknown>
66+
object: false, // TODO: try to fix with Record<string, unknown>
67+
Function: false, // TODO: try to fix somehow
68+
},
69+
},
70+
],
5471
},
5572
};

.github/ISSUE_TEMPLATE.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
<!---
2-
Copyright (C) 2020-2021 Intel Corporation
3-
4-
SPDX-License-Identifier: MIT
5-
-->
6-
71
### My actions before raising this issue
8-
- [ ] Read/searched [the docs](https://github.com/opencv/cvat/tree/master#documentation)
2+
- [ ] Read/searched [the docs](https://github.com/cvat-ai/cvat/tree/master#documentation)
93
- [ ] Searched [past issues](/issues)
104

115
<!--- Provide a general summary of the issue in the Title above -->
@@ -49,5 +43,3 @@ the bug in -->
4943
<summary>Logs from `cvat` container</summary>
5044
</details>
5145

52-
### Next steps
53-
You may [join our Gitter](https://gitter.im/opencv-cvat/public) channel for community support.

.github/PULL_REQUEST_TEMPLATE.md

+8-20
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
<!---
2-
Copyright (C) 2020-2022 Intel Corporation
3-
4-
SPDX-License-Identifier: MIT
5-
-->
6-
7-
<!-- Raised an issue to propose your change (https://github.com/opencv/cvat/issues).
1+
<!-- Raised an issue to propose your change (https://github.com/cvat-ai/cvat/issues).
82
It helps to avoid duplication of efforts from multiple independent contributors.
93
Discuss your ideas with maintainers to be sure that changes will be approved and merged.
10-
Read the [CONTRIBUTION](https://github.com/opencv/cvat/blob/develop/CONTRIBUTING.md)
4+
Read the [CONTRIBUTION](https://github.com/cvat-ai/cvat/blob/develop/CONTRIBUTING.md)
115
guide. -->
126

137
<!-- Provide a general summary of your changes in the Title above -->
@@ -28,24 +22,18 @@ If an item isn't applicable by a reason then ~~explicitly strikethrough~~ the wh
2822
line. If you don't do that github will show an incorrect process for the pull request.
2923
If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
3024
- [ ] I submit my changes into the `develop` branch
31-
- [ ] I have added a description of my changes into [CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md) file
25+
- [ ] I have added a description of my changes into [CHANGELOG](https://github.com/cvat-ai/cvat/blob/develop/CHANGELOG.md) file
3226
- [ ] I have updated the [documentation](
33-
https://github.com/opencv/cvat/blob/develop/README.md#documentation) accordingly
27+
https://github.com/cvat-ai/cvat/blob/develop/README.md#documentation) accordingly
3428
- [ ] I have added tests to cover my changes
3529
- [ ] I have linked related issues ([read github docs](
3630
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))
37-
- [ ] I have increased versions of npm packages if it is necessary ([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning),
38-
[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))
31+
- [ ] I have increased versions of npm packages if it is necessary ([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),
32+
[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning), [cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning) and [cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))
3933

4034
### License
4135

4236
- [ ] I submit _my code changes_ under the same [MIT License](
43-
https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the project.
37+
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the project.
4438
Feel free to contact the maintainers if that's a concern.
45-
- [ ] I have updated the license header for each file (see an example below)
46-
47-
```python
48-
# Copyright (C) 2022 Intel Corporation
49-
#
50-
# SPDX-License-Identifier: MIT
51-
```
39+

.github/workflows/bandit.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Linter
1+
name: Bandit
22
on: pull_request
33
jobs:
4-
Bandit:
4+
Linter:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v2
@@ -17,7 +17,8 @@ jobs:
1717
PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED"
1818
for FILE in $PR_FILES; do
1919
EXTENSION="${FILE##*.}"
20-
if [[ $EXTENSION == 'py' ]]; then
20+
DIRECTORY="${FILE%%/*}"
21+
if [[ "$EXTENSION" == 'py' && "$DIRECTORY" != 'cvat-sdk' ]]; then
2122
CHANGED_FILES+=" $FILE"
2223
fi
2324
done
@@ -32,7 +33,7 @@ jobs:
3233
3334
echo "Bandit version: "$(bandit --version | head -1)
3435
echo "The files will be checked: "$(echo $CHANGED_FILES)
35-
bandit $CHANGED_FILES --exclude '**/tests/**' -a file --ini ./.bandit -f html -o ./bandit_report/bandit_checks.html
36+
bandit -a file --ini .bandit -f html -o ./bandit_report/bandit_checks.html $CHANGED_FILES
3637
deactivate
3738
else
3839
echo "No files with the \"py\" extension found"

.github/workflows/black.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Black
2+
on: pull_request
3+
jobs:
4+
Linter:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- id: files
9+
uses: jitterbit/get-changed-files@v1
10+
continue-on-error: true
11+
12+
- name: Run checks
13+
env:
14+
PR_FILES_AM: ${{ steps.files.outputs.added_modified }}
15+
PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }}
16+
run: |
17+
# If different modules use different Black configs,
18+
# we need to run Black for each python component group separately.
19+
# Otherwise, they all will use the same config.
20+
ENABLED_DIRS=("cvat-sdk" "cvat-cli" "tests/python/sdk" "tests/python/cli")
21+
22+
isValueIn () {
23+
# Checks if a value is in an array
24+
# https://stackoverflow.com/a/8574392
25+
# args: value, array
26+
local e match="$1"
27+
shift
28+
for e; do
29+
[[ "$e" == "$match" ]] && return 0;
30+
done
31+
return 1
32+
}
33+
34+
startswith () {
35+
# Inspired by https://stackoverflow.com/a/2172367
36+
# Checks if the first arg starts with the second one
37+
local value="$1"
38+
local beginning="$2"
39+
return $([[ $value == ${beginning}* ]])
40+
}
41+
42+
PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED"
43+
UPDATED_DIRS=""
44+
for FILE in $PR_FILES; do
45+
EXTENSION="${FILE##*.}"
46+
DIRECTORY="$(dirname $FILE)"
47+
if [[ "$EXTENSION" == "py" ]]; then
48+
for EDIR in ${ENABLED_DIRS[@]}; do
49+
if startswith "${DIRECTORY}/" "${EDIR}/" && ! isValueIn "${EDIR}" ${UPDATED_DIRS[@]};
50+
then
51+
UPDATED_DIRS+=" ${EDIR}"
52+
fi
53+
done
54+
fi
55+
done
56+
57+
if [[ ! -z $UPDATED_DIRS ]]; then
58+
sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv
59+
python3 -m venv .env
60+
. .env/bin/activate
61+
pip install -U pip wheel setuptools
62+
pip install $(egrep "black.*" ./cvat-cli/requirements/development.txt)
63+
mkdir -p black_report
64+
65+
echo "Black version: "$(black --version)
66+
echo "The dirs will be checked: $UPDATED_DIRS"
67+
EXIT_CODE=0
68+
for DIR in $UPDATED_DIRS; do
69+
black --check $DIR >> ./black_report/black_checks.txt || EXIT_CODE=$(($? | $EXIT_CODE)) || true
70+
done
71+
deactivate
72+
exit $EXIT_CODE
73+
else
74+
echo "No files with the \"py\" extension found"
75+
fi
76+
77+
- name: Upload artifacts
78+
if: failure()
79+
uses: actions/upload-artifact@v2
80+
with:
81+
name: black_report
82+
path: black_report

.github/workflows/cache.yml

+76-4
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,74 @@ on:
66

77
jobs:
88
Caching_CVAT:
9+
env:
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
REPO: ${{ github.repository }}
912
runs-on: ubuntu-latest
1013
steps:
1114
- uses: actions/checkout@v2
12-
- uses: actions/cache@v2
15+
16+
- name: Getting SHA with cache from the default branch
17+
id: get-sha
18+
run: |
19+
DEFAULT_BRANCH=$(gh api /repos/$REPO | jq -r '.default_branch')
20+
for sha in $(gh api "/repos/$REPO/commits?per_page=100&sha=${DEFAULT_BRANCH}" | jq -r '.[].sha');
21+
do
22+
RUN_status=$(gh api /repos/${REPO}/actions/workflows/cache.yml/runs | \
23+
jq -r ".workflow_runs[]? | select((.head_sha == \"${sha}\") and (.conclusion == \"success\")) | .status")
24+
25+
if [[ ${RUN_status} == "completed" ]]; then
26+
SHA=$sha
27+
break
28+
fi
29+
done
30+
31+
echo Default branch is ${DEFAULT_BRANCH}
32+
echo Workflow will try to get cache from commit: ${SHA}
33+
34+
echo ::set-output name=default_branch::${DEFAULT_BRANCH}
35+
echo ::set-output name=sha::${SHA}
36+
37+
- uses: actions/cache@v3
38+
id: server-cache-action
1339
with:
1440
path: /tmp/cvat_cache_server
1541
key: ${{ runner.os }}-build-server-${{ github.sha }}
1642
restore-keys: |
43+
${{ runner.os }}-build-server-${{ steps.get-sha.outputs.sha }}
1744
${{ runner.os }}-build-server-
1845
19-
- uses: actions/cache@v2
46+
- uses: actions/cache@v3
47+
id: ui-cache-action
2048
with:
2149
path: /tmp/cvat_cache_ui
2250
key: ${{ runner.os }}-build-ui-${{ github.sha }}
2351
restore-keys: |
52+
${{ runner.os }}-build-ui-${{ steps.get-sha.outputs.sha }}
2453
${{ runner.os }}-build-ui-
2554
55+
- uses: actions/cache@v3
56+
id: elasticsearch-cache-action
57+
with:
58+
path: /tmp/cvat_cache_elasticsearch
59+
key: ${{ runner.os }}-build-elasticsearch-${{ github.sha }}
60+
restore-keys: |
61+
${{ runner.os }}-build-elasticsearch-${{ steps.get-sha.outputs.sha }}
62+
${{ runner.os }}-build-elasticsearch-
63+
64+
- uses: actions/cache@v3
65+
id: logstash-cache-action
66+
with:
67+
path: /tmp/cvat_cache_logstash
68+
key: ${{ runner.os }}-build-logstash-${{ github.sha }}
69+
restore-keys: |
70+
${{ runner.os }}-build-logstash-${{ steps.get-sha.outputs.sha }}
71+
${{ runner.os }}-build-logstash-
72+
2673
- name: Set up Docker Buildx
27-
uses: docker/setup-buildx-action@v1.1.2
74+
uses: docker/setup-buildx-action@v2
2875

29-
- name: Caching CVAT server
76+
- name: Caching CVAT Server
3077
uses: docker/build-push-action@v2
3178
with:
3279
context: .
@@ -42,9 +89,34 @@ jobs:
4289
cache-from: type=local,src=/tmp/cvat_cache_ui
4390
cache-to: type=local,dest=/tmp/cvat_cache_ui-new
4491

92+
- name: Caching CVAT Elasticsearch
93+
uses: docker/build-push-action@v2
94+
with:
95+
context: ./components/analytics/elasticsearch/
96+
file: ./components/analytics/elasticsearch/Dockerfile
97+
cache-from: type=local,src=/tmp/cvat_cache_elasticsearch
98+
cache-to: type=local,dest=/tmp/cvat_cache_elasticsearch-new
99+
build-args: ELK_VERSION=6.8.23
100+
101+
- name: Caching CVAT Logstash
102+
uses: docker/build-push-action@v2
103+
with:
104+
context: ./components/analytics/logstash/
105+
file: ./components/analytics/logstash/Dockerfile
106+
cache-from: type=local,src=/tmp/cvat_cache_logstash
107+
cache-to: type=local,dest=/tmp/cvat_cache_logstash-new
108+
build-args: ELK_VERSION=6.8.23
109+
45110
- name: Moving cache
46111
run: |
47112
rm -rf /tmp/cvat_cache_server
48113
mv /tmp/cvat_cache_server-new /tmp/cvat_cache_server
114+
49115
rm -rf /tmp/cvat_cache_ui
50116
mv /tmp/cvat_cache_ui-new /tmp/cvat_cache_ui
117+
118+
rm -rf /tmp/cvat_cache_elasticsearch
119+
mv /tmp/cvat_cache_elasticsearch-new /tmp/cvat_cache_elasticsearch
120+
121+
rm -rf /tmp/cvat_cache_logstash
122+
mv /tmp/cvat_cache_logstash-new /tmp/cvat_cache_logstash

.github/workflows/cleanup.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Workflow deletes image artifacts that created by CI workflow
2+
name: Delete image artifacts
3+
on:
4+
workflow_run:
5+
workflows: [CI, Comment]
6+
types:
7+
- completed
8+
9+
jobs:
10+
cleanup:
11+
runs-on: ubuntu-latest
12+
env:
13+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
steps:
15+
- name: Clean up
16+
run: |
17+
wri=${{ github.event.workflow_run.id }}
18+
for ai in $(gh api /repos/${{ github.repository }}/actions/runs/$wri/artifacts | jq '.artifacts[] | select( .name | startswith("cvat")) | .id');
19+
do
20+
gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$ai
21+
done

0 commit comments

Comments
 (0)