diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..5080dab --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Upload to PyPI + +on: + release: + types: [created] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Set up Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install setuptools wheel twine + + - name: Build and Publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USER }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + rm -f dist/* + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2f4b93e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Tests + +on: + # only run tests when src code changes + push: + branches: + - master + paths: + - "markdownextradata/**" + - "test/**" + - ".github/workflows/tests.yml" + pull_request: + branches: + - master + paths: + - "markdownextradata/**" + - "test/**" + - ".github/workflows/tests.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run-pytest: + name: Run pytest tests + # NOTE: we can change back to ubuntu-latest if we drop support for py3.6 + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install mkdocs pyyaml pytest click + python -m pip install -e . + + - name: Run pytest + run: | + pytest test -s diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1b748bd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python -python: - - 3.6 - - 3.7 - -branches: - only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ # version tags - - -install: - - pip install mkdocs pyyaml pytest click - - python setup.py install - -script: - - pytest test -s - -deploy: - provider: pypi - distributions: sdist - user: $PYPI_USER - password: $PYPI_PASSWORD - on: - tags: true - python: 3.7 - -notifications: - email: - on_success: never diff --git a/setup.py b/setup.py index f63f317..aec9040 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ import os -import sys from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand + def read(fname): file_path = os.path.join(os.path.dirname(__file__), fname) @@ -9,22 +8,10 @@ def read(fname): content = file.read() return content if content else 'no content read' -class PyTest(TestCommand): - user_options = [] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = [] - - def run_tests(self): - #import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args) - sys.exit(errno) setup( name='mkdocs-markdownextradata-plugin', - version='0.2.4', + version='0.2.5', description='A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template', long_description=read('README.md'), long_description_content_type='text/markdown', @@ -33,14 +20,7 @@ def run_tests(self): author='Ross Crawford-d\'Heureuse', author_email='sendrossemail@gmail.com', license='MIT', - tests_require=[ - 'pytest', - 'mkdocs', - 'pyyaml', - 'click', - ], - cmdclass = {'test': PyTest}, - python_requires='>=2.7.9,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', + python_requires='>=3.6', install_requires=[ 'mkdocs', 'pyyaml', @@ -51,13 +31,13 @@ def run_tests(self): 'Intended Audience :: Information Technology', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7' + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ], packages=find_packages(exclude=['*.tests']), entry_points={