From 2c0851f0008a8d70055c718814573013670ff7c1 Mon Sep 17 00:00:00 2001 From: Karanjot Singh <99573351+Karanjot786@users.noreply.github.com> Date: Wed, 3 Jul 2024 04:14:28 +0530 Subject: [PATCH] chore: Set up CI pipeline (#12) --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 48 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3b7c091 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + poetry install + + - name: Lint with Ruff + run: | + poetry run ruff check src/ tests/ + + - name: Type check with Mypy + run: | + poetry run mypy src/ + + - name: Run security checks with Bandit + run: | + poetry run bandit -r src/ + + - name: Install test dependencies + run: | + poetry add pytest pytest-cov pytest-mock + + - name: Run tests + run: | + poetry run pytest --cov=src + + - name: Generate documentation + run: | + poetry run sphinx-build -b html docs/ docs/_build/html diff --git a/pyproject.toml b/pyproject.toml index 4972c75..ebc5eae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,10 +3,10 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.poetry] -name = "wrroc-ga4gh-cloud-converter" +name = "CrateGen" version = "0.1.0" description = "A tool for converting TES and WES to WRROC" -authors = ["Elixir Cloud AAI "] +authors = ["Karanjot Singh "] license = "Apache-2.0" readme = "README.md" repository = "https://github.com/elixir-cloud-aai/wrroc-ga4gh-cloud-converter" @@ -30,5 +30,49 @@ pytest = "^6.2.4" sphinx = "^3.5.4" pre-commit = "^2.13.0" +[tool.poetry.group.lint.dependencies] +ruff = "^0.4.4" +typos = "^1.21.0" +[tool.poetry.group.docs.dependencies] +sphinx = "^7.3.7" +sphinx-autodoc-typehints = "^2.1.0" +furo = "^2024.5.6" +[tool.poetry.group.security.dependencies] +bandit = "^1.7.8" +safety = "^3.2.0" + +[tool.poetry.group.test.dependencies] +pytest = "^6.2.4" +pytest-cov = "^5.0.0" +pytest-mock = "^3.6.1" + +[tool.poetry.group.types.dependencies] +mypy = "^1.10.0" + +[tool.bandit] +skips = [ + "B321", # FTP-related functions are being called. + "B402", # A FTP-related module is being imported. +] + +[tool.ruff] +select = ["B", "D", "E", "F", "I", "PL", "SIM", "UP"] + +ignore = [ + "D203", # conflicts with D202 as formatter removes black line before class docstring + "D206", # conflicts with E101, `format.indent-style="tab"` + "D213", # conflicts with D212, would have been ignored regardless +] + +per-file-ignores = { + "src/wrroc_converter/**/*.py" = ["D"], + "tests/**/*.py" = ["D"] +} + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.typos.default.extend-words] +mke = 'mke' \ No newline at end of file