diff --git a/setup.cfg b/.flake8 similarity index 71% rename from setup.cfg rename to .flake8 index e8527bd..2561054 100644 --- a/setup.cfg +++ b/.flake8 @@ -1,7 +1,5 @@ # flake8 does not support pyproject.toml, see: # https://github.com/PyCQA/flake8/issues/234 [flake8] -exclude = docs -max-line-length = 100 - - +exclude = docs,venv +max-line-length = 100 \ No newline at end of file diff --git a/.github/workflows/test_package.yml b/.github/workflows/test_package.yml index a1cbc08..fca1aa8 100644 --- a/.github/workflows/test_package.yml +++ b/.github/workflows/test_package.yml @@ -4,7 +4,7 @@ on: push: # The CI is executed on every push on every branch branches: - - "**" + - main pull_request: # The CI is executed on every pull request to the main branch branches: @@ -22,69 +22,57 @@ jobs: # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: # This action sets the current path to the root of your github repo - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: ${{ matrix.python-version }} - name: "Install code" - run: pip install .[test,docs] + run: python -m pip install .[test] - name: Flake8 code - run: flake8 . + run: python -m flake8 - name: Mypy check - run: | - pip install mypy - python -m mypy . --exclude=build - - - name: Generate coverage report - run: python -m pytest --cov=mypackage test - - - name: Generate html report - run: python -m coverage html - - - name: Upload coverage report as artifact - uses: actions/upload-artifact@v3 - with: - name: code-coverage-report - path: htmlcov - if-no-files-found: error - - - name: Build documentation - run: | - make doc - - - name: Upload documentation - uses: actions/upload-artifact@v3 - with: - name: documentation - path: docs/_build/html - if-no-files-found: error - + run: python -m mypy test-code: # This code depends on the result of check-code needs: check-code runs-on: ${{ matrix.os }} - + strategy: matrix: - os: [ubuntu-22.04, windows-latest, macos-12] - + os: [ubuntu-22.04, windows-latest, macos-12] + python-version: ["3.8", "3.9", "3.10"] + steps: - - uses: actions/setup-python@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: ${{ matrix.python-version }} - uses: actions/checkout@v3 - + - name: "Install mypackage" run: pip install .[test] - name: Run tests run: | - python -m pytest test/ \ No newline at end of file + python -m pytest + + - name: Upload coverage report as artifact + if: matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.10' + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: htmlcov + if-no-files-found: error diff --git a/pyproject.toml b/pyproject.toml index 1a7ac36..a2c21b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,4 +40,14 @@ ignore_missing_imports = true # Does not show errors when importing untyped libr exclude = [ # We only want mypy to consider files that are not generated in installing or building documentation "docs/", "build/" +] +files = [ # Folder to which files that should be checked by mypy + "src", + "test" +] + +[tool.pytest.ini_options] +addopts = "--cov=mypackage --cov-report html --cov-report term-missing -v" +testpaths = [ + "test" ] \ No newline at end of file