diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml new file mode 100644 index 0000000..66797a8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -0,0 +1,65 @@ +name: "\U0001F41E Bug Report" +description: Create a bug report to help us fix it +labels: ["bug"] +body: +- type: checkboxes + attributes: + label: Actions before raising this issue + options: + - label: I searched the existing issues and did not find anything similar. + required: true + - label: I read/searched [the docs](https://docs.cvat.ai/docs/) + required: true + +- type: textarea + attributes: + label: Steps to Reproduce + description: Provide a link to a live example or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: false +- type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false +- type: textarea + attributes: + label: Possible Solution + description: | + Not obligatory, but suggest a fix/reason for the bug, or ideas on how to implement the addition or change + validations: + required: false +- type: textarea + attributes: + label: Context + description: | + How has this issue affected you? What are you trying to accomplish? + Providing context helps us come up with a solution that is most useful in the real world! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false +- type: textarea + attributes: + label: Environment + description: | + Include relevant details about the environment you experienced + placeholder: | + - Git hash commit (`git log -1`): + - Docker version `docker version` (e.g. Docker 17.0.05): + - Are you using Docker Swarm or Kubernetes? + - Operating System and version (e.g. Linux, Windows, MacOS): + - Code example or link to GitHub repo or gist to reproduce problem: + - Other diagnostic information / logs: +
+ Logs from `cvat` container +
+ render: Markdown + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..b06919d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,41 @@ +name: "\U0001F680 Feature Request" +description: Suggest an idea for this project +labels: ["enhancement"] +body: +- type: checkboxes + attributes: + label: Actions before raising this issue + options: + - label: I searched the existing issues and did not find anything similar. + required: true + - label: I read/searched [the docs](https://docs.cvat.ai/docs/) + required: true +- type: textarea + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. + placeholder: I'm always frustrated when I have to press this small button. + validations: + required: false +- type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + placeholder: Make this button bigger + validations: + required: false +- type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + placeholder: I wanted to buy bigger display, but it would be too expensive. + validations: + required: false +- type: textarea + attributes: + label: Additional context + description: | + Add any other context or screenshots about the feature request here. + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5a2d0b1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,38 @@ + + + + +### Motivation and context + + +### How has this been tested? + + +### Checklist + +- [ ] I submit my changes into the `main` branch +- [ ] I have created a changelog fragment +- [ ] 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 + + +### License + +- [ ] I submit _my code changes_ under the same [MIT License] that covers the project. + Feel free to contact the maintainers if that's a concern. diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..dcec8d4 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,34 @@ +comment: + layout: "header, diff, components" + +component_management: + individual_components: + - component_id: cvat-ui + name: cvat-ui + paths: + - cvat/cvat-canvas/** + - cvat/cvat-canvas3d/** + - cvat/cvat-core/** + - cvat/cvat-data/** + - cvat/cvat-ui/** + - audino-frontend/** + - component_id: cvat-server + name: cvat-server + paths: + - cvat/cvat/** + - cvat/cvat-cli/** + - cvat/cvat-sdk/** + - cvat/utils/** + +codecov: + require_ci_to_pass: yes + notify: + wait_for_ci: yes + +coverage: + status: + patch: false + project: + default: + target: auto + threshold: 5% \ No newline at end of file diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml new file mode 100644 index 0000000..d75c691 --- /dev/null +++ b/.github/workflows/bandit.yml @@ -0,0 +1,29 @@ +name: Bandit +on: pull_request +jobs: + Linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: files + uses: tj-actions/changed-files@v41.0.0 + with: + submodules: true + files: | + cvat/**/*.py + files_ignore: | + cvat/**/cvat-sdk/* + + - name: Run checks + run: | + CHANGED_FILES="${{steps.files.outputs.all_changed_files}}" + + if [[ ! -z $CHANGED_FILES ]]; then + pipx install bandit + + echo "Bandit version: "$(bandit --version | head -1) + echo "The files will be checked: "$(echo $CHANGED_FILES) + bandit -a file --ini .bandit $CHANGED_FILES + else + echo "No files with the \"py\" extension found" + fi diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..572043c --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,43 @@ +name: Black +on: pull_request +jobs: + Linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: files + uses: tj-actions/changed-files@v41.0.0 + with: + submodules: true + files: | + cvat/cvat-sdk/**/*.py + cvat/cvat-cli/**/*.py + cvat/tests/python/**/*.py + cvat/cvat/apps/quality_control/**/*.py + cvat/cvat/apps/analytics_report/**/*.py + dir_names: true + + - name: Run checks + env: + PR_FILES_AM: ${{ steps.files.outputs.added_modified }} + PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} + run: | + # If different modules use different Black configs, + # we need to run Black for each python component group separately. + # Otherwise, they all will use the same config. + + UPDATED_DIRS="${{steps.files.outputs.all_changed_files}}" + + if [[ ! -z $UPDATED_DIRS ]]; then + pipx install $(egrep "black.*" ./cvat/cvat-cli/requirements/development.txt) + + echo "Black version: "$(black --version) + echo "The dirs will be checked: $UPDATED_DIRS" + EXIT_CODE=0 + for DIR in $UPDATED_DIRS; do + black --check --diff $DIR || EXIT_CODE=$(($? | $EXIT_CODE)) || true + done + exit $EXIT_CODE + else + echo "No files with the \"py\" extension found" + fi diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..08f6ec1 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,79 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main", "develop", master, release-* ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main", "develop" ] + schedule: + - cron: '27 19 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + submodules: true + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + with: + submodules: true + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + submodules: true diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml new file mode 100644 index 0000000..e2a478c --- /dev/null +++ b/.github/workflows/comment.yml @@ -0,0 +1,89 @@ +name: Comment +on: + issue_comment: + types: [created] + +env: + WORKFLOW_RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + +jobs: + verify_author: + if: contains(github.event.issue.html_url, '/pull') && + contains(github.event.comment.body, '/check') + runs-on: ubuntu-latest + outputs: + ref: ${{ steps.get-ref.outputs.ref }} + cid: ${{ steps.send-status.outputs.cid }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Check author of comment + id: check-author + run: | + PERM=$(gh api repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission | jq -r '.permission') + if [[ $PERM == "write" || $PERM == "maintain" || $PERM == "admin" ]]; + then + ALLOW="true" + fi + echo "allow=${ALLOW}" >> $GITHUB_OUTPUT + + - name: Verify that author of comment is collaborator + if: steps.check-author.outputs.allow == '' + uses: actions/github-script@v3 + with: + script: | + core.setFailed('User that send comment with /check command is not collaborator') + + - name: Get branch name + id: get-ref + run: | + SHA=$(gh api /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} | jq -r '.head.sha') + echo "ref=${SHA}" >> $GITHUB_OUTPUT + + - name: Send comment. Test are executing + id: send-status + run: | + BODY=":hourglass: Tests are executing, see more information [here](${{ env.WORKFLOW_RUN_URL }})" + BODY=$BODY"\n :warning: Cancel [this](${{ env.WORKFLOW_RUN_URL }}) workflow manually first, if you want to restart full check" + BODY=$(echo -e $BODY) + + COMMENT_ID=$(gh api --method POST \ + /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \ + -f body="${BODY}" | jq '.id') + + echo "cid=${COMMENT_ID}" >> $GITHUB_OUTPUT + + run-full: + needs: verify_author + uses: ./.github/workflows/full.yml + with: + ref: ${{ needs.verify_author.outputs.ref }} + + send_status: + runs-on: ubuntu-latest + needs: [run-full, verify_author] + if: needs.run-full.result != 'skipped' && always() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Send status in comments + run: | + BODY="" + + if [[ "${{ needs.run-full.result }}" == "failure" ]] + then + BODY=":x: Some checks failed" + elif [[ "${{ needs.run-full.result }}" == "success" ]] + then + BODY=":heavy_check_mark: All checks completed successfully" + elif [[ "${{ needs.run-full.result }}" == "cancelled" ]] + then + BODY=":no_entry_sign: Workflows has been canceled" + fi + + BODY=$BODY"\n :page_facing_up: See logs [here](${WORKFLOW_RUN_URL})" + BODY=$(echo -e $BODY) + + gh api --method PATCH \ + /repos/${{ github.repository }}/issues/comments/${{ needs.verify_author.outputs.cid }} \ + -f body="${BODY}" \ No newline at end of file diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..c6f576c --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,25 @@ +name: ESLint +on: pull_request +jobs: + Linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + submodule: true + node-version: '16.x' + + - name: Install dependencies + run: | + cd cvat; yarn install --frozen-lockfile + (cd tests && yarn install --frozen-lockfile) + + - name: Run checks cvat + run: | + cd cvat; echo "ESLint version: "$(yarn run -s eslint --version) + yarn run eslint . + + - name: Run checks Audino-frontend + run: | + cd audino-frontend; npm run eslint . \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b23c82a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,44 @@ +name: CI +on: + push: + branches: + - 'master' + - 'develop' + pull_request: + types: [ready_for_review, opened, synchronize, reopened] + paths-ignore: + - 'site/**' + - '**/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CYPRESS_VERIFY_TIMEOUT: 180000 # https://docs.cypress.io/guides/guides/command-line#cypress-verify + CVAT_VERSION: "local" + +jobs: + search_cache: + if: | + github.event.pull_request.draft == false && + !startsWith(github.event.pull_request.title, '[WIP]') && + !startsWith(github.event.pull_request.title, '[Dependent]') + uses: ./.github/workflows/search-cache.yml + + codecov: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Downloading coverage results + uses: actions/download-artifact@v3 + with: + name: coverage_results + submodule: true + + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + submodule: true \ No newline at end of file diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..1991dd6 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,34 @@ +name: Pylint +on: pull_request +jobs: + Linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: files + uses: tj-actions/changed-files@v41.0.0 + with: + submodule: true + files: | + **/*.py + + - name: Run checks + env: + PR_FILES_AM: ${{ steps.files.outputs.added_modified }} + PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} + run: | + CHANGED_FILES="${{steps.files.outputs.all_changed_files}}" + + if [[ ! -z $CHANGED_FILES ]]; then + pipx install $(egrep "^pylint==" ./cvat/cvat/requirements/development.txt) + + pipx inject pylint \ + $(egrep "^pylint-.+==" ./cvat/cvat/requirements/development.txt) \ + $(egrep "^django==" ./cvat/cvat/requirements/base.txt) + + echo "Pylint version: "$(pylint --version | head -1) + echo "The files will be checked: "$(echo $CHANGED_FILES) + pylint $CHANGED_FILES + else + echo "No files with the \"py\" extension found" + fi \ No newline at end of file diff --git a/.github/workflows/regallint.yml b/.github/workflows/regallint.yml new file mode 100644 index 0000000..80e5ff1 --- /dev/null +++ b/.github/workflows/regallint.yml @@ -0,0 +1,13 @@ +name: Regal +on: pull_request +jobs: + Linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Regal + uses: StyraInc/setup-regal@v1 + with: + version: v0.21.3 + submodule: true + - run: regal lint --format=github cvat/cvat/apps/*/rules \ No newline at end of file diff --git a/.github/workflows/remark.yml b/.github/workflows/remark.yml new file mode 100644 index 0000000..484f058 --- /dev/null +++ b/.github/workflows/remark.yml @@ -0,0 +1,21 @@ +name: Remark +on: pull_request +jobs: + Linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '16.x' + submodule: true + + - name: Run checks + run: | + cd audino-frontend; npm i + cd ../cvat; yarn install --frozen-lockfile + + cd .. + + echo "Remark version: "`npx remark --version` + npx remark --quiet --frail -i .remarkignore . \ No newline at end of file diff --git a/.github/workflows/stylelint.yml b/.github/workflows/stylelint.yml new file mode 100644 index 0000000..5975029 --- /dev/null +++ b/.github/workflows/stylelint.yml @@ -0,0 +1,40 @@ +name: StyleLint + +on: pull_request + +jobs: + Linter: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '16.x' + + - name: Get list of changed files + id: files + uses: tj-actions/changed-files@v41.0.0 + with: + files: | + **/*.css + **/*.scss + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Run StyleLint + run: | + CHANGED_FILES="${{steps.files.outputs.all_changed_files}}" + + if [[ ! -z $CHANGED_FILES ]]; then + echo "StyleLint version: $(npx stylelint --version)" + echo "Checking the following files: $CHANGED_FILES" + npx stylelint $CHANGED_FILES + else + echo "No CSS or SCSS files changed" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96f8adc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/audino-frontend/node_modules \ No newline at end of file diff --git a/audino-frontend/.gitignore b/audino-frontend/.gitignore new file mode 100644 index 0000000..30bc162 --- /dev/null +++ b/audino-frontend/.gitignore @@ -0,0 +1 @@ +/node_modules \ No newline at end of file