| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,38 +1,59 @@ | |||
| 1 | - name: Link Status | ||
| 1 | + name: Tests | ||
| 2 | 2 | ||
| 3 | 3 | on: [push, pull_request] | |
| 4 | 4 | ||
| 5 | 5 | jobs: | |
| 6 | 6 | pre-commit: | |
| 7 | 7 | name: Pre-Commit Checks | |
| 8 | 8 | runs-on: ubuntu-latest | |
| 9 | + | ||
| 9 | 10 | steps: | |
| 10 | 11 | - name: Checkout to master | |
| 11 | 12 | uses: actions/checkout@master | |
| 12 | 13 | ||
| 13 | 14 | - name: Setup python | |
| 14 | 15 | uses: actions/setup-python@v1 | |
| 15 | 16 | with: | |
| 16 | - python-version: '3.7' | ||
| 17 | + python-version: '3.8' | ||
| 17 | 18 | architecture: 'x64' | |
| 18 | 19 | ||
| 19 | 20 | - name: Pre-Commit Checks | |
| 20 | 21 | 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 | ||
| 23 | 25 | ||
| 24 | 26 | - name: Analysis (git diff) | |
| 25 | 27 | if: failure() | |
| 26 | 28 | run: git diff | |
| 27 | 29 | ||
| 28 | - tests: | ||
| 29 | - name: Test-${{ matrix.os }}-Py${{ matrix.python-version }} | ||
| 30 | + package: | ||
| 31 | + name: Build & Verify Package | ||
| 30 | 32 | 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 | ||
| 32 | 54 | strategy: | |
| 33 | 55 | 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' ] | ||
| 36 | 57 | steps: | |
| 37 | 58 | - name: Checkout to master | |
| 38 | 59 | uses: actions/checkout@master | |
@@ -43,10 +64,39 @@ jobs: | |||
| 43 | 64 | python-version: ${{ matrix.python-version }} | |
| 44 | 65 | architecture: x64 | |
| 45 | 66 | ||
| 46 | - - name: Setup Package and Install Devel Dependencies | ||
| 67 | + - name: Unit Tests | ||
| 47 | 68 | 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 | ||
| 50 | 72 | ||
| 51 | - - name: Unit Tests | ||
| 52 | - run: py.test -v tests | ||
| 73 | + - name: Upload coverage to Codecov | ||
| 74 | + uses: codecov/codecov-action@v1.0.6 | ||
| 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,24 +10,25 @@ on: | |||
| 10 | 10 | jobs: | |
| 11 | 11 | build-and-publish: | |
| 12 | 12 | 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 | ||
| 14 | 15 | steps: | |
| 15 | 16 | - name: Checkout to master | |
| 16 | 17 | uses: actions/checkout@master | |
| 17 | 18 | ||
| 18 | 19 | - name: Setup python | |
| 19 | 20 | uses: actions/setup-python@v1 | |
| 20 | 21 | with: | |
| 21 | - python-version: '3.7' | ||
| 22 | + python-version: '3.8' | ||
| 22 | 23 | architecture: 'x64' | |
| 23 | 24 | ||
| 24 | - - name: Build Package | ||
| 25 | + - name: Build Package and Check | ||
| 25 | 26 | run: | | |
| 26 | - python -m pip install --upgrade setuptools wheel | ||
| 27 | + python -m pip install --upgrade setuptools wheel twine | ||
| 27 | 28 | python setup.py sdist bdist_wheel | |
| 29 | + python -m twine check dist/* | ||
| 28 | 30 | ||
| 29 | 31 | - name: Deploy to PyPi | |
| 30 | - if: startsWith(github.event.ref, 'refs/tags') | ||
| 31 | 32 | uses: pypa/gh-action-pypi-publish@master | |
| 32 | 33 | with: | |
| 33 | 34 | user: __token__ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,15 +54,15 @@ Below is the steps for setting up a development environment | |||
| 54 | 54 | ```shell | |
| 55 | 55 | git clone https://github.com/pythonpune/linkstatus | |
| 56 | 56 | cd linkstatus | |
| 57 | - virtualenv .venv | ||
| 57 | + python -m venv .venv | ||
| 58 | 58 | source .venv/bin/activate | |
| 59 | - python -m pip install -Ur dev-requirements.txt | ||
| 60 | 59 | python -m pip install -e . | |
| 61 | 60 | linkstatus --help | |
| 62 | 61 | ``` | |
| 63 | 62 | ||
| 64 | 63 | # Run unit test with nox | |
| 65 | 64 | ```shell | |
| 65 | + python -m pip install nox | ||
| 66 | 66 | nox --list # list all available sessions | |
| 67 | 67 | nox -s pre_commit # run pre-commit checks | |
| 68 | 68 | nox -s tests # run unit tests | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,11 +3,10 @@ | |||
| 3 | 3 | ||
| 4 | 4 | <p align="center"> | |
| 5 | 5 | <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> | ||
| 9 | 6 | <a href="https://pypi.org/project/linkstatus/#history"><img alt="PyPI version" src="https://badge.fury.io/py/linkstatus.svg"></a> | |
| 10 | 7 | <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> | ||
| 11 | 10 | <a href="https://pypi.org/project/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> | |
| 12 | 11 | </p> | |
| 13 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,60 @@ | |||
| 1 | 1 | import nox | |
| 2 | 2 | ||
| 3 | + nox.options.sessions = ["pre_commit", "tests"] | ||
| 4 | + | ||
| 3 | 5 | ||
| 4 | 6 | @nox.session | |
| 5 | 7 | def pre_commit(session): | |
| 8 | + """pre-commit checks""" | ||
| 6 | 9 | session.install("pre-commit") | |
| 7 | 10 | session.run("pre-commit", "run", "-a") | |
| 8 | 11 | ||
| 9 | 12 | ||
| 10 | - @nox.session(python=["3.6", "3.7"]) | ||
| 13 | + @nox.session(python=["pypy3", "3.6", "3.7", "3.8"]) | ||
| 11 | 14 | 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") | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,12 +21,13 @@ long_description = file: README.md | |||
| 21 | 21 | long_description_content_type = text/markdown | |
| 22 | 22 | classifiers = | |
| 23 | 23 | Natural Language :: English | |
| 24 | - Programming Language :: Python :: 3.5 | ||
| 25 | 24 | Programming Language :: Python :: 3.6 | |
| 26 | 25 | Programming Language :: Python :: 3.7 | |
| 26 | + Programming Language :: Python :: 3.8 | ||
| 27 | 27 | Intended Audience :: End Users/Desktop | |
| 28 | 28 | Intended Audience :: Developers | |
| 29 | 29 | Environment :: Console | |
| 30 | + License :: OSI Approved :: GNU General Public License v3 (GPLv3) | ||
| 30 | 31 | ||
| 31 | 32 | [options] | |
| 32 | 33 | packages = find: | |
@@ -37,7 +38,7 @@ install_requires = | |||
| 37 | 38 | markdown | |
| 38 | 39 | requests | |
| 39 | 40 | include_package_data = True | |
| 40 | - python_requires = >=3.5 | ||
| 41 | + python_requires = >=3.6 | ||
| 41 | 42 | ||
| 42 | 43 | [options.entry_points] | |
| 43 | 44 | console_scripts = | |
| Back | FazBrowse Home | New Git URL |
0 commit comments