Skip to content

Commit

Permalink
Remove unused Dockerfile.tests and update tox.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
tyutyutyu committed Mar 3, 2024
1 parent 52c4924 commit 52e9475
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 50 deletions.
22 changes: 0 additions & 22 deletions .docker/Dockerfile.tests

This file was deleted.

33 changes: 31 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,39 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
slug: tyutyutyu/msps

sonarcloud:
runs-on: ubuntu-latest

steps:
- name: Update python
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: x64

- name: Install Poetry
run: curl -sSL curl -sSL https://install.python-poetry.org | python3 -

- name: Set env
run: echo "export PATH=${PATH}:$HOME/.poetry/bin" >> $GITHUB_ENV

- name: Checkout branch
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Install packages via Poetry
run: poetry install
- uses: actions/checkout@v4

- name: Run tox
run: tox -e py
run: poetry run tox -e py

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
uses: sonarsource/sonarcloud-github-action@v2.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
JAVA_HOME: /opt/java/openjdk
SONAR_SCANNER_HOME: /opt/sonar-scanner
113 changes: 112 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ packages = [{ include = "msps", from = "src" }, { include = "tests" }]
[tool.poetry.dependencies]
python = ">=3.10"
rich = "^13.7.0"
typer = "^0.9.0"
coverage = "^7.4.3"
tox = "^4.13.0"

[tool.poetry.group.test.dependencies]
pytest = "^8.0.0"
typer = "^0.9.0"
coverage = "^7.4.3"
tox = "^4.13.0"

[tool.poetry.group.typing.dependencies]
mypy = "^1.8.0"

[tool.poetry.group.lint.dependencies]
pylint = "^3.0.3"

[tool.poetry.group.dev.dependencies]
black = "^24.2.0"
pytest-sugar = "^1.0.0"
pytest-cov = "^4.1.0"

[tool.poetry.scripts]
msps = "msps.__main__:main"
testui = "tests.manual_test_ui:main"
Expand All @@ -41,6 +46,3 @@ strict = true

[tool.pytest.ini_options]
pythonpath = ["src"]

[tool.coverage.run]
source = ["src/msps"]
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.projectKey=tyutyutyu_msps
sonar.organization=tyutyutyu-1

sonar.python.version=3
sonar.sources=src
sonar.dynamicAnalysis=reuseReports
sonar.core.codeCoveragePlugin=coverage
sonar.python.coverage.reportPaths=*coverage*.xml
; sonar.python.xunit.reportPath=xunit-result*.xml
36 changes: 17 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
[tox]
requires =
tox>=4
env_list = lint, type, py{310,311,312}

[testenv]
description = run unit tests
deps =
pytest>=7
pytest-sugar
skip_install = true
allowlist_externals = poetry
commands_pre =
poetry install
commands =
pytest {posargs:tests}
poetry run pytest tests/ --import-mode importlib --cov=msps --cov-report=term-missing --cov-report=xml --cov-report=html

[testenv:lint]
description = run linters
skip_install = true
deps =
black==22.12
commands = black {posargs:.}
; [testenv:lint]
; description = run linters
; skip_install = true
; deps =
; black==22.12
; commands = black {posargs:.}

[testenv:type]
description = run type checks
deps =
mypy>=0.991
commands =
mypy {posargs:src tests}
; [testenv:type]
; description = run type checks
; deps =
; mypy>=0.991
; commands =
; mypy {posargs:src tests}

0 comments on commit 52e9475

Please sign in to comment.