diff --git a/.github/actions/build/build-wheel/action.yml b/.github/actions/build/build-wheel/action.yml deleted file mode 100644 index 75b0397..0000000 --- a/.github/actions/build/build-wheel/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Run Build job - Build Wheel -description: Build Python wheel package and upload as artifact. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-core - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-core@main - if: github.event.repository.name != 'template-python' - - - name: Create wheel - run: | - uv build - shell: bash - - - name: Inspect wheel contents - run: | - echo "Wheel contents:" - unzip -l dist/${{ env.PACKAGE_NAME }}-*-py3-none-any.whl - shell: bash - - - name: Upload wheel - uses: actions/upload-artifact@v7 - with: - name: ${{ env.PACKAGE_NAME }}_wheel - path: dist/${{ env.PACKAGE_NAME }}-*-py3-none-any.whl diff --git a/.github/actions/build/verify-structure/action.yml b/.github/actions/build/verify-structure/action.yml deleted file mode 100644 index 8a9df02..0000000 --- a/.github/actions/build/verify-structure/action.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Run Build job - Verify Structure -description: Download and verify the structure of the built wheel package. - -inputs: - expected-directories: - description: 'Newline-separated list of directories expected to exist relative to site-packages' - required: false - default: '' - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-core - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-core@main - if: github.event.repository.name != 'template-python' - - - name: Download wheel artifact - uses: actions/download-artifact@v7 - with: - name: ${{ env.PACKAGE_NAME }}_wheel - - - name: Install wheel - run: | - WHEEL_FILE=$(find . -name "${{ env.PACKAGE_NAME }}-*-py3-none-any.whl") - - if [ ! -f "$WHEEL_FILE" ]; then - echo "Wheel file not found" - exit 1 - fi - - echo "Installing wheel: $WHEEL_FILE" - uv pip install "$WHEEL_FILE" - shell: bash - - - name: Verify installed package structure - run: | - SITE_PACKAGES=$(find . -name "site-packages" -type d | head -1) - echo "Site-packages directory: $SITE_PACKAGES" - - # Check required directories in site-packages - echo "Checking required directories in site-packages..." - REQUIRED_DIRS=( - "${SITE_PACKAGES}" - "${SITE_PACKAGES}/${{ env.PACKAGE_NAME }}" - ) - - if [ -n "${{ inputs.expected-directories }}" ]; then - while IFS= read -r dir; do - if [ -n "$dir" ]; then - REQUIRED_DIRS+=("${SITE_PACKAGES}/${dir}") - fi - done <<< "${{ inputs.expected-directories }}" - fi - - # Check for required directories in site-packages - echo "Checking required directories in site-packages..." - for dir in "${REQUIRED_DIRS[@]}"; do - if [ ! -d "$dir" ]; then - echo "Required directory not found: $dir" - exit 1 - fi - done - shell: bash diff --git a/.github/actions/ci/bandit/action.yml b/.github/actions/ci/bandit/action.yml deleted file mode 100644 index 374c431..0000000 --- a/.github/actions/ci/bandit/action.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Run CI job - Bandit -description: Run Bandit security checks on the codebase. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Security check - run: | - uv run bandit -r ${{ env.PACKAGE_NAME }} -f json -o bandit-report.json || true - shell: bash - - - uses: actions/upload-artifact@v7 - with: - name: bandit-report - path: bandit-report.json diff --git a/.github/actions/ci/mypy/action.yml b/.github/actions/ci/mypy/action.yml deleted file mode 100644 index ee4ed6b..0000000 --- a/.github/actions/ci/mypy/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Run CI job - Mypy -description: Run Mypy type checking on the codebase. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Check with mypy - run: | - uv run -m mypy . - shell: bash diff --git a/.github/actions/ci/pip-audit/action.yml b/.github/actions/ci/pip-audit/action.yml deleted file mode 100644 index 1a6abfe..0000000 --- a/.github/actions/ci/pip-audit/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Run CI job - Pip Audit -description: Run pip-audit to check for known vulnerabilities in dependencies. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Audit dependencies - run: | - uv run pip-audit --desc - shell: bash diff --git a/.github/actions/ci/pytest/action.yml b/.github/actions/ci/pytest/action.yml deleted file mode 100644 index 4b7b144..0000000 --- a/.github/actions/ci/pytest/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Run CI job - Pytest -description: Run Pytest tests with coverage reporting. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Test with pytest - run: | - uv run -m pytest --cov-report html --cov-report term - shell: bash - - - name: Upload backend coverage report - uses: actions/upload-artifact@v7 - with: - name: backend-coverage-report - path: htmlcov diff --git a/.github/actions/ci/ruff/action.yml b/.github/actions/ci/ruff/action.yml deleted file mode 100644 index 0fa498b..0000000 --- a/.github/actions/ci/ruff/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Run CI job - Ruff -description: Run Ruff linting checks on the codebase. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Check with ruff - run: | - uv run -m ruff check - shell: bash diff --git a/.github/actions/ci/validate-pyproject/action.yml b/.github/actions/ci/validate-pyproject/action.yml deleted file mode 100644 index fa2566a..0000000 --- a/.github/actions/ci/validate-pyproject/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Run CI job - Validate pyproject.toml -description: Validate pyproject.toml structure. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Validate pyproject.toml - run: | - uv run validate-pyproject pyproject.toml - shell: bash diff --git a/.github/actions/ci/version-check/action.yml b/.github/actions/ci/version-check/action.yml deleted file mode 100644 index 9e2cb68..0000000 --- a/.github/actions/ci/version-check/action.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Run CI job - Version Check -description: Check version consistency across pyproject.toml and uv.lock. - -inputs: - additional-versions: - description: 'Additional versions to check as JSON array. Each entry should have "name" and "version" fields. Example: [{"name": "package.json", "version": "1.2.3"}]' - required: false - default: '[]' - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-dev - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - if: github.event.repository.name != 'template-python' - - - name: Check version consistency - run: | - # Get reference version from pyproject.toml - REFERENCE_VERSION=$(uv run ci-pyproject-version) - echo "Reference version (pyproject.toml): $REFERENCE_VERSION" - - MISMATCH=false - - # Check uv.lock - LOCK_VERSION=$(uv run ci-uv-lock-version) - if [ "$LOCK_VERSION" != "$REFERENCE_VERSION" ]; then - echo "❌ uv.lock: $LOCK_VERSION (expected $REFERENCE_VERSION)" - MISMATCH=true - fi - - # Check additional versions if provided - ADDITIONAL='${{ inputs.additional-versions }}' - if [ "$ADDITIONAL" != "[]" ] && [ -n "$ADDITIONAL" ]; then - while IFS= read -r item; do - name=$(echo "$item" | jq -r '.name') - version=$(echo "$item" | jq -r '.version') - if [ "$version" != "$REFERENCE_VERSION" ]; then - echo "❌ $name: $version (expected $REFERENCE_VERSION)" - MISMATCH=true - fi - done < <(echo "$ADDITIONAL" | jq -c '.[]') - fi - - if [ "$MISMATCH" = true ]; then - echo "Version consistency check FAILED!" - exit 1 - fi - - echo "All versions match: $REFERENCE_VERSION" - shell: bash diff --git a/.github/actions/docs/build-docs/action.yml b/.github/actions/docs/build-docs/action.yml deleted file mode 100644 index cc264c5..0000000 --- a/.github/actions/docs/build-docs/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Build Documentation with Sphinx -description: Builds documentation using Sphinx and uploads it as an artifact. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/install-python-docs - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-docs@main - if: github.event.repository.name != 'template-python' - - - name: Build docs - run: | - uv run sphinx-build -M clean docs/source/ docs/build/ - uv run sphinx-build -M html docs/source/ docs/build/ - shell: bash - - - name: Upload docs artifact - uses: actions/upload-artifact@v7 - with: - name: documentation - path: docs/build/ diff --git a/.github/actions/docs/publish-docs/action.yml b/.github/actions/docs/publish-docs/action.yml deleted file mode 100644 index 7ddb28b..0000000 --- a/.github/actions/docs/publish-docs/action.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish Documentation with Sphinx -description: Deploys Sphinx documentation to GitHub Pages. - -outputs: - page_url: - description: 'URL of the deployed GitHub Pages site' - value: ${{ steps.deployment.outputs.page_url }} - -runs: - using: composite - steps: - - name: Download docs artifact - uses: actions/download-artifact@v7 - with: - name: documentation - path: docs/build/ - - - name: Upload to GitHub Pages - uses: actions/upload-pages-artifact@v4 - with: - path: docs/build/html - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v5 diff --git a/.github/actions/setup/install-python-core/action.yml b/.github/actions/setup/install-python-core/action.yml deleted file mode 100644 index c1c4554..0000000 --- a/.github/actions/setup/install-python-core/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Install Core Python Dependencies -description: Installs core Python dependencies from pyproject.toml using uv. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/setup-uv-python - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main - if: github.event.repository.name != 'template-python' - - - name: Install dependencies - run: | - uv sync - shell: bash diff --git a/.github/actions/setup/install-python-dev/action.yml b/.github/actions/setup/install-python-dev/action.yml deleted file mode 100644 index 5227723..0000000 --- a/.github/actions/setup/install-python-dev/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Install Dev Python Dependencies -description: Installs dev Python dependencies from pyproject.toml using uv. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/setup-uv-python - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main - if: github.event.repository.name != 'template-python' - - - name: Install dependencies - run: | - uv sync --extra dev - shell: bash diff --git a/.github/actions/setup/install-python-docs/action.yml b/.github/actions/setup/install-python-docs/action.yml deleted file mode 100644 index d4bd7c0..0000000 --- a/.github/actions/setup/install-python-docs/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Install Docs Python Dependencies -description: Installs documentation Python dependencies from pyproject.toml using uv. - -runs: - using: composite - steps: - - uses: ./.github/actions/setup/setup-uv-python - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main - if: github.event.repository.name != 'template-python' - - - name: Install dependencies - run: | - uv sync --extra docs - shell: bash diff --git a/.github/actions/setup/setup-uv-python/action.yml b/.github/actions/setup/setup-uv-python/action.yml deleted file mode 100644 index e72bbe4..0000000 --- a/.github/actions/setup/setup-uv-python/action.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Setup uv + Python -description: Sets up Python with uv. - -runs: - using: composite - steps: - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - cache-dependency-glob: "uv.lock" - - name: "Set up Python" - uses: actions/setup-python@v6 - with: - python-version-file: ".python-version" - - name: Set package name - run: | - REPO_NAME="${{ github.event.repository.name }}" - echo "PACKAGE_NAME=${REPO_NAME//-/_}" >> $GITHUB_ENV - shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0fbb24..460dc76 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,19 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/build/build-wheel - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/build/build-wheel@main verify-structure: runs-on: ubuntu-latest needs: build-wheel steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/build/verify-structure - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/build/verify-structure@main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be9ca06..e34ed6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,69 +13,54 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/ci/validate-pyproject - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/validate-pyproject@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/ci/validate-pyproject@main ruff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/ci/ruff - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/ruff@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/ci/ruff@main mypy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/ci/mypy - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/mypy@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/ci/mypy@main pytest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/ci/pytest - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/pytest@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/setup/check-tests-exists@main + id: check-tests-exists + - uses: javidahmed64592/actions-template-python/actions/ci/pytest@main + if: steps.check-tests-exists.outputs.exists == 'true' bandit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/ci/bandit - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/bandit@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/ci/bandit@main pip-audit: runs-on: ubuntu-latest continue-on-error: true steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/ci/pip-audit - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/pip-audit@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/ci/pip-audit@main version-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + - uses: javidahmed64592/actions-template-python/actions/ci/version-check@main + + frontend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: javidahmed64592/actions-template-python/actions/setup/check-frontend-exists@main + id: check-frontend-exists - - uses: ./.github/actions/ci/version-check - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/ci/version-check@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/ci/frontend@main + if: steps.check-frontend-exists.outputs.exists == 'true' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cde1751..55ef55c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,11 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/docs/build-docs - if: github.event.repository.name == 'template-python' - - uses: javidahmed64592/template-python/.github/actions/docs/build-docs@main - if: github.event.repository.name != 'template-python' + - uses: javidahmed64592/actions-template-python/actions/docs/build-docs@main publish-docs: runs-on: ubuntu-latest @@ -28,13 +24,5 @@ jobs: id-token: write steps: - uses: actions/checkout@v6 - - - uses: ./.github/actions/docs/publish-docs - if: github.event.repository.name == 'template-python' - id: publish_local - - uses: javidahmed64592/template-python/.github/actions/docs/publish-docs@main - if: github.event.repository.name != 'template-python' - id: publish_remote - - id: publish - run: echo "page_url=${{ steps.publish_local.outputs.page_url || steps.publish_remote.outputs.page_url }}" >> $GITHUB_OUTPUT - shell: bash + - uses: javidahmed64592/actions-template-python/actions/docs/publish-docs@main + id: publish diff --git a/docs/source/index.rst b/docs/source/index.rst index 9f36b35..8acbd35 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,9 +1,8 @@ |project_name| Documentation ============================== -Welcome to the |project_name| documentation! This template provides a modern -Python project structure with comprehensive tooling for development, testing, -and deployment. +Welcome to the |project_name| documentation! +This template provides a modern Python project structure with comprehensive tooling for development, testing, and deployment. .. note:: Ensure you enable GitHub Pages in your repository settings to host this documentation online: @@ -31,12 +30,6 @@ Detailed Documentation smg -.. toctree:: - :maxdepth: 3 - :caption: Workflows - - workflows - Indices and tables ================== diff --git a/docs/source/workflows.rst b/docs/source/workflows.rst deleted file mode 100644 index 1e053e8..0000000 --- a/docs/source/workflows.rst +++ /dev/null @@ -1,377 +0,0 @@ -Workflows -========= - -This document details the CI/CD workflows and reusable actions to build and release Python applications. -They run automated code quality checks to ensure code remains robust, maintainable, and testable. - -Actions -------- - -The following actions can be referenced from other repositories using ``javidahmed64592/template-python/.github/actions/{category}/{action}@main``. - -Setup Actions -~~~~~~~~~~~~~ - -**setup-uv-python** - -- **Description:** Sets up Python with uv. -- **Location:** ``setup-uv-python/action.yml`` -- **Steps:** - - - Installs uv using ``astral-sh/setup-uv@v7`` with caching enabled - - Sets up Python using ``actions/setup-python@v6`` and the version specified in ``.python-version`` - - Caches dependencies based on ``uv.lock`` for faster builds - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main - ----- - -**install-python-core** - -- **Description:** Installs core Python dependencies from pyproject.toml using uv. -- **Location:** ``install-python-core/action.yml`` -- **Steps:** - - - Uses the ``setup-uv-python`` action - - Runs ``uv sync`` to install only core dependencies - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-core@main - ----- - -**install-python-dev** - -- **Description:** Installs dev Python dependencies from pyproject.toml using uv. -- **Location:** ``install-python-dev/action.yml`` -- **Steps:** - - - Uses the ``setup-uv-python`` action - - Runs ``uv sync --extra dev`` to install core and dev dependencies - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main - ----- - -**install-python-docs** - -- **Description:** Installs documentation Python dependencies from pyproject.toml using uv. -- **Location:** ``install-python-docs/action.yml`` -- **Steps:** - - - Uses the ``setup-uv-python`` action - - Runs ``uv sync --extra docs`` to install core and docs dependencies - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/setup/install-python-docs@main - ----- - -CI Actions -~~~~~~~~~~ - -**validate-pyproject** - -- **Description:** Validate pyproject.toml structure. -- **Location:** ``validate-pyproject/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Runs ``uv run validate-pyproject pyproject.toml`` to validate TOML structure - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/validate-pyproject@main - ----- - -**ruff** - -- **Description:** Run Ruff linting checks on the codebase. -- **Location:** ``ruff/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Runs ``uv run -m ruff check`` to lint the code - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/ruff@main - ----- - -**mypy** - -- **Description:** Run Mypy type checking on the codebase. -- **Location:** ``mypy/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Runs ``uv run -m mypy .`` to perform static type checking - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/mypy@main - ----- - -**pytest** - -- **Description:** Run Pytest tests with coverage reporting. -- **Location:** ``pytest/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Runs ``uv run -m pytest --cov-report html --cov-report term`` to execute tests with coverage - - Uploads HTML coverage report as artifact named ``backend-coverage-report`` - - Fails if coverage drops below the threshold configured in ``pyproject.toml`` - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/pytest@main - ----- - -**bandit** - -- **Description:** Run Bandit security checks on the codebase. -- **Location:** ``bandit/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Runs ``uv run bandit -r $PACKAGE_NAME -f json -o bandit-report.json`` to scan for security vulnerabilities - - Uploads JSON report as artifact named ``bandit-report`` - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/bandit@main - ----- - -**pip-audit** - -- **Description:** Run pip-audit to check for known vulnerabilities in dependencies. -- **Location:** ``pip-audit/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Runs ``uv run pip-audit --desc`` to check dependencies for known CVEs - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/pip-audit@main - ----- - -**version-check** - -- **Description:** Check version consistency across pyproject.toml and uv.lock. -- **Location:** ``version-check/action.yml`` -- **Steps:** - - - Uses the ``install-python-dev`` action - - Extracts version from ``pyproject.toml`` using ``uv run ci-pyproject-version`` - - Verifies ``uv.lock`` version matches using ``uv run ci-uv-lock-version`` - - Optionally checks additional version files via ``additional-versions`` input - - Fails if any version mismatch is detected - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/version-check@main - -**Advanced usage with additional version files:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/ci/version-check@main - with: - additional-versions: '[{"name": "package.json", "version": "1.2.3"}]' - ----- - -Build Actions -~~~~~~~~~~~~~ - -**build-wheel** - -- **Description:** Build Python wheel package and upload as artifact. -- **Location:** ``build-wheel/action.yml`` -- **Steps:** - - - Uses the ``install-python-core`` action - - Runs ``uv build`` to create the wheel - - Inspects wheel contents using ``unzip -l`` - - Uploads wheel as artifact with name ``{PACKAGE_NAME}_wheel`` - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main - ----- - -**verify-structure** - -- **Description:** Download and verify the structure of the built wheel package. -- **Location:** ``verify-structure/action.yml`` -- **Steps:** - - - Uses the ``install-python-core`` action - - Downloads the wheel artifact (named ``{PACKAGE_NAME}_wheel``) - - Installs the wheel using ``uv pip install`` - - Verifies that ``site-packages`` and the package directory exist - - Optionally verifies additional directories specified in inputs - - Fails if any required directory is missing - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main - -**Advanced usage with additional checks:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main - with: - expected-directories: | - static - ----- - -Docs Actions -~~~~~~~~~~~~ - -**build-docs** - -- **Description:** Build Sphinx documentation and upload as artifact. -- **Location:** ``build-docs/action.yml`` -- **Steps:** - - - Uses the ``install-python-docs`` action - - Runs ``uv run sphinx-build -M clean docs/source/ docs/build/`` to clean previous builds - - Runs ``uv run sphinx-build -M html docs/source/ docs/build/`` to build HTML documentation - - Uploads built documentation as artifact named ``documentation`` - -**Usage:** - -.. code-block:: yaml - - steps: - - uses: javidahmed64592/template-python/.github/actions/docs/build-docs@main - ----- - -**publish-docs** - -- **Description:** Deploy Sphinx documentation to GitHub Pages. -- **Location:** ``publish-docs/action.yml`` -- **Outputs:** - - - ``page_url``: URL of the deployed GitHub Pages site - -- **Steps:** - - - Downloads the ``documentation`` artifact - - Uploads HTML files to GitHub Pages using ``actions/upload-pages-artifact@v4`` - - Deploys to GitHub Pages using ``actions/deploy-pages@v5`` - - Returns the deployed page URL as output - -**Usage:** - -.. code-block:: yaml - - steps: - - id: publish - uses: javidahmed64592/template-python/.github/actions/docs/publish-docs@main - - run: echo "Deployed to ${{ steps.publish.outputs.page_url }}" - ----- - -Workflows ---------- - -The following workflows ensure Python codebases are robust and thoroughly tested. - -CI Workflow -~~~~~~~~~~~ - -The CI workflow runs on pushes and pull requests to the ``main`` branch. -It runs parallel jobs to validate code quality, security, and consistency. - -**Jobs:** - -- ``validate-pyproject`` - Validates ``pyproject.toml`` structure -- ``ruff`` - Runs Ruff linting checks -- ``mypy`` - Runs static type checking -- ``pytest`` - Runs tests with coverage reporting -- ``bandit`` - Scans for security vulnerabilities -- ``pip-audit`` - Audits dependencies for known CVEs -- ``version-check`` - Verifies version consistency - -Build Workflow -~~~~~~~~~~~~~~ - -The Build workflow runs on pushes and pull requests to the ``main`` branch. -It builds and verifies the Python wheel package. - -**Jobs:** - -- ``build-wheel`` - Builds the wheel package and uploads as artifact -- ``verify-structure`` - Downloads and verifies the wheel contents (depends on ``build-wheel``) - -Docs Workflow -~~~~~~~~~~~~~ - -The Docs workflow runs on pushes and pull requests to the ``main`` branch. -It builds Sphinx documentation and deploys it to GitHub Pages on pushes to ``main``. - -**Jobs:** - -- ``build-docs`` - Builds the Sphinx HTML documentation and uploads as artifact -- ``publish-docs`` - Deploys documentation to GitHub Pages (only on pushes to ``main``, depends on ``build-docs``)