Skip to content

Commit e011760

Browse files
authored
Merge pull request #34 from digitronik/ci
Introduce py3.8 and restructure CI
2 parents 6e287a2 + 04b3de5 commit e011760

File tree

7 files changed

+127
-33
lines changed

7 files changed

+127
-33
lines changed

.github/workflows/main.yml

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,59 @@
1-
name: Link Status
1+
name: Tests
22

33
on: [push, pull_request]
44

55
jobs:
66
pre-commit:
77
name: Pre-Commit Checks
88
runs-on: ubuntu-latest
9+
910
steps:
1011
- name: Checkout to master
1112
uses: actions/checkout@master
1213

1314
- name: Setup python
1415
uses: actions/setup-python@v1
1516
with:
16-
python-version: '3.7'
17+
python-version: '3.8'
1718
architecture: 'x64'
1819

1920
- name: Pre-Commit Checks
2021
run: |
21-
python -m pip install pre-commit
22-
pre-commit run -a
22+
python -m pip install pip --upgrade
23+
pip install nox
24+
nox -s pre_commit
2325
2426
- name: Analysis (git diff)
2527
if: failure()
2628
run: git diff
2729

28-
tests:
29-
name: Test-${{ matrix.os }}-Py${{ matrix.python-version }}
30+
package:
31+
name: Build & Verify Package
3032
needs: pre-commit
31-
runs-on: ${{ matrix.os }}
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout to master
37+
uses: actions/checkout@master
38+
39+
- name: Setup python
40+
uses: actions/setup-python@v1
41+
with:
42+
python-version: '3.8'
43+
architecture: 'x64'
44+
- name: Build and check with twine
45+
run: |
46+
python -m pip install pip --upgrade
47+
pip install nox
48+
nox -s package
49+
50+
unit-tests:
51+
name: UnitTests-Python-${{ matrix.python-version }}
52+
needs: [ pre-commit, package ]
53+
runs-on: ubuntu-latest
3254
strategy:
3355
matrix:
34-
os: [ubuntu-latest, windows-latest, macos-latest]
35-
python-version: [ '3.6', '3.7' ]
56+
python-version: [ 'pypy3', '3.6', '3.7', '3.8' ]
3657
steps:
3758
- name: Checkout to master
3859
uses: actions/checkout@master
@@ -43,10 +64,39 @@ jobs:
4364
python-version: ${{ matrix.python-version }}
4465
architecture: x64
4566

46-
- name: Setup Package and Install Devel Dependencies
67+
- name: Unit Tests
4768
run: |
48-
python -m pip install -Ur dev-requirements.txt
49-
python -m pip install .
69+
python -m pip install pip --upgrade
70+
pip install nox
71+
nox -s ci_tests
5072
51-
- name: Unit Tests
52-
run: py.test -v tests
73+
- name: Upload coverage to Codecov
74+
uses: codecov/[email protected]
75+
with:
76+
file: coverage.xml
77+
flags: unittests
78+
name: codecov-linkstatus-{{ matrix.python-version }}
79+
fail_ci_if_error: true
80+
81+
platform:
82+
name: Platform-${{ matrix.os }}
83+
needs: [ unit-tests]
84+
runs-on: ${{ matrix.os }}
85+
strategy:
86+
matrix:
87+
os: [ubuntu-latest, windows-latest, macos-latest]
88+
steps:
89+
- name: Checkout to master
90+
uses: actions/checkout@master
91+
92+
- name: Setup python
93+
uses: actions/setup-python@v1
94+
with:
95+
python-version: '3.8'
96+
architecture: 'x64'
97+
98+
- name: Development setup and smoke test on platform ${{ matrix.os }}
99+
run: |
100+
python -m pip install pip --upgrade
101+
pip install nox
102+
nox -s dev_setup

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@ on:
1010
jobs:
1111
build-and-publish:
1212
name: Build and publish Python 🐍 distributions to PyPI
13-
runs-on: ubuntu-18.04
13+
if: startsWith(github.event.ref, 'refs/tags')
14+
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout to master
1617
uses: actions/checkout@master
1718

1819
- name: Setup python
1920
uses: actions/setup-python@v1
2021
with:
21-
python-version: '3.7'
22+
python-version: '3.8'
2223
architecture: 'x64'
2324

24-
- name: Build Package
25+
- name: Build Package and Check
2526
run: |
26-
python -m pip install --upgrade setuptools wheel
27+
python -m pip install --upgrade setuptools wheel twine
2728
python setup.py sdist bdist_wheel
29+
python -m twine check dist/*
2830
2931
- name: Deploy to PyPi
30-
if: startsWith(github.event.ref, 'refs/tags')
3132
uses: pypa/gh-action-pypi-publish@master
3233
with:
3334
user: __token__

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ Below is the steps for setting up a development environment
5454
```shell
5555
git clone https://github.com/pythonpune/linkstatus
5656
cd linkstatus
57-
virtualenv .venv
57+
python -m venv .venv
5858
source .venv/bin/activate
59-
python -m pip install -Ur dev-requirements.txt
6059
python -m pip install -e .
6160
linkstatus --help
6261
```
6362

6463
# Run unit test with nox
6564
```shell
65+
python -m pip install nox
6666
nox --list # list all available sessions
6767
nox -s pre_commit # run pre-commit checks
6868
nox -s tests # run unit tests

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
<p align="center">
55
<a href="https://pypi.org/project/linkstatus"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/linkstatus.svg?style=flat"></a>
6-
<a href="https://travis-ci.com/pythonpune/linkstatus"><img alt="Build Status"
7-
src="https://travis-ci.com/pythonpune/linkstatus.svg?branch=master"></a>
8-
<a href="https://github.com/pythonpune/linkstatus/blob/master/LICENSE"><img alt="License: GPLv3" src="https://img.shields.io/pypi/l/linkstatus.svg?version=latest"></a>
96
<a href="https://pypi.org/project/linkstatus/#history"><img alt="PyPI version" src="https://badge.fury.io/py/linkstatus.svg"></a>
107
<a href="https://pepy.tech/project/linkstatus"><img alt="Downloads" src="https://pepy.tech/badge/linkstatus"></a>
8+
<a href="https://codecov.io/gh/pythonpune/linkstatus"><img src="https://codecov.io/gh/pythonpune/linkstatus/branch/master/graph/badge.svg"></a>
9+
<a href="https://github.com/pythonpune/linkstatus/blob/master/LICENSE"><img alt="License: GPLv3" src="https://img.shields.io/pypi/l/linkstatus.svg?version=latest"></a>
1110
<a href="https://pypi.org/project/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
1211
</p>
1312

dev-requirements.txt

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

noxfile.py

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,60 @@
11
import nox
22

3+
nox.options.sessions = ["pre_commit", "tests"]
4+
35

46
@nox.session
57
def pre_commit(session):
8+
"""pre-commit checks"""
69
session.install("pre-commit")
710
session.run("pre-commit", "run", "-a")
811

912

10-
@nox.session(python=["3.6", "3.7"])
13+
@nox.session(python=["pypy3", "3.6", "3.7", "3.8"])
1114
def tests(session):
12-
session.install("pytest", "ruamel.yaml", ".")
13-
session.run("pytest", "-sqvv", "tests")
15+
"""Run unit test over different python env with code coverage"""
16+
session.install("pytest", "pytest-cov", "ruamel.yaml", "-e", ".")
17+
session.run(
18+
"py.test",
19+
"--cov=linkstatus",
20+
"--cov-report",
21+
"term-missing",
22+
"--cov-branch",
23+
"--color=yes",
24+
"-s",
25+
"-v",
26+
)
27+
28+
29+
@nox.session()
30+
def ci_tests(session):
31+
"""This is only to run test on ci"""
32+
session.install("pytest", "pytest-cov", "coverage", "ruamel.yaml", "-e", ".")
33+
session.run(
34+
"py.test",
35+
"--cov=linkstatus",
36+
"--cov-report=xml",
37+
"--cov-branch",
38+
"--color=yes",
39+
"-s",
40+
"-v",
41+
)
42+
session.run("coverage", "report")
43+
44+
45+
@nox.session()
46+
def package(session):
47+
"""Build and verify package"""
48+
session.install("twine", "setuptools", "wheel")
49+
session.run("python", "setup.py", "sdist", "bdist_wheel")
50+
session.run("ls", "-l", "dist")
51+
session.run("python", "-m", "twine", "check", "dist/*")
52+
53+
54+
@nox.session()
55+
def dev_setup(session):
56+
"""Ensure development environment works everywhere. mainly with ci on different platform"""
57+
session.run("python", "-m", "pip", "install", "-e", ".[dev]")
58+
session.run("python", "-c", "import linkstatus; print(linkstatus.__spec__)")
59+
session.install("pytest", "ruamel.yaml")
60+
session.run("py.test", "-v", "tests/test_linkstatus.py")

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ long_description = file: README.md
2121
long_description_content_type = text/markdown
2222
classifiers =
2323
Natural Language :: English
24-
Programming Language :: Python :: 3.5
2524
Programming Language :: Python :: 3.6
2625
Programming Language :: Python :: 3.7
26+
Programming Language :: Python :: 3.8
2727
Intended Audience :: End Users/Desktop
2828
Intended Audience :: Developers
2929
Environment :: Console
30+
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
3031

3132
[options]
3233
packages = find:
@@ -37,7 +38,7 @@ install_requires =
3738
markdown
3839
requests
3940
include_package_data = True
40-
python_requires = >=3.5
41+
python_requires = >=3.6
4142

4243
[options.entry_points]
4344
console_scripts =

0 commit comments

Comments
 (0)