diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5fe4303 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,79 @@ +name: Build +on: + push: + pull_request: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + name: ๐Ÿ”จ Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + - name: ๐Ÿ— Install build dependencies + run: | + pip install wheel --user + pip install octoprint[develop] + - name: ๐Ÿ”จ Build a binary wheel and a source tarball + run: | + python setup.py sdist bdist_wheel + - name: โฌ† Upload build result + uses: actions/upload-artifact@v1 + with: + name: dist + path: dist + + pre-commit: + name: ๐Ÿงน Pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up dev dependencies + run: | + pip install octoprint[develop] + pip install -e .[develop] + - name: ๐Ÿš€ Run pre-commit + run: | + pre-commit run --all-files --show-diff-on-failure + + test-install: + name: ๐Ÿงช Installation tests + needs: build + strategy: + matrix: + python: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"] + installable: ["wheel", "sdist"] + runs-on: ubuntu-latest + steps: + - name: โฌ‡ Download build result + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + - name: ๐Ÿ— Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: ๐Ÿ— Install OctoPrint + run: | + pip install OctoPrint + - name: ๐Ÿš€ Install wheel + if: matrix.installable == 'wheel' + run: | + pip install dist/OctoPrint_*-py2.py3-none-any.whl + - name: ๐Ÿš€ Install source tarball + if: matrix.installable == 'sdist' + run: | + pip install dist/OctoPrint-*.tar.gz diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9267262..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -OctoPrint diff --git a/setup.cfg b/setup.cfg index 27d67a3..0c7a148 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -license_file = LICENSE.txt +license_file = LICENSE [bdist_wheel] universal = 1 diff --git a/setup.py b/setup.py index b4cf0c4..72663ef 100644 --- a/setup.py +++ b/setup.py @@ -53,8 +53,24 @@ def params(): # this plugin is not zip_safe. zip_safe = False - # Read the requirements from our requirements.txt file - install_requires = open("requirements.txt").read().split("\n") + # Requirements + install_requires = ['OctoPrint'] + + # Additional requirements for optional install options and/or OS-specific dependencies + extras_require = { + # Dependencies for development + "develop": [ + # Testing dependencies + "ddt", + "mock>=4,<5", + "pytest-doctest-custom>=1.0.0,<2", + "pytest>=6.2.5,<7", + # pre-commit + "pre-commit", + # profiler + "pyinstrument", + ], + } # Hook the plugin into the "octoprint.plugin" entry point, mapping the plugin_identifier to the plugin_package. # That way OctoPrint will be able to find the plugin and load it.