Skip to content

Commit 23eea4a

Browse files
migrate to gh actions, add tests and publish wheel (#44)
* migrate to gh actions, add tests and publish wheel * downgrade ubuntu * drop explicit support for py3.4 and py3.5 since tests are using fstrings * revert back to actual pypi * remove tests in setup.py * chore: py3 only classifier
1 parent ed92246 commit 23eea4a

File tree

4 files changed

+97
-59
lines changed

4 files changed

+97
-59
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Upload to PyPI
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
deploy:
13+
name: Deploy
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.10"
24+
25+
- name: Set up Python dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install setuptools wheel twine
29+
30+
- name: Build and Publish
31+
env:
32+
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
33+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
34+
run: |
35+
rm -f dist/*
36+
python setup.py sdist bdist_wheel
37+
twine upload dist/*

.github/workflows/tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Tests
2+
3+
on:
4+
# only run tests when src code changes
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "markdownextradata/**"
10+
- "test/**"
11+
- ".github/workflows/tests.yml"
12+
pull_request:
13+
branches:
14+
- master
15+
paths:
16+
- "markdownextradata/**"
17+
- "test/**"
18+
- ".github/workflows/tests.yml"
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
run-pytest:
26+
name: Run pytest tests
27+
# NOTE: we can change back to ubuntu-latest if we drop support for py3.6
28+
runs-on: ubuntu-20.04
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
37+
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: Set up Python dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
python -m pip install mkdocs pyyaml pytest click
47+
python -m pip install -e .
48+
49+
- name: Run pytest
50+
run: |
51+
pytest test -s

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

setup.py

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
import os
2-
import sys
32
from setuptools import setup, find_packages
4-
from setuptools.command.test import test as TestCommand
3+
54

65
def read(fname):
76
file_path = os.path.join(os.path.dirname(__file__), fname)
87
with open(file_path) as file:
98
content = file.read()
109
return content if content else 'no content read'
1110

12-
class PyTest(TestCommand):
13-
user_options = []
14-
15-
def initialize_options(self):
16-
TestCommand.initialize_options(self)
17-
self.pytest_args = []
18-
19-
def run_tests(self):
20-
#import here, cause outside the eggs aren't loaded
21-
import pytest
22-
errno = pytest.main(self.pytest_args)
23-
sys.exit(errno)
2411

2512
setup(
2613
name='mkdocs-markdownextradata-plugin',
27-
version='0.2.4',
14+
version='0.2.5',
2815
description='A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template',
2916
long_description=read('README.md'),
3017
long_description_content_type='text/markdown',
@@ -33,14 +20,7 @@ def run_tests(self):
3320
author='Ross Crawford-d\'Heureuse',
3421
author_email='sendrossemail@gmail.com',
3522
license='MIT',
36-
tests_require=[
37-
'pytest',
38-
'mkdocs',
39-
'pyyaml',
40-
'click',
41-
],
42-
cmdclass = {'test': PyTest},
43-
python_requires='>=2.7.9,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
23+
python_requires='>=3.6',
4424
install_requires=[
4525
'mkdocs',
4626
'pyyaml',
@@ -51,13 +31,13 @@ def run_tests(self):
5131
'Intended Audience :: Information Technology',
5232
'License :: OSI Approved :: MIT License',
5333
'Programming Language :: Python',
54-
'Programming Language :: Python :: 2',
55-
'Programming Language :: Python :: 2.7',
56-
'Programming Language :: Python :: 3',
57-
'Programming Language :: Python :: 3.4',
58-
'Programming Language :: Python :: 3.5',
34+
'Programming Language :: Python :: 3 :: Only',
5935
'Programming Language :: Python :: 3.6',
60-
'Programming Language :: Python :: 3.7'
36+
'Programming Language :: Python :: 3.7',
37+
'Programming Language :: Python :: 3.8',
38+
'Programming Language :: Python :: 3.9',
39+
'Programming Language :: Python :: 3.10',
40+
'Programming Language :: Python :: 3.11',
6141
],
6242
packages=find_packages(exclude=['*.tests']),
6343
entry_points={

0 commit comments

Comments
 (0)