From 302241ea04974de3d2c0b291dc9a5a940159df2b Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 3 Nov 2024 15:41:38 +0200 Subject: [PATCH] GITHUB-IMPROVE --- .github/ISSUE_TEMPLATE/bug_report.yml | 53 ++++-- .github/ISSUE_TEMPLATE/design_report.yml | 38 ++++ .../ISSUE_TEMPLATE/documentation_request.yml | 33 ++++ .github/ISSUE_TEMPLATE/feature_request.yml | 36 +++- .github/ISSUE_TEMPLATE/performance_issue.yml | 56 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 18 +- .github/workflows/first-issue-labeler.yml | 34 ++++ .github/workflows/first-pr-labeler.yml | 36 ++++ .github/workflows/greetings.yml | 4 +- .github/workflows/label.yml | 7 - .github/workflows/pylint.yml | 171 ++++++++++++++++-- .github/workflows/stale.yml | 35 ++-- .github/workflows/static.yml | 8 - 13 files changed, 458 insertions(+), 71 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/design_report.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation_request.yml create mode 100644 .github/ISSUE_TEMPLATE/performance_issue.yml create mode 100644 .github/workflows/first-issue-labeler.yml create mode 100644 .github/workflows/first-pr-labeler.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2f75c950..c866a6a3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,5 @@ name: "🐛 Bug Report" -description: Create a new ticket for a bug. +description: "Create a new ticket for a bug." title: "🐛 [BUG] - " labels: [ "bug" @@ -9,42 +9,51 @@ body: id: description attributes: label: "Description" - description: Please enter an explicit description of your issue - placeholder: Short and explicit description of your incident... + description: "Please describe the issue in detail." + placeholder: "Provide a detailed description of the issue..." validations: required: true + + - type: textarea + id: expected_behavior + attributes: + label: "Expected Behavior" + description: "Please describe what you expected to happen." + placeholder: "Expected result..." + validations: + required: true + - type: textarea id: reprod attributes: - label: "Reproduction steps" - description: Please enter an explicit description of your issue - value: - render: bash + label: "Reproduction Steps" + description: "Please list the steps to reproduce the issue, one step per line." + placeholder: "1. Open app\n2. Go to settings\n3. Observe error" validations: required: true + - type: textarea id: screenshot attributes: label: "Screenshots" - description: If applicable, add screenshots to help explain your problem. - value: | - ![DESCRIPTION](LINK.png) - render: bash + description: "If applicable, add screenshots to help explain your problem." + placeholder: "Attach screenshots here..." validations: required: false + - type: textarea id: logs attributes: label: "Logs" - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: bash + description: "Please copy and paste any relevant log output." validations: required: false + - type: dropdown id: browsers attributes: label: "Browsers" - description: What browsers are you seeing the problem on ? + description: "What browsers are you seeing the problem on?" multiple: true options: - Firefox @@ -54,11 +63,12 @@ body: - Opera validations: required: false + - type: dropdown id: os attributes: label: "OS" - description: What is the impacted environment ? + description: "What is the impacted environment?" multiple: true options: - Windows @@ -66,3 +76,16 @@ body: - Mac validations: required: false + + - type: dropdown + id: priority + attributes: + label: "Priority" + description: "How critical is this issue?" + options: + - Low + - Medium + - High + - Critical + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/design_report.yml b/.github/ISSUE_TEMPLATE/design_report.yml new file mode 100644 index 00000000..97ba6a1f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/design_report.yml @@ -0,0 +1,38 @@ +name: "🎨 Design Feedback" +description: Provide feedback on UI/UX design +title: "🎨 [Design] - <title>" +labels: [ + "design" +] +body: + - type: textarea + id: description + validations: + required: true + attributes: + label: Feedback Description + description: | + Provide details about the design aspect you are giving feedback on. + + - type: textarea + id: suggestion + validations: + required: false + attributes: + label: Suggested Improvements + description: | + Suggest any changes or improvements you think would enhance the design. + + - type: dropdown + id: feedback-type + validations: + required: true + attributes: + label: Feedback Type + description: | + Select the type of feedback. + options: + - Usability + - Visual Design + - Accessibility + - Responsiveness diff --git a/.github/ISSUE_TEMPLATE/documentation_request.yml b/.github/ISSUE_TEMPLATE/documentation_request.yml new file mode 100644 index 00000000..82c67bf2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_request.yml @@ -0,0 +1,33 @@ +name: "📚 Documentation Request" +description: Request improvements or additions to the documentation +title: "📚 [Docs] - <title>" +labels: [ + "documentation" +] +body: + - type: textarea + id: area-of-documentation + validations: + required: true + attributes: + label: Area of Documentation + description: | + Describe the specific part of the documentation you want to address. + + - type: textarea + id: improvement-details + validations: + required: true + attributes: + label: Details + description: | + Explain the improvements or additions needed in the documentation. + + - type: input + id: related-links + validations: + required: false + attributes: + label: Related Links + description: | + Add any links to relevant code, examples, or additional resources. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 1d12694f..29bbecfb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -12,7 +12,7 @@ body: attributes: label: Feature request description: | - A clear and concise description of the feature proposal + Provide a clear and concise description of the feature proposal, including what problem it solves or improvement it introduces. - type: textarea id: motivation @@ -23,7 +23,6 @@ body: description: | Please outline the motivation for the proposal. Is your feature request related to a problem? - - type: textarea id: contribution validations: @@ -31,4 +30,35 @@ body: attributes: label: Your contribution description: | - Is there any way that you could help, e.g. by submitting a PR? + Is there any way that you could help, e.g., by submitting a PR? + + - type: input + id: related-links + validations: + required: false + attributes: + label: Related Links + description: | + Links to any relevant discussions, documents, or issues related to this feature request. + + - type: dropdown + id: priority + validations: + required: false + attributes: + label: Priority + description: | + Indicate the urgency of the feature request. + options: + - Low + - Medium + - High + + - type: textarea + id: expected-outcome + validations: + required: false + attributes: + label: Expected Outcome + description: | + Describe what success looks like if this feature is implemented. How will it improve the user experience or functionality? diff --git a/.github/ISSUE_TEMPLATE/performance_issue.yml b/.github/ISSUE_TEMPLATE/performance_issue.yml new file mode 100644 index 00000000..b5dac4b0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/performance_issue.yml @@ -0,0 +1,56 @@ +name: "⚡ Performance Issue" +description: Report a performance issue affecting the system +title: "⚡ [Performance] - <short description>" +labels: [ + "performance" +] +body: + - type: textarea + id: description + validations: + required: true + attributes: + label: Description + description: | + Describe the performance issue, including any symptoms (e.g., slow loading, high memory usage). + + - type: textarea + id: steps-to-reproduce + validations: + required: false + attributes: + label: Steps to Reproduce + description: | + If possible, describe how to reproduce the issue. + + - type: textarea + id: impact + validations: + required: true + attributes: + label: Impact + description: | + Describe how this issue affects users or the system. + + - type: input + id: environment + validations: + required: false + attributes: + label: Environment + description: | + Specify the environment (e.g., OS, app version, hardware) where the issue occurs. + + - type: dropdown + id: severity + validations: + required: false + attributes: + label: Severity + description: | + Rate the impact of this performance issue. + options: + - Low + - Medium + - High + - Critical diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index fa5f8fdb..c2ef00fb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -5,21 +5,29 @@ - [ ] Bug Fix - [ ] Optimization - [ ] Documentation Update +- [ ] Other (please describe below) ## Description -- +- Describe what changes have been made and why. Include key points and the reasoning behind the implementation. + +## Impact + +- Are there any breaking changes? +- Does this require documentation or configuration updates? ## Related Tickets & Documents -- +- Related tickets (e.g., `#1234`): +- Links to documentation: ## QA Instructions & Screenshots -- +- Describe steps for testing this PR. +- If applicable, attach screenshots for clarity. ## Added/updated tests? -- [ ] Yes +- [ ] Yes, new tests have been added. - [ ] No, and this is why: -- [ ] I need help with writing tests +- [ ] I need help with writing tests. diff --git a/.github/workflows/first-issue-labeler.yml b/.github/workflows/first-issue-labeler.yml new file mode 100644 index 00000000..6542296d --- /dev/null +++ b/.github/workflows/first-issue-labeler.yml @@ -0,0 +1,34 @@ +name: First Issue Labeler + +on: + issues: + types: [opened] + +jobs: + first-issue: + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - name: Check if first contribution + id: check + uses: actions/github-script@v7 + with: + script: | + const creator = context.payload.issue.user.login; + const issues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + creator: creator, + state: 'all' + }); + + if (issues.data.length === 1) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['good first issue'] + }); + } \ No newline at end of file diff --git a/.github/workflows/first-pr-labeler.yml b/.github/workflows/first-pr-labeler.yml new file mode 100644 index 00000000..b0b40824 --- /dev/null +++ b/.github/workflows/first-pr-labeler.yml @@ -0,0 +1,36 @@ +name: First PR Labeler + +on: + pull_request: + types: [opened] + +jobs: + first-pr: + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - name: Check if first contribution + id: check + uses: actions/github-script@v7 + with: + script: | + const creator = context.payload.pull_request.user.login; + const pullRequests = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'all', + per_page: 100 + }); + + const creatorPRs = pullRequests.data.filter(pr => pr.user.login === creator); + + if (creatorPRs.length === 1) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['good first PR'] + }); + } diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index d82e642c..5c6e9604 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -12,5 +12,5 @@ jobs: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Hello @${{ github.actor }}, 👋 Thank you for creating your first issue in our repository. We appreciate your contribution!' first issue" - pr-message: "Hello @${{ github.actor }}, 👋 Thank you for creating your first pull request in our repository. We appreciate your contribution!' first pull request" + issue-message: "Hello @${{ github.actor }}, 👋 Thank you for creating your first issue in our repository. We appreciate your contribution!" + pr-message: "Hello @${{ github.actor }}, 👋 Thank you for creating your first pull request in our repository. We appreciate your contribution!" diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 46135690..51e3242a 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -1,10 +1,3 @@ -# This workflow will triage pull requests and apply a label based on the -# paths that are modified in the pull request. -# -# To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: -# https://github.com/actions/labeler - name: Labeler on: [pull_request_target] diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 26ecd312..3e26154b 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,23 +1,160 @@ name: Pylint -on: [push] +on: + push: + paths: + - '**.py' + - 'RequirementsFiles/**' + - '.github/workflows/pylint.yml' + - 'LaunchFile/**' + pull_request: + paths: + - '**.py' + - 'RequirementsFiles/**' + - '.github/workflows/pylint.yml' + - 'LaunchFile/**' jobs: - build: + lint: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10"] + timeout-minutes: 15 + steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint - - name: Analysing the code with pylint - run: | - pylint $(git ls-files '*.py') + - uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: 'pip' + cache-dependency-path: | + RequirementsFiles/requirements.txt + RequirementsFiles/requirements-CPU.txt + RequirementsFiles/requirements-cuda.txt + RequirementsFiles/requirements-cuda-CPU.txt + RequirementsFiles/requirements-llama-cpp.txt + RequirementsFiles/requirements-llama-cpp-CPU.txt + RequirementsFiles/requirements-stable-diffusion-cpp.txt + RequirementsFiles/requirements-stable-diffusion-cpp-CPU.txt + + - name: Create virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install base dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install pylint black flake8 mypy + + - name: Install project dependencies + run: | + # Installing main requirements (CPU version for CI) + pip install --no-deps -r RequirementsFiles/requirements-CPU.txt + pip install --no-deps -r RequirementsFiles/requirements-cuda-CPU.txt + pip install --no-deps -r RequirementsFiles/requirements-llama-cpp-CPU.txt + pip install --no-deps -r RequirementsFiles/requirements-stable-diffusion-cpp-CPU.txt + continue-on-error: true # Some dependencies might fail but we still want to lint + + - name: Create .pylintrc + run: | + cat > .pylintrc << EOF + [MASTER] + ignore=venv + persistent=yes + + [MESSAGES CONTROL] + disable= + C0111, # missing-docstring + C0103, # invalid-name + C0301, # line-too-long + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring + R0913, # too-many-arguments + R0914, # too-many-locals + W0611, # unused-import + W0401, # wildcard-import + W0614, # unused-wildcard-import + W0703, # broad-except + E1101, # no-member (often false-positives) + + [FORMAT] + max-line-length=120 + + [BASIC] + good-names=i,j,k,ex,Run,_,fp,id + + [MISCELLANEOUS] + notes=FIXME,XXX,TODO + + [SIMILARITIES] + min-similarity-lines=4 + ignore-comments=yes + ignore-docstrings=yes + ignore-imports=yes + EOF + + - name: Run black check + run: | + black --check --diff LaunchFile/ + continue-on-error: true + + - name: Run pylint + run: | + mkdir -p ./reports + pylint LaunchFile/ --output-format=json > ./reports/pylint-report.json || true + pylint LaunchFile/ --output-format=text > ./reports/pylint-report.txt || true + + - name: Run flake8 + run: | + flake8 LaunchFile/ --max-line-length=120 --statistics --tee --output-file=./reports/flake8-report.txt || true + + - name: Check pylint score + run: | + SCORE=$(tail -n 2 ./reports/pylint-report.txt | grep -oP "(?<=rated at )[0-9.]+") + echo "Pylint score: $SCORE/10" + if (( $(echo "$SCORE < 7.0" | bc -l) )); then + echo "Warning: Pylint score is below 7.0" + exit 1 + fi + + - name: Upload lint results + if: always() + uses: actions/upload-artifact@v3 + with: + name: lint-reports + path: | + ./reports/pylint-report.json + ./reports/pylint-report.txt + ./reports/flake8-report.txt + retention-days: 14 + + - name: Comment PR with lint results + if: github.event_name == 'pull_request' && always() + uses: actions/github-script@v6 + with: + script: | + const fs = require('fs'); + const pylintReport = fs.readFileSync('./reports/pylint-report.txt', 'utf8'); + const score = pylintReport.match(/rated at ([0-9.]+)/); + const scoreValue = score ? score[1] : 'N/A'; + + const body = `## Lint Results + + ### Pylint Score: ${scoreValue}/10 + + <details> + <summary>Detailed Report</summary> + + \`\`\` + ${pylintReport} + \`\`\` + </details>`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }); \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5d3569dd..5fafeaf8 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,27 +1,34 @@ -# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/actions/stale name: Mark stale issues and pull requests on: schedule: - - cron: '17 8 * * *' + - cron: '0 0 * * *' jobs: stale: - runs-on: ubuntu-latest permissions: issues: write pull-requests: write steps: - - uses: actions/stale@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: '👋 It looks like this issue has been inactive for some time. + • If the issue is still active, please leave a comment. + • If there is no activity for 7 days, the issue will be automatically closed.' + days-before-issue-stale: 30 + days-before-issue-close: 7 + stale-issue-label: 'no-issue-activity' + + stale-pr-message: '👋 It looks like this pull request has been inactive for some time. + • If you are still working on this PR, please add a comment. + • If there is no activity for 7 days, the PR will be automatically closed.' + days-before-pr-stale: 14 + days-before-pr-close: 7 + stale-pr-label: 'no-pr-activity' + + exempt-issue-labels: 'blocked,must-have' + exempt-pr-labels: 'blocked,work-in-progress' + exempt-all-milestones: true diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index f2c9e97c..de366a6c 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,28 +1,21 @@ -# Simple workflow for deploying static content to GitHub Pages name: Deploy static content to Pages on: - # Runs on pushes targeting the default branch push: branches: ["main"] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false jobs: - # Single deploy job since we're just deploying deploy: environment: name: github-pages @@ -36,7 +29,6 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - # Upload entire repository path: '.' - name: Deploy to GitHub Pages id: deployment