Skip to content

Commit

Permalink
Merge pull request #7 from sarnold/cleanup-pr
Browse files Browse the repository at this point in the history
Cleanup pr
  • Loading branch information
lowks authored Feb 24, 2021
2 parents 648d8c2 + bbdb53a commit bbef798
Show file tree
Hide file tree
Showing 18 changed files with 520 additions and 68 deletions.
35 changes: 35 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## actual check/plugin settings (required if .codeclimate.yml exists)

version: "2" # required to adjust maintainability checks
checks:
argument-count:
config:
threshold: 8
complex-logic:
config:
threshold: 4
file-lines:
config:
threshold: 250
method-complexity:
config:
threshold: 15
method-count:
config:
threshold: 20
method-lines:
config:
threshold: 25
nested-control-flow:
config:
threshold: 5
return-statements:
config:
threshold: 5
similar-code:
config:
threshold: # language-specific defaults. an override will affect all languages.
identical-code:
enabled: false
config:
threshold: # language-specific defaults. an override will affect all languages.
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
omit =
.tox/*
setup.py

plugins =
coverage_python_version
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Set default behaviour to automatically normalize line endings.
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is
# accessed in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is
# accessed in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Smoke

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
tests:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
PYTHONIOENCODING: utf-8
PIP_DOWNLOAD_CACHE: ${{ github.workspace }}/../.pip_download_cache
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Add python requirements
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tests
run: |
tox
env:
PLATFORM: ${{ matrix.os }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
env_vars: OS,PYTHON

- name: Build sdist/wheel
run: |
tox -e build
55 changes: 55 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Conda

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-2016, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

runs-on: ${{ matrix.platform }}

# The setup-miniconda action needs this to activate miniconda
defaults:
run:
shell: "bash -l {0}"

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Cache conda
uses: actions/cache@v1
with:
path: ~/conda_pkgs_dir
key: ${{matrix.os}}-conda-pkgs-${{hashFiles('**/conda/meta.yaml')}}

- name: Get conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: strict
use-only-tar-bz2: true
auto-activate-base: true

- name: Prepare
run: conda install conda-build conda-verify nose

- name: Build
run: conda build conda

- name: Install
run: conda install -c ${CONDA_PREFIX}/conda-bld/ minimock

- name: Test
run: nosetests -x --detailed-errors .
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
# release on tag push
tags:
- '*'

jobs:
create_release:
runs-on: ubuntu-20.04

steps:
- name: Get version
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: 3.7

- name: Install gitchangelog
run: |
python -m pip install https://github.com/freepn/gitchangelog/archive/3.0.5.tar.gz
- name: Generate changes file
run: |
export GITCHANGELOG_CONFIG_FILENAME=$(get-rcpath)
bash -c 'gitchangelog $(git tag --sort=taggerdate | tail -n2 | head -n1)..${{ env.VERSION }} > CHANGES.md'
- name: Create draft release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body_path: CHANGES.md
draft: false
prerelease: false
14 changes: 14 additions & 0 deletions .pep8speaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
scanner:
linter: flake8 # Other option is pycodestyle

no_blank_comment: False # If True, no comment is made on PR without any errors.
descending_issues_order: True # If True, PEP 8 issues in message will be displayed in descending order of line numbers in the file

[flake8]
exclude =
.git,
__pycache__,
build,
dist

max-line-length = 105
File renamed without changes.
26 changes: 23 additions & 3 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@
News
----

hg tip
------
1.2.9
-----

New
~~~
- pkg: add initial conda recipe and workflow (plus .gitattributes)
[Stephen L Arnold]
- Add some flake8 cleanup and tool cfgs. [Stephen L Arnold]


Changes
~~~~~~~
- Use nose wth coverage and detailed-errors for smoke test. [Stephen L
Arnold]

Fix
~~~
- Replace os.path.isfile in lookup_by_name (fails on windows <py38)
[Stephen L Arnold]

* (note not-yet-released changes here)
Other
~~~~~
- cleanup python/pkg versions, update tox cfg, switch CI [Stephen L
Arnold]

1.2.8
-----
Expand Down
5 changes: 2 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
include README.rst
include CHANGELOG.txt
include LICENSE.txt
include README.rst CHANGELOG.txt LICENSE.txt
include pyproject.toml setup.py setup.cfg
50 changes: 43 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
MiniMock
========
|ci| |conda| |release| |python|

|tag| |cov| |license| |climate| |reqs|

.. contents::
:depth: 1

.. image::
https://secure.travis-ci.org/lowks/minimock.png?branch=master
:alt: Build Status
:target: https://travis-ci.org/lowks/minimock

-----------------------
License & Collaboration
-----------------------

MiniMock is by `Ian Bicking <http://ianbicking.org>`_ with
substantial contributions by Mike Beachy, and is maintained by
MiniMock's original author was `Ian Bicking <http://ianbicking.org>`_
with substantial contributions by Mike Beachy, and is maintained by
Low Kian Seong. It is licensed under an `MIT-style license
<https://github.com/lowks/minimock/blob/master/LICENSE.txt>`_.

Expand Down Expand Up @@ -147,3 +145,41 @@ proper modules first. Alternately you can pass in a dictionary like
To restore all the objects mocked with ``mock()``, use
``minimock.restore()`` (with no arguments; all the mocks are kept
track of).


.. |ci| image:: https://github.com/lowks/minimock/workflows/Smoke/badge.svg
:target: https://github.com/lowks/minimock/actions?query=workflow:Smoke
:alt: CI Status

.. |conda| image:: https://github.com/lowks/minimock/workflows/Conda/badge.svg
:target: https://github.com/lowks/minimock/actions?query=workflow:Conda
:alt: Conda Status

.. |release| image:: https://github.com/lowks/minimock/workflows/Release/badge.svg
:target: https://github.com/lowks/minimock/actions?query=workflow:Release
:alt: Release Status

.. |climate| image:: https://img.shields.io/codeclimate/maintainability/lowks/minimock
:target: https://codeclimate.com/github/lowks/minimock
:alt: Maintainability

.. |license| image:: https://img.shields.io/github/license/lowks/minimock
:target: https://github.com/lowks/minimock/blob/master/LICENSE.txt
:alt: License

.. |tag| image:: https://img.shields.io/github/v/tag/lowks/minimock?color=green&include_prereleases&label=latest%20release
:target: https://github.com/lowks/minimock/releases
:alt: GitHub tag (latest SemVer, including pre-release)

.. |cov| image:: https://img.shields.io/codecov/c/github/lowks/minimock
:target: https://codecov.io/gh/lowks/minimock
:alt: Codecov

.. |python| image:: https://img.shields.io/badge/python-3.6+-blue.svg
:target: https://www.python.org/downloads/
:alt: Python

.. |reqs| image:: https://requires.io/github/lowks/minimock/requirements.svg?branch=master
:target: https://requires.io/github/lowks/minimock/requirements/?branch=master
:alt: Requirements Status

29 changes: 29 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
codecov:
require_ci_to_pass: yes

coverage:
status:
project:
default:
target: 100%
threshold: 2%

notify:
irc:
default:
server: chat.freenode.net
channel: '##code-hell'
branches: master
threshold: 2
message: null

ignore:
- ".tox/.*"
- "*.rst"

comment:
layout: "header, diff, changes, sunburst, uncovered, tree"
# layout: "reach, diff, flags, tree"
branches: null
behavior: default
require_changes: no
Loading

0 comments on commit bbef798

Please sign in to comment.