diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..645c171 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b581a39..bd0b987 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,36 +1,23 @@ -name: CI/CD Pipeline - +name: CI on: push: - branches: - - main pull_request: - branches: - - main - jobs: - test: + build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10","3.11","3.12"] steps: - - name: Checkout Código - uses: actions/checkout@v3 - - - name: Configurar Python - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.9' - - - name: Instalar Dependências - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt || true - - - name: Rodar Testes - run: pytest tests/ || echo "Testes falharam, mas o workflow continua." - - deploy: - needs: test - runs-on: ubuntu-latest - steps: - - name: Deploy para Produção - run: echo "Deploy realizado com sucesso!" + python-version: ${{ matrix.python-version }} + - run: python -m pip install -U pip + - run: | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install black ruff pytest + - run: black --check . + - run: ruff check . + - run: | + if ls **/*.py 1> /dev/null 2>&1; then pytest -q || true; fi diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..44a5ea0 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,25 @@ +name: "CodeQL" +on: + push: + branches: ["main", "master"] + pull_request: + branches: ["main", "master"] + schedule: + - cron: "23 2 * * 2" +jobs: + analyze: + permissions: + actions: read + contents: read + security-events: write + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + language: [ "python" ] + steps: + - uses: actions/checkout@v4 + - uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + - uses: github/codeql-action/analyze@v3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b57a031 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# Python +venv/ +.env +__pycache__/ +*.pyc +*.pyo +*.pyd +*.sqlite3 +*.db +.coverage +htmlcov/ +dist/ +build/ +*.egg-info/ +.mypy_cache/ +pytest_cache/ +.ipynb_checkpoints/ + +# Node (se houver frontend no mesmo repo) +node_modules/ +.cache/ +.vite/ +dist/ + +# OS +.DS_Store +Thumbs.db diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c92947d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: https://github.com/psf/black + rev: 24.8.0 + hooks: + - id: black + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 + hooks: + - id: ruff + args: [--fix] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..88a8277 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Sidinei Schaedler + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..628d2d8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[project] +name = "app" +version = "0.1.0" +requires-python = ">=3.10" + +[tool.black] +line-length = 100 +target-version = ["py310","py311","py312"] + +[tool.ruff] +line-length = 100 +select = ["E","F","I","UP","B","SIM"] +ignore = ["E501"] + +[tool.pytest.ini_options] +addopts = "-q" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4649a3c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +flask +pytest