diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml new file mode 100644 index 0000000..ccc5115 --- /dev/null +++ b/.github/workflows/python-release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +permissions: + contents: write + +jobs: + release-win: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: # Latest Windows 7 compatible binary release from python.org + python-version: "3.8.10" + architecture: x86 + - run: python -m unittest -v + - name: Install packaging dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + - run: .\build.bat + - uses: softprops/action-gh-release@v1 + with: + files: "dist/*" + # draft: true + fail_on_unmatched_files: true + release-mac: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - run: python -m unittest -v + - name: Install packaging dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + - run: ./build_osx.sh + - uses: softprops/action-gh-release@v1 + with: + files: "dist/*" + # draft: true + fail_on_unmatched_files: true diff --git a/.github/workflows/python-unittest.yml b/.github/workflows/python-unittest.yml new file mode 100644 index 0000000..b417e88 --- /dev/null +++ b/.github/workflows/python-unittest.yml @@ -0,0 +1,26 @@ +name: Unittests + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +permissions: + contents: read + +jobs: + unittest: + + runs-on: ubuntu-20.04 # Versions =< 3.8.11 not awailable for ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8.10", "3"] # 3.8.10 for Windows 7 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - run: python -m unittest -v diff --git a/pyproject.toml b/pyproject.toml index 3270007..c025535 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dev = [ version = {attr = "heval.__version__"} [project.urls] -Homepage = "https://github.com/radioxoma/heval" +homepage = "https://github.com/radioxoma/heval" [project.gui-scripts] heval = "heval.__main__:main" diff --git a/tests/test_doctest.py b/tests/test_doctest.py index 334b8e7..6eb04fa 100644 --- a/tests/test_doctest.py +++ b/tests/test_doctest.py @@ -1,12 +1,14 @@ #!/usr/bin/env python import doctest +import unittest from heval import abg, drugs, electrolytes, human, nutrition -DOCTESTS = (abg, drugs, electrolytes, human, nutrition) +modules = (abg, drugs, electrolytes, human, nutrition) -def load_tests(loader, tests, ignore): - tests.addTests([doctest.DocTestSuite(t) for t in DOCTESTS]) +def load_tests(loader: unittest.TestLoader, tests, pattern) -> unittest.TestSuite: + """Callback to load doctests from modules.""" + tests.addTests([doctest.DocTestSuite(m) for m in modules]) return tests