diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..98a911f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + target-branch: "dev" + schedule: + interval: "monthly" + open-pull-requests-limit: 1 + groups: + all-python-deps: + patterns: + - "*" diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..8814dcf --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,47 @@ +name: CI/CD + +on: + push: + branches: [main] + paths-ignore: + - "requirements.txt" + workflow_dispatch: + +permissions: + contents: write + pages: write + id-token: write + +jobs: + run-tests: + uses: ./.github/workflows/tests.yml + + build-docs: + needs: run-tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Doxygen & Graphviz + run: | + sudo apt-get update + sudo apt-get install -y doxygen graphviz + + - name: Generate documentation + run: doxygen Doxyfile + + - name: Upload artifact for GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs/html + + deploy-docs: + needs: build-docs + runs-on: ubuntu-latest + environment: + name: github-pages + steps: + - name: Deploy to GitHub Pages + id: deploy + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..309921e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,33 @@ +name: Tests + +on: + pull_request: + branches: [dev] + workflow_call: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install UV + uses: astral-sh/setup-uv@v2 + with: + enable-cache: true + + - name: Install dependencies & test tools + run: | + uv run pip install -r requirements.txt + uv run pip install pytest + + - name: Run tests + run: uv run pytest src/tests/ -v --tb=short diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0f71a96 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.11-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 5000 + +CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] + diff --git a/pyproject.toml b/pyproject.toml index 60d6196..fc0fa2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,5 +6,6 @@ readme = "README.md" requires-python = ">=3.14" dependencies = [ "flask>=3.1.2", + "gunicorn>=23.0.0", "pytest>=9.0.2", ] diff --git a/requirements.txt b/requirements.txt index 9e74371..de4f814 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ blinker==1.9.0 click==8.3.1 flask==3.1.2 +gunicorn==23.0.0 iniconfig==2.3.0 itsdangerous==2.2.0 jinja2==3.1.6