Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 64 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,59 @@
name: Link Status
name: Tests

on: [push, pull_request]

jobs:
pre-commit:
name: Pre-Commit Checks
runs-on: ubuntu-latest

steps:
- name: Checkout to master
uses: actions/checkout@master

- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.7'
python-version: '3.8'
architecture: 'x64'

- name: Pre-Commit Checks
run: |
python -m pip install pre-commit
pre-commit run -a
python -m pip install pip --upgrade
pip install nox
nox -s pre_commit

- name: Analysis (git diff)
if: failure()
run: git diff

tests:
name: Test-${{ matrix.os }}-Py${{ matrix.python-version }}
package:
name: Build & Verify Package
needs: pre-commit
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

steps:
- name: Checkout to master
uses: actions/checkout@master

- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.8'
architecture: 'x64'
- name: Build and check with twine
run: |
python -m pip install pip --upgrade
pip install nox
nox -s package

unit-tests:
name: UnitTests-Python-${{ matrix.python-version }}
needs: [ pre-commit, package ]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [ '3.6', '3.7' ]
python-version: [ 'pypy3', '3.6', '3.7', '3.8' ]
steps:
- name: Checkout to master
uses: actions/checkout@master
Expand All @@ -43,10 +64,39 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Setup Package and Install Devel Dependencies
- name: Unit Tests
run: |
python -m pip install -Ur dev-requirements.txt
python -m pip install .
python -m pip install pip --upgrade
pip install nox
nox -s ci_tests

- name: Unit Tests
run: py.test -v tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.6
with:
file: coverage.xml
flags: unittests
name: codecov-linkstatus-{{ matrix.python-version }}
fail_ci_if_error: true

platform:
name: Platform-${{ matrix.os }}
needs: [ unit-tests]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout to master
uses: actions/checkout@master

- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.8'
architecture: 'x64'

- name: Development setup and smoke test on platform ${{ matrix.os }}
run: |
python -m pip install pip --upgrade
pip install nox
nox -s dev_setup
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,25 @@ on:
jobs:
build-and-publish:
name: Build and publish Python 🐍 distributions to PyPI
runs-on: ubuntu-18.04
if: startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout to master
uses: actions/checkout@master

- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.7'
python-version: '3.8'
architecture: 'x64'

- name: Build Package
- name: Build Package and Check
run: |
python -m pip install --upgrade setuptools wheel
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
python -m twine check dist/*

- name: Deploy to PyPi
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ Below is the steps for setting up a development environment
```shell
git clone https://github.com/pythonpune/linkstatus
cd linkstatus
virtualenv .venv
python -m venv .venv
source .venv/bin/activate
python -m pip install -Ur dev-requirements.txt
python -m pip install -e .
linkstatus --help
```

# Run unit test with nox
```shell
python -m pip install nox
nox --list # list all available sessions
nox -s pre_commit # run pre-commit checks
nox -s tests # run unit tests
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

<p align="center">
<a href="https://pypi.org/project/linkstatus"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/linkstatus.svg?style=flat"></a>
<a href="https://travis-ci.com/pythonpune/linkstatus"><img alt="Build Status"
src="https://travis-ci.com/pythonpune/linkstatus.svg?branch=master"></a>
<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>
<a href="https://pypi.org/project/linkstatus/#history"><img alt="PyPI version" src="https://badge.fury.io/py/linkstatus.svg"></a>
<a href="https://pepy.tech/project/linkstatus"><img alt="Downloads" src="https://pepy.tech/badge/linkstatus"></a>
<a href="https://codecov.io/gh/pythonpune/linkstatus"><img src="https://codecov.io/gh/pythonpune/linkstatus/branch/master/graph/badge.svg"></a>
<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>
<a href="https://pypi.org/project/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

Expand Down
4 changes: 0 additions & 4 deletions dev-requirements.txt

This file was deleted.

53 changes: 50 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,60 @@
import nox

nox.options.sessions = ["pre_commit", "tests"]


@nox.session
def pre_commit(session):
"""pre-commit checks"""
session.install("pre-commit")
session.run("pre-commit", "run", "-a")


@nox.session(python=["3.6", "3.7"])
@nox.session(python=["pypy3", "3.6", "3.7", "3.8"])
def tests(session):
session.install("pytest", "ruamel.yaml", ".")
session.run("pytest", "-sqvv", "tests")
"""Run unit test over different python env with code coverage"""
session.install("pytest", "pytest-cov", "ruamel.yaml", "-e", ".")
session.run(
"py.test",
"--cov=linkstatus",
"--cov-report",
"term-missing",
"--cov-branch",
"--color=yes",
"-s",
"-v",
)


@nox.session()
def ci_tests(session):
"""This is only to run test on ci"""
session.install("pytest", "pytest-cov", "coverage", "ruamel.yaml", "-e", ".")
session.run(
"py.test",
"--cov=linkstatus",
"--cov-report=xml",
"--cov-branch",
"--color=yes",
"-s",
"-v",
)
session.run("coverage", "report")


@nox.session()
def package(session):
"""Build and verify package"""
session.install("twine", "setuptools", "wheel")
session.run("python", "setup.py", "sdist", "bdist_wheel")
session.run("ls", "-l", "dist")
session.run("python", "-m", "twine", "check", "dist/*")


@nox.session()
def dev_setup(session):
"""Ensure development environment works everywhere. mainly with ci on different platform"""
session.run("python", "-m", "pip", "install", "-e", ".[dev]")
session.run("python", "-c", "import linkstatus; print(linkstatus.__spec__)")
session.install("pytest", "ruamel.yaml")
session.run("py.test", "-v", "tests/test_linkstatus.py")
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Natural Language :: English
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Intended Audience :: End Users/Desktop
Intended Audience :: Developers
Environment :: Console
License :: OSI Approved :: GNU General Public License v3 (GPLv3)

[options]
packages = find:
Expand All @@ -37,7 +38,7 @@ install_requires =
markdown
requests
include_package_data = True
python_requires = >=3.5
python_requires = >=3.6

[options.entry_points]
console_scripts =
Expand Down