diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..7901a79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,105 @@ +name: Bug Report +description: Report a bug or issue with the project. +title: "[BUG] " +labels: ["bug"] + +body: + - type: markdown + attributes: + value: | + **Please describe the bug you encountered.** + + - type: checkboxes + id: pre-check + attributes: + label: Pre-check + description: Please confirm that you have searched for duplicate issues before creating this one. + options: + - label: I have searched the existing issues and none cover this bug. + required: true + + - type: textarea + id: description + attributes: + label: Description + description: Provide a detailed description of the bug. + placeholder: "Detailed description of the bug" + validations: + required: true + + - type: textarea + id: steps + attributes: + label: Steps to Reproduce + description: Provide the steps to reproduce the bug. + placeholder: "1. Step one\n2. Step two\n3. Step three" + validations: + required: true + + - type: input + id: expected + attributes: + label: Expected Behavior + description: Describe what you expected to happen. + placeholder: "Expected behavior" + validations: + required: true + + - type: input + id: actual + attributes: + label: Actual Behavior + description: Describe what actually happened. + placeholder: "Actual behavior" + validations: + required: true + + - type: input + id: environment + attributes: + label: Environment + description: Provide details about your environment (e.g., OS, GPU, profile, etc.). + placeholder: "Environment details" + validations: + required: true + + - type: input + id: additional + attributes: + label: Additional Information + description: Provide any additional information that may be relevant (e.g., logs, screenshots). + placeholder: "Any additional information that may be relevant" + + - type: input + id: version + attributes: + label: Version + description: Provide the version of the project where you encountered the bug. + placeholder: "Version number" + + - type: markdown + attributes: + value: | + **Please ensure the following setup checklist has been reviewed before submitting the bug report.** + + - type: checkboxes + id: general-setup-checklist + attributes: + label: Setup Checklist + description: Verify the following general aspects of your setup. + options: + - label: Confirm that you have followed the installation instructions in the project’s documentation. + - label: Check that you are using the latest version of the project. + - label: Verify disk space availability for model storage and data processing. + - label: Ensure that you have the necessary permissions to run the project. + + - type: checkboxes + id: nvidia-setup-checklist + attributes: + label: NVIDIA GPU Setup Checklist + description: Verify the following aspects of your NVIDIA GPU setup. + options: + - label: Check that the all CUDA dependencies are installed and are compatible with your GPU (refer to [CUDA's documentation](https://docs.nvidia.com/deploy/cuda-compatibility/#frequently-asked-questions)) + - label: Ensure an NVIDIA GPU is installed and recognized by the system (run `nvidia-smi` to verify). + - label: Ensure proper permissions are set for accessing GPU resources. + - label: Docker users - Verify that the NVIDIA Container Toolkit is configured correctly (e.g. run `sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi`) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..eaae6e4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Documentation + url: https://docs.privategpt.dev + about: Please refer to our documentation for more details and guidance. + - name: Discord + url: https://discord.gg/bK6mRVpErU + about: Join our Discord community to ask questions and get help. diff --git a/.github/ISSUE_TEMPLATE/docs.yml b/.github/ISSUE_TEMPLATE/docs.yml new file mode 100644 index 0000000..e078bf2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/docs.yml @@ -0,0 +1,19 @@ +name: Documentation +description: Suggest a change or addition to the documentation. +title: "[DOCS] " +labels: ["documentation"] + +body: + - type: markdown + attributes: + value: | + **Please describe the documentation change or addition you would like to suggest.** + + - type: textarea + id: description + attributes: + label: Description + description: Provide a detailed description of the documentation change. + placeholder: "Detailed description of the documentation change" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 0000000..648e19d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,37 @@ +name: Enhancement +description: Suggest an enhancement or improvement to the project. +title: "[FEATURE] " +labels: ["enhancement"] + +body: + - type: markdown + attributes: + value: | + **Please describe the enhancement or improvement you would like to suggest.** + + - type: textarea + id: feature_description + attributes: + label: Feature Description + description: Provide a detailed description of the enhancement. + placeholder: "Detailed description of the enhancement" + validations: + required: true + + - type: textarea + id: reason + attributes: + label: Reason + description: Explain the reason for this enhancement. + placeholder: "Reason for the enhancement" + validations: + required: true + + - type: textarea + id: value + attributes: + label: Value of Feature + description: Describe the value or benefits this feature will bring. + placeholder: "Value or benefits of the feature" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..bfd3003 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,19 @@ +name: Question +description: Ask a question about the project. +title: "[QUESTION] " +labels: ["question"] + +body: + - type: markdown + attributes: + value: | + **Please describe your question in detail.** + + - type: textarea + id: question + attributes: + label: Question + description: Provide a detailed description of your question. + placeholder: "Detailed description of the question" + validations: + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..701ed1e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,37 @@ +# Description + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +## Type of Change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration + +- [ ] Added new unit/integration tests +- [ ] I stared at the code and made sure it makes sense + +**Test Configuration**: +* Firmware version: +* Hardware: +* Toolchain: +* SDK: + +## Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules +- [ ] I ran `make check; make test` to ensure mypy and tests pass \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 259cf5d..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: docker - -on: - release: - types: [ published ] - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=sha - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.external - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/generate-release.yml b/.github/workflows/generate-release.yml new file mode 100644 index 0000000..208c48c --- /dev/null +++ b/.github/workflows/generate-release.yml @@ -0,0 +1,83 @@ +name: generate-release + +on: + release: + types: [ published ] + workflow_dispatch: + +env: + REGISTRY: docker.io + IMAGE_NAME: ${{ github.repository }} + platforms: linux/amd64,linux/arm64 + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + strategy: + matrix: + type: [ local, external ] + + permissions: + contents: read + packages: write + + outputs: + version: ${{ steps.version.outputs.version }} + + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha + + - name: Extract metadata (tags, labels) for Docker + id: tagging + uses: HackerHappyHour/tagging-strategy@v3 + with: + image_name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tag_name: ${{ github.event.release.tag_name }} + tags: | + %X%-${{ matrix.type}} + %X.Y%-${{ matrix.type}} + %X.Y.Z%-${{ matrix.type}} + extra_tags: | + latest::${{ matrix.type == 'external'}} + %X%::${{ matrix.type == 'external'}} + %X.Y%::${{ matrix.type == 'external'}} + %X.Y.Z%::${{ matrix.type == 'external'}} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.${{ matrix.type }} + platforms: ${{ env.platforms }} + push: true + tags: | + ${{ steps.tagging.outputs.tags }} + ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Version output + id: version + run: echo "version=${{ steps.meta.outputs.version }}" >> "$GITHUB_OUTPUT" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc10e87..7d4425f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,13 +17,13 @@ repos: hooks: - id: black name: Formatting (black) - entry: black + entry: make format language: system types: [python] stages: [commit] - id: ruff name: Linter (ruff) - entry: ruff + entry: make lint language: system types: [python] stages: [commit] @@ -40,4 +40,4 @@ repos: pass_filenames: false language: system types: [python] - stages: [push] \ No newline at end of file + stages: [push] diff --git a/Makefile b/Makefile index 7b9a846..42d0f7c 100644 --- a/Makefile +++ b/Makefile @@ -12,20 +12,23 @@ test-coverage: PYTHONPATH=. poetry run pytest tests --cov private_gpt --cov-report term --cov-report=html --cov-report xml --junit-xml=tests-results.xml black: - poetry run black . --check + PYTHONPATH=. poetry run black . --check ruff: - poetry run ruff check private_gpt tests + PYTHONPATH=. poetry run ruff check private_gpt tests format: - poetry run black . - poetry run ruff check private_gpt tests --fix + PYTHONPATH=. poetry run black . + +lint: + PYTHONPATH=. poetry run ruff check private_gpt tests --fix mypy: - poetry run mypy private_gpt + PYTHONPATH=. poetry run mypy private_gpt check: make format + make lint make mypy ########################################################################################################################